[foaf-dev] Foaf: a Person is member of a Group

Dan Brickley danbri at danbri.org
Mon Jan 19 15:01:13 CET 2009

+cc: foaf-dev

On 19/1/09 10:22, Adrian Giurca wrote:
> I guess you have to use foaf:membershipClass
> <http://xmlns.com/foaf/spec/#term_membershipClass>
> <foaf:Person rdf:about="#me" xmlns:foaf="http://xmlns.com/foaf/0.1/">
> <foaf:name>John Doe</foaf:name>
> <foaf:membershipClass rdf:resource="http://w3c.org"/>
> </foaf:Person>

Ah, the issue being that in FOAF we define 'member' with domain of 
Group, range of Agent. Yes, we didn't make inverses for all the 
properties in FOAF. This can make syntax a little awkward.

With URIs for the person and group:

<foaf:Person rdf:about="#me">
  <foaf:name>John Doe</foaf:name>
<foaf:Group rdf:about="#group1">
   <member rdf:resource="#me">

Or using local 'bnode' identifiers only:

<foaf:Person rdf:nodeid="me">
  <foaf:name>John Doe</foaf:name>
<foaf:Group rdf:nodeid="group1">
   <member rdf:resource="#me">

Given the nature of RDF/XML syntax, this tradeoff was inevitable.

- if we add more inverses (eg. we already have depicts/depiction) then 
data that "says the same thing" becomes fragmented
- if we don't, XML markup looks convoluted

Since there is a trend towards more RDF notations, some of which -like 
RDFa in XHTML - have more graceful support for inverses, I'm somewhat 
wary of adding inverse properties at this stage. The cost of not having 
the extra property is uglier RDF/XML, whereas the cost of having another 
way of saying the same thing is that either queries need to check for 
both, or data stores have to normalise (in advance or during query). 
http://en.wikipedia.org/wiki/Postel%27s_law is somehow relevant.

That said, where there is a natural name for a candidate relation and a 
lot of people ask for it, I don't see a huge problem with putting it 
into FOAF, though we might start indicating which of two inverses is the 
'preferred form' of the relation.

In RDFa XHTML you can write something like:

<div xmlns:foaf="http://xmlns.com/foaf/0.1/">
       <!-- Bob, a person with a name and a homepage -->
       <li typeof="foaf:Person"><a property="foaf:name" 
rel="foaf:homepage" href="http://example.com/bob/">Bob</a></li>

       <!-- Eve, a person who is in a uri-identified group that has a 
uri-identified homepage -->
       <li typeof="foaf:Person">
         <a property="foaf:name" rel="foaf:homepage" 
            is in the
             <span rev="foaf:member"> <!-- reversed relation; the group 
has a member, which is Eve -->
              <span typeof="foaf:Group" about="/groups/html#it">   <!-- 
a uri for the group, considered as a thing in itself -->
                  <a href="/groups/html" rel="foaf:homepage">HTML 
group</a> <!-- the group's homepage -->
       <li typeof="foaf:Person"> <!-- this is more cut down, we just say 
that Manu is in a group whose name is 'RDFa group' -->
         <a property="foaf:name" rel="foaf:homepage" 
href="http://example.com/manu/">Manu</a> is in the
         <span rev="foaf:member"><span typeof="foaf:Group" 
property="foaf:name">RDFa Group</span></span>

rapper -i rdfa g1.html
rapper: Parsing URI 
file:///Users/danbri/working/foaftown/2009/rdfa/tests/g1.html with 
parser rdfa
rapper: Serializing with serializer ntriples
_:bnode0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://xmlns.com/foaf/0.1/Person> .
_:bnode0 <http://xmlns.com/foaf/0.1/homepage> <http://example.com/bob/> .
_:bnode0 <http://xmlns.com/foaf/0.1/name> "Bob"@en .
_:bnode1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://xmlns.com/foaf/0.1/Person> .
_:bnode1 <http://xmlns.com/foaf/0.1/homepage> <http://example.com/eve/> .
_:bnode1 <http://xmlns.com/foaf/0.1/name> "Eve"@en .
<http://xmlns.com/foaf/0.1/Group> .
<file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html> .
<http://xmlns.com/foaf/0.1/member> _:bnode1 .
_:bnode3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://xmlns.com/foaf/0.1/Person> .
_:bnode3 <http://xmlns.com/foaf/0.1/homepage> <http://example.com/manu/> .
_:bnode3 <http://xmlns.com/foaf/0.1/name> "Manu"@en .
_:bnode5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://xmlns.com/foaf/0.1/Group> .
_:bnode5 <http://xmlns.com/foaf/0.1/name> "RDFa Group"@en .
_:bnode5 <http://xmlns.com/foaf/0.1/member> _:bnode3 .
rapper: Parsing returned 15 triples

Hope this helps,



> -Adrian
> freskessa wrote:
>> Hi all,
>> I am new in RDF, I'm wroting an application that generates FOAF files
>> about
>> the web site users. I don't know how to wrote that the user (person) is
>> member of a group or organization into the "foaf:Person" tags.
>> Can you help me please? :(

More information about the foaf-dev mailing list