Dive into anonymous nodes
Mark is looking at Friend Of A Friend. That’s good. Mark’s parsing his FOAF. That’s not so good, since in my limited experience anonymous nodes aren’t the easiest thing to grasp, and FOAF is all anonymous nodes.
RDF is just sets of statements consisting of subject-predicate-object (or, in the form I can understand, thing-property-value), but sometimes the subject doesn’t actually have a URI, so you have to talk about properties and values of “the thing I’m talking about right now.”
My introduction to the idea of anonymous nodes was a tiny bit less painful, since the rdf:Seq in RSS 1.0, baffling though it is, is at least clearly something that only exists within the context of the current file, and so it makes sense to say “thing I’ll call #1 has the type Sequence”, and then “my feed has items listed in thing I call #1”, and then (I’ll stop soon, I promise) “thing I call #1 has a first thing of entry 2320.” Store that away in an RDF data store, and then if you want to know the order of items in my feed, you ask “what to you call a list of items in Phil’s feed?”, and the answer is “#1” (really, something more like “http://www.philringnalda.com/index.rdf#genid1”), so you say “tell me everything you know about genid1” and get back a statement that genid1 is a Sequence, and statements of the value for items 1 through 15 in that sequence. Clear as mud.
The anonymous nodes in FOAF are a little more slippery, since every single thing in FOAF is anonymous. There’s no single URI that represents the personhood of Mark. If you use his homepage or email address as the subject, you end up saying that his homepage knows me or his email address is named Mark. You could insist that everyone who wants to use FOAF make up a URI that represents them, but once you grasp the nettle of anonymous nodes, there’s really no point to it. The things you want to ask a FOAF store are things like “who do you know named Mark?” or “what do you know about the person with the homepage at http://diveintomark.org?”, and it just doesn’t matter what the data store calls the subject of those queries. At least that’s my explanation.
One alternative is to use the rdf:ID attribute which will define a resource of (FOAF file’s URI)#attr-value, such as http://www.pipetree.com/~dj/foaf.rdf#qmacro in my case.
Yeah, I saw that in Mark’s file, and started down the path of looking into it, but then I got in a hurry to click Save. While I still think it’s exactly the same thing if the reply to your query is ”genid1 foaf/0.1/knows genid2”, I have to admit that it’s a whole lot easier to see that you are saying what you mean with
triple(”http://www.pipetree.com/~dj/foaf.rdf#qmacro”, ”http://xmlns.com/foaf/0.1/knows”, ”http://www.pipetree.com/~dj/foaf.rdf#edd”)
which says plain as day ”qmacro knows edd”. Anything that makes RDF triples readable to someone at my level is A Good Thing. I’m off to change my file.
Aside: isn’t ”knows” a pretty damn broad term? I don’t really ”know” a single person with a FOAF file, though I certainly ”knowOf” or maybe ”knowPublicPersonaOf” quite a few.
FOAF relationship module: http://www.perceive.net/schemas/20020729/relationship/
No idea how to use it. If you figure it out, let me know.
Technically Phil, you don’t have any anonymous (blank) nodes in your FOAF file.
Not now, since DJ pointed out that adding rdf:ID would make my head less likely to spin, but didn’t I prior to that? I’m at the point of doubting every single thing I think I know about RDF, but when people talk about anonymous nodes, aren’t they talking about the result of parsing things like the standard FOAF serialization:
<rdf:RDF
xmlns:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:foaf=”http://xmlns.com/foaf/0.1/”>
<foaf:Person>
<foaf:name>Edd Dumbill</foaf:name>
<foaf:mbox rdf:resource=”mailto:edd@….com” />
</foaf:Person>
</rdf:RDF>
which parses as:
ordinal(0) triple(anonymous(”http://philringnalda.com/rdf/foofoaf.xml#genid1”), ”http://www.w3.org/1999/02/22-rdf-syntax-ns#type”, ”http://xmlns.com/foaf/0.1/Person”)
ordinal(0) triple(anonymous(”http://philringnalda.com/rdf/foofoaf.xml#genid1”), ”http://xmlns.com/foaf/0.1/name”, literal(”Edd Dumbill”))
ordinal(0) triple(anonymous(”http://philringnalda.com/rdf/foofoaf.xml#genid1”), ”http://xmlns.com/foaf/0.1/mbox”, ”mailto:edd@….com”)
(though generally with some more likely filename than foofoaf). Please tell me that that’s what people mean by anonymous nodes, and that I at least grasp that much, much as I hate the statement ”the mailbox of genid1 is edd@…”
Ah, and FOAF relationship… I saw that, said ”uh, got an example around here somewhere?”, and wandered off. It’s not like it’s complete, anyway: it lacks both ”rel:stalkerOf” that I need for Shannon, and the all-important subclass of ”foaf:knows” – ”foaf:knowsBiblically”.
So you added the rdf:ID yourself. Makes more sense then. Sorry, tired.
The FOAF generator may use blank nodes, but that’s not an inherent part of the vocabulary. However, when to use blank nodes and not isn’t exactly clear within the documentation. Mistake there.
I’m not one of the FOAF people, but here’s my understanding:
FOAF uses the ”mbox” property to distinguish people, not the node ID. That’s why the values of mbox have to be e-mail addresses that you were the first to use. Since only one person can be the first person to use an e-mail address, it uniquely identifies you.
You can assign nodes URI references for convenience, if you so desire, but FOAF doesn’t require them.
I’m just guessing here, Mark but I’d guess it’s go like this (the <rel:whatever> replacing the <foaf:knows>):
A quick google search on some stuff in the schema seems to support that. All the rel: whatever properties are subproperties of foaf:knows, so that they all collapse to foaf:knows when a parser doesn’t know the rel module — of course that means it’d have to look at the relationship schema to be able to collapse that, which I’m not sure about, so it could be a <rel:enemyOf> nested right inside a <foaf:knows> but that doesn’t seem right…
Does anyone know for sure?
That fits with my (mis)?understanding of RDF Schema: saying that <rel:enemyOf> is a subPropertyOf <foaf:knows> means that it’s a more specific instance of <foaf:knows>, and so you use it in place of <foaf:knows>. Simple enough for a producer. What it means to a consumer looks a bit more difficult: I go around parsing FOAF and RSS 1.0 files, and every time I find one with a new namespace, I need to find the schema (which may be embedded in the document I get from treating the namespace URI as a URL, or maybe not), and parse it as well, so that when you ask me ”who <foaf:knows> Roadrunner” I first ask myself ”what’s subPropertyOf <foaf:knows>”, then look up everyone I know of that either <foaf:knows> or <rel:*> Roadrunner, so I can say ”Magpie <foaf:knows> Roadrunner, and Coyote <foaf:knows> Roadrunner to the extent that Coyote <rel:enemyOf> Roadrunner”.
Golly, you guys are smart.
That’s actually the driving force behind RDF: chicks dig guys that get it.
I am always letting the cat out of the bag.
Phil, your analysis makes sense to me, but damn, is it all really that open-ended? If so, that’s an amazing amount of power for producers, but it makes life complete hell for consumers. What kind of RDF consuming tools are available to handle cases like this? Yours doesn’t even seem to care about missing namespaces, so presumably it’s not doing any sort of semantic auto-hierarchy-building either. Does that mean it’s all up to you (the developer)?
Things are a bit… loose out here on the frontier, aren’t they?
Two choices I see: I say ”I’m building this app to combine RSS from posts and comments and FOAF and make a sort of search engine. If you want to play, you must have exactly the following elements in the following places in the following files, or I can’t do anything with your stuff.”, and make my life a whole lot easier, or I rewrite my tools (have to anyway, they think RDF files are static), and write what I’d guess will be the world’s first PHP RDF schema parser (why can’t there be a standard for where the rdfs lives?), rewrite the query language to look for subPropertyOf, and expand the sorts of things I can process.
It seems sloppy as all get out, but I think that’s what RDF is: if you released an XML-based aggregator in August, it’s screwed when it comes across an RSS 2.0 feed with <comments> – it’s got no clue what that might be – is the content a literal, a URI, or a URL? should it be labelled Comments because it shows them, or Comment because it leads to a form to add a comment?. If you released an RDF-based aggregator, and I then added <phil:commentURI> to my feed, with a schema at the namespace URI for phil that explains what it is and how to label it well enough, then you can display it as a link labelled ”Comments” with the title ”Link to comments on this post” (and probably a button saying ”never display this element again”, since there’s a lot of possible elements that nobody would ever want to see twice). Building an aggregator that can learn (both from the schema and from instructions from the user) wouldn’t be especially easy, but if someone does, I’ll be using it the second it comes out.
Yeah that’s exactly why I got into all this tech ’stuff’, because I want to get chicks.
Ahh! Glad someone else has found my relationship module!
Check out my FOAF for an example:
http://www.perceive.net/xml/foaf.rdf
My FOAF is fairly complex, however, using references and all.
the general concept however for FOAF:relationship is simple – replace foaf:Knows with foaf:parentOf, or any of the others – they are all simply different names for foaf:knows.
Hopefully sometime soon I’ll get back to FOAF and be able to write some examples and documentation
Bb: my apologies. Even though I was raised right (my first memory of anything political was going to the committee hearing on ratifying the ERA), every now and then I prove that it didn’t really take.
Phil, no worries. I was just joining in the fun.
new comments RDF feed
Due to some developments by Phil, and using his template and plugin for movable type, I’ve created a comments RDF
Well, FOAF you too!
It would seem that there are folks out and about playing with RDF, in particular FOAF,a Friend-of-a-Friend RDF vocabulary. Mark Pilgrim’s playing with it. So is Sam Ruby and Phil. Phil had some problems with the original FOAF file generated for him by …