Categories
Weblogging

Happy birthday, Mark

Recovered from the Wayback Machine.

Today, November 24 2002, Mark Pilgrim has a milestone birthday — he turns 30.

And since this is Mark, how else does one express Birthday greetings?

<item>
<title>Happy Birthday</title>
<link>http://diveintomark.org</link>
<description> Happy Birthday to you, Mark</description>
<dc:subject>Greeting</dc:subject>
<dc:date>2002-11-24T00:00:30-06:00</dc:date>
</item>

Better yet:

<item rdf:about=”http://weblog.burningbird.net/fires/000673.htm”>
<title>Happy Birthday</title>
<link>http://diveintomark.org</link>
<description> Happy Birthday to you, Mark</description>
<dc:subject>Greeting</dc:subject>
<dc:creator>Bb</dc:creator>
<dc:date>2002-11-24T00:00:30-06:00</dc:date>
</item>

Categories
RDF

RDF Query-O-Matic light

Recovered from the Wayback Machine.

I slaved away this afternoon, persevering in my work in spite of numerous obstacles (sunshine, cat on lap, languor) to bring you RDF Query-o-Matic Light – the PHP-based RDFQL machine. A grueling six or so lines of code. I sit in exhaustion on my stool, fanning myself with old green bar computer paper.

Speaking of stools, that reminds me of another nursery rhyme associated with RDF.

Little Miss Muffet, sat on a tuffet,
Eating her curds and whey;
Along came a spider,
Who sat down beside her
And frightened Miss Muffet away.

Chances are, the stool referenced in this rhyme was a three legged one, similar to the milk stools still used today. Three is the perfect number of legs for a stool: just enough legs to provide stability, but without the need for the additional material for an extraneous fourth leg.

Returning to the subject of RDF, it, like the milk stool, is based on the principle that ‘three’ is the magic number – in this case three pieces of information are all that’s needed in order to fully define a single bit of knowledge. Less than three, then all you have is fact without context; more, and you’re being redundant.

Of the three pieces of information, the first is the RDF subject. After all, when discussing a property such as name, it can belong to a dog, cat, book, plant, person, car, nation, or insect. To make finite an infinite universe, you must set boundaries, and that’s what subject does for RDF.

The second piece of information is the predicate, more commonly thought of as the RDF ‘property’. There are many facts about any individual subject; for instance, I have a sex, a height, a hair color, eye color, degree, relationships, and so on. To focus on that aspect of me that we’re interested in at any one point in time, we need to specifically focus on one of my ‘properties’.

If you look at the intersection of ’subject’ and ‘property’, you’ll find the final bit of information quietly waiting to be discovered – the value of the property. X marks the spot.

I am me. I have a name (Shelley Powers). I have a height (close to six feet). I have an attitude (sweet tempered and quite easy going). Each of these bits of knowledge form a picture, and that picture is me.

All from RDF triples strung together in precise ways.

On to the new version of the RDF Query-o-Matic, the PHP-based Query-o-Matic Light. This version, like the JSP version can apply a valid RDFQL query against a valid RDF file, printing out a target value. However, there are some minor syntactic differences between the two.

The PHP classes that provide the functionality for Light (PHP XML rdql), include the file name as well as explicit namespace use within the query rather than as separate elements. For instance, the following query will access titles from all elements contained within my resume.rdf file – a file with an experimental resume RDF vocabulary:

SELECT ?b
FROM <http://weblog.burningbird.net/resume.rdf>
WHERE (?a, <bbd:title>, ?b)
USING bbd for >http://www.burningbird.net/resume_schema#>

The first line is the same SELECT clause, as discussed in the last RDFQL posting, but this is followed by a FROM clause, which lists the RDF file’s URL within angle brackets. Following is the WHERE clause containing the query, and again, this is no different than the JSP version, except that an alias is used instead of the full namespace. The namespace itself is listed in the last clause, delimited with the USING keyword.

Regardless of some syntactic differences, the query still returns the same result.

Taking the Light version of Query-o-matic out for a spin, I went looking for more complex queries, and found one in Phil’s Comments RDF. Though deceptively simple looking, Phil’s RDF file, in fact any RSS 1.0 RDF file, has one nasty little complication: containers.

An RDF container is an RDF object that groups related items together, usually with some implied processing as to order. An RDF container can group ordered items (SEQ), alternative items (ALT), or just a collection of unordered items (BAG). An RDF container is also a bit of a bugger when it comes to processing or generating RDF, one reason that they lack popularity.

However, the key to overcoming the difficulties associated with containers is the same as the one used with RDFQL queries – work with it one step at a time.

Container elements can be accessed individually by knowing that each item appears as an object in a (subject, predicate, object) triple with a predicate of TYPE (http://www.w3.org/1999/02/22-rdf-syntax-ns#type using the namespace). To access all container elements using RDFQL, you would need to have a WHERE clause similar to:

(?subject, <rdf:type>, “http://purl.org/rss/1.0/item”)

This will return all container elements within the RDF document for the JSP version of Query-o-Matic, but not the Light version. The PHP version doesn’t allow for literals (the “http://purl.org/rss/1.0/item” value) directly within the query triple. Instead, you use a filter, designated by the keyword AND:

WHERE (?subject, <rdf:type>, ?object)
AND ?object==”http://purl.org/rss/1.0/item”

This triple query filters the elements returned, giving us a target set of subjects that are equal to all of the container elements in the document. With Phil’s comments RDF/RSS file, this is all the comments.

Once we have the container elements, the subject values are then are passed into the next triple query, to access the DESCRIPTION property for each (the description holds the actual comment in RDF/RSS Comments). The value of the DESCRIPTION predicate is our target value, which gets printed out.

Pulling this all together, the query to access all of the actual comment text in the RDF document is:

SELECT ?desc
FROM <http://philringnalda.com/comments.rdf>
WHERE (?subject, <rdf:type>, ?object),
(?subject, <rss:description>, ?desc)
AND ?object==”http://purl.org/rss/1.0/item”
USING rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>,
rss for <http://purl.org/rss/1.0/>

The mapped values – the subjects – are highlighted. The subjects found in the first triple query are passed as subjects to the next.

Check out the results.

I’m actually not fond of container elements myself, precisely because there is processing semantics integrated into the element – sequence is assumed to be an ordered list of items, while a bag is not. I would rather provide the information necessary to order elements – such as date or some other characteristic – and then let the tool creators decide how they want the elements ordered.

Regardless, the trick to working with container elements is to use the TYPE predicate to discover the container elements, pull the subject associated with each, and then use these with relatively standard RDFQL for the rest of the query.

You can use both the JSP-based Query-o-matic and the PHP-based Query-o-Matic Light to try out different queries on whatever valid RDF documents you know of. Documentation for the RDFQL syntax used with the JSP based version can be found here, and the RDFQL syntax for the Light version can be found here. Remember that though there are syntactic differences between the two, the actual RDFQL used in the WHERE clause is logically the same – one or more chained triples, with the results of the first triple being passed to the second and so on.

Now that I have my query engines and can test my RDFQL, the next step is to pull these queries into an actual application, covered in the next of these essays into RDF and RDFQL.

To try the JSP Query-o-matic yourself, download and install Jena into your own environment. The actual o-matic JSP page can be downloaded here.

To try out o-Matic light, download and install the PHP XML classes. The PHP I used can be downloaded here.

Remember, these are for fun. So, have fun.

 

Categories
Just Shelley Weblogging

On simmer

Recovered from the Wayback Machine.

Leave it to Dorothea to help me put the finger on my period of discontent. Today she writes:

I find I have nothing in particular to blog today, at least nothing that I really care (or dare) to talk about.

She then eloquently non-blogs about what she can’t or won’t blog about, such as the goth kitties, gaming, politics, sexism, and even RDF. On RDF she writes:

If I tackle RDF, Burningbird really will spit me for a weenie roast, because I’m mostly not in agreement with her. Besides, I don’t know what I’m talking about and I probably never will, given that many people smarter and more skilled than I am can’t seem to get anywhere with it.

My first reaction to this was to email Dorothea and tell her to write what she wants — even my own editor on the book doesn’t agree with me (but in the nicest possible way). But sadly, I have to acknowledge the truth of what she speaks: with my current edgy mindset, I am highly combustible, and I really don’t want to roast my friends. Except in good fun.

(As for the skilled and smart comment, ha! I kick the butt of the woman who is her own worst detractor. Kick! But I could wish she takes on sexism as she does a goodly job of it. Have no fears, I will cheer you on, brave woman! And if any male does detract from you, does sneer and hint of humor and whine as a dog whines at our feet, then speak out! We women, we mysterious and powerful creatures of weblogging, will stomp him into dusty bytes for you, milady.)

I don’t know if it was my birthday, or the quiet introspection I’m seeing progressively out and about in the virtual neighborhood (as witness Mark Pilgrim’s and Jonathon Delacour’s recent breaks, Stavros/Chris blogging hiatus, the less frequent and quieter postings for most of my friends, and now Mike Golby’s own search for blogging peace), but I’m finding that my time off in the last few weeks just wasn’t enough. I’m tired. I’m dead, bone weary tired. Not depressed or sad — physically and mentally exhausted.

I want to read, but I don’t want to write. At least, not to the weblog. I want to finish the re-writes on the RDF book (and Dorothea will get first crack at it when done). I also want to finish my Post Content tool, the fun things I’m doing with my MT installation, and my web site redesign and reorganization. Then, when I’m done, I want to share them with you but as accomplishments, not as items on my to-do list.

And I want to lurk. I want to visit your weblogs, as King Henry visited his soldiers, cloaked in the anonymity of being just another faceless page hit.

Can one follow a break from weblogging with another break from weblogging? Sure we can, as long as we’re willing to watch our rank in the blogging ecosystem sink like a elephant in quicksand; and to risk returning with a cheery “I’m back!” only to find no one cares.

But it has to be better than roasting friends — flaming them to a crisp — who are interested enough in what we say to disagree with us.

Categories
People

What’s Elvish for tired

Recovered from the Wayback Machine.

I’m tired and should go to bed. Today was not one of my better days.

However, my cat sensed that my day was poor and quietly curled up my arms, rubbing her head against my chin, purring like mad. I took her for a walk on our deck, and she now thinks I’m better than catnip.

Then I watched my new copy of the extended version of Lord of the Rings, a present from my roommate. The MTV re-make of the Elvish council was a hoot. When I got to the scenes where the characters were speaking Elvish, I turned to my roommate and proudly said, “I know the wife of the person responsible for the Elvish speech”.

“You know Hugo Weaving’s wife?”

I explained that, no, Dorothea’s husband David was the linguist responsible for the Elvish speech throughout the movie. I hope Dorothea will be pleased to know that my roomie was far more impressed at this association then he would have been had I known Hugo Weaving’s wife.

Categories
RDF

The saga of RDF continues

Recovered from the Wayback machine.

The posting I wrote on Friday about RDF has triggered much debate (in posting and at xml-dev), which is a goodness. I think it’s also triggered much misinterpretation and misunderstanding, which is what happens when a debate occurs across threads of mailing lists and weblog comments.

There has been summary attempts of the debate, such as at O’Reilly Network and at Joe Gregorio’s, but I’m not going to attempt to summarize it myself. Why? I have a viewpoint in this, and this would slant my summary. I’d rather just provide the links and let you form your own summation.

However, I do want to clarify something with my own position.

First, I’m not speaking for the RDF Working Group, in any way. I am giving my own viewpoints and opinions, which the WG may not agree with. No one can speak for the WG members, but they, themselves.

Additionally, I do not discount the complexity and difficulty inherent with RDF. I am aware, all too aware, of how complex the RDF Model documents can be. I know that there is much of the lab and not enough of the real world associated with the effort. And I’m not trying to dismiss people’s concerns with the model or the RDF/XML serialization when I say that we need to release the RDF specification rather than start over.

When I say that I don’t have problems with the RDF/XML, people should be aware that this is because I spent an enormous amount of time with the RDF specifications learning the core of the RDF model. I then spent a considerable amount of time learning how RDF is serialized with RDF/XML. I will now spend a significant amount of time reading through the newly released specifications to see where my understanding differs from the newest releases.

All of this has taken time and effort. I do not deny this.

I also don’t deny the importance of people being able to read and write RDF/XML. However, my interpretation of XML has been, and continues to be, that it’s a mechanical language rather than a biological one, and that it must be accurate, consistent, and reliable in a mechanical sense first, and foremost. Within these constraints, though, we should work to make the syntax as biologically understandable as possible.

Ultimately, I’m not trying to defend RDF/XML as much as I’m trying to generate understand that the problems people are having with RDF/XML aren’t consistent, and may not necessarily be problems with RDF/XML, at all.

Tim Bray creates RPV, which makes the RDF triples easier to read, but Simon St. Laurent says he doesn’t think in triples. Simon, on the other hand, is more concerned that RDF is having a deleterious effect on XML directly, as witness discussions about Qnames and URIs. These are two separate interpretations of “what’s wrong”, and lumping them all together into vague generalizations such as “RDF is ugly” or “RDF/XML is ugly” won’t help anyone.

Because of the discussions in the last week, I am re-visiting the chapters I wrote on the RDF specification for the Practical RDF book, coming in with a fresh perspective, and a better understanding of what the heck I need to write about. Unfortunately, I know enough after this weekend to be aware that this is going to be the most difficult technical writing task I have ever had. Can I clarify RDF and RDF/XML to the point that everyone understands both equally?

Exactly how does one achieve the impossible in 10,000 words, or less?


Posted by Bb at November 18, 2002 10:32 AM