[rdfweb-dev] foaf:knows and XFN

Dan Libby danda at videntity.org
Tue Oct 18 02:53:43 UTC 2005


Hi all,

I would like to incorporate XFN [1] data into FOAF files and I'm trying
to figure out the best way to do it, so that the data model and the XML
both make sense.  If someone has already done this or if there a
"standard" way, I'd like to hear about it.

As I see it, the issue is that foaf defines one generic type of
relationship, foaf:knows -- whereas XFN defines many.

So I would like to keep the existing foaf:knows linkage, but add
modifiers that describe _how_ the person is known ( the type of
relationship ).   That would seem to require assigning each foaf:knows
property a unique ID and then attaching xfn relationships.  Something like:

<rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xfn="http://gmpg.org/xfn/">
<foaf:Person>
 <foaf:knows rdf:ID="knows1">
  <foaf:Person><foaf:nick>danda</foaf:nick></foaf:Person>
 </foaf:knows>
</foaf:Person>
<rdf:Description rdf:about="#knows1">
 <xfn:relationship>parent met</xfn:relationship>
</rdf:Description>
</rdf:RDF>

The above sort of makes sense to me intuitively.  There is a foaf:knows
relationship and we describe that relationship using XFN adjectives via
a single xfn:relationship property. We are describing a relationship
between nodes rather than adding new relationship(s).  Note that in XFN
it is expected that the client is going to parse the rel="parent met"
attribute, so I don't see it as a problem that multiple relations are
combined in one string literal.  At least not if one is viewing this as
a mechanism to transport XFN data within FOAF.

Okay, but the above is a bit nasty XML-wise.  It requires descriptions
outside the main foaf:Person element.  So another way to do it could be
to create a unique property for each xfn relationship type. This would
be similar to the existing foaf relationship module, except using a
different namespace.  We might then end up with something like:

<rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xfn="http://gmpg.org/xfn/">
<foaf:Person>
 <foaf:knows>
  <foaf:Person rdf:ID="person1"><foaf:nick>danda</foaf:nick></foaf:Person>
 </foaf:knows>
 <xfn:parent rdf:nodeID="person1"/>
 <xfn:met rdf:nodeID="person1"/>
</foaf:Person>
</rdf:RDF>

This is possibly cleaner in that an RDF engine can directly view the
parent and met relationships without understanding any xfn semantics. It
is potentially more verbose however, especially when multiple xfn
relationships exist.  And we are adding relationships between nodes
rather than describing the foaf:knows relationship.


Reading back over this and looking at the generated graphs, I think the
concensus will probably be that the second is the better approach.  But
I'd still like to hear that, or an alternative proposal.   thanks.

Dan Libby

[1] http://gmpg.org/xfn/1




More information about the foaf-dev mailing list