[rdfweb-dev] foaf:knows and XFN

Libby Miller libby at asemantics.com
Tue Oct 18 10:28:06 UTC 2005

hi Dan,

I haven't had a chance to look properly at Videntity.org yet, but I will.
I can quickly comment on some of your ideas below though.

On Mon, 17 Oct 2005, Dan Libby wrote:

> 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.

There have been a few mappings between the two - see

and linked from there:

and Danny Ayers has looked at it too though his site seems slow today.

> 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>

This isn't working how you think it is, unfortunately. Try running it
through http://www.w3.org/RDF/Validator/ with a graph as well as triples.
Due to a syntax quirk with RDF using rdf:ID here reifies some of the data
- which isn't what you want.

In general, RDF does not allow you to talk about properties in this way,
except in an RDF schema (see below) or by reifying it (which causes a
bunch of problems and is to be avoided).

> 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 actually says something different in RDF and is much closer to what
you want I think (try the validator with graph again).

> 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.

Check out the links at the top for various approaches.

In general the relationship between knows and more specific properties in
Foaf is handled by using RDF subproperties. So for example there's a
'relationship' vocabulary:


which has 33 specializations of 'knows'. Because each of these is a
subproperty of foaf:knows there's no need to say explicitly that when a
rel:acquaintanceOf relationship holds between 2 people that a foaf:knows
relationship also holds between them - an rdfs aware reasoner will work
this out. Having siad that it's often better to be explicit that they both
pertain since not all RDF systems use reasoning. But it's generally good
practice if writing a RDF schema where this subproperty holds to make it
explicit in the schema at least, because it makes this relationship clear.

Anyway for your problem, you could perhaps use the relationship
vocabulary, or roll your own specific to xfn as Masahide Kanzaki sketched
out in the link at the top. The key thing for the syntax to use for the
RDF is that it should not be the first example (which says the wrong
thing, however counter-intuitive that seems). The second looks fine.

Hope that helps. People on irc.freenode.net #foaf may be able to help
more or for similar problems.


> Dan Libby
> [1] http://gmpg.org/xfn/1
> _______________________________________________
> rdfweb-dev mailing list
> rdfweb-dev at vapours.rdfweb.org
> wiki: http://rdfweb.org/topic/FoafProject
> http://rdfweb.org/mailman/listinfo/rdfweb-dev

More information about the foaf-dev mailing list