Foaf: a Person is member of a Group

View: New views
4 Messages — Rating Filter:   Alert me  

Foaf: a Person is member of a Group

by freskessa :: Rate this Message:

| View Threaded | Show Only this Message

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? :(

Re: Foaf: a Person is member of a Group

by Adrian Giurca :: Rate this Message:

| View Threaded | Show Only this Message


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>


-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? :(
>  





Re: Foaf: a Person is member of a Group

by Dan Brickley-2 :: Rate this Message:

| View Threaded | Show Only this Message


+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:Person>
<foaf:Group rdf:about="#group1">
   <member rdf:resource="#me">
</foaf:Person>

Or using local 'bnode' identifiers only:

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

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/">
    <ul>
       <!-- 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"
href="http://example.com/eve/">Eve</a>
            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 -->
              </span>
             </span>
       </li>
       <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>
       </li>
    </ul>
</div>

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 .
<file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://xmlns.com/foaf/0.1/Group> .
<file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
<http://xmlns.com/foaf/0.1/homepage>
<file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html> .
<file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
<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,

cheers,

Dan


>
> -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? :(
>
>
>
>
>



Re: Foaf: a Person is member of a Group

by Adrian Giurca :: Rate this Message:

| View Threaded | Show Only this Message


Dan Brickley wrote:

>
> +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:Person>
> <foaf:Group rdf:about="#group1">
>   <member rdf:resource="#me">
> </foaf:Person>
>
I was thinking that the meaning of foaf:Group to be a container for all
its instances.  In addition I would say is a trade off: in this case
obtaining all the members of a specific group is a little bit cumbersome
In this case I would advocate for the inverse :)  but I can live also
with this solution.
> Or using local 'bnode' identifiers only:
>
> <foaf:Person rdf:nodeid="me">
>  <foaf:name>John Doe</foaf:name>
> </foaf:Person>
> <foaf:Group rdf:nodeid="group1">
>   <member rdf:resource="#me">
> </foaf:Person>
>
This is as "John Doe is member in some group".

> 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/">
>    <ul>
>       <!-- 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"
> href="http://example.com/eve/">Eve</a>
>            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 -->
>              </span>
>             </span>
>       </li>
>       <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>
>       </li>
>    </ul>
> </div>
>
> 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 .
> <file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://xmlns.com/foaf/0.1/Group> .
> <file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
> <http://xmlns.com/foaf/0.1/homepage>
> <file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html> .
> <file:///Users/danbri/working/foaftown/2009/rdfa/tests//groups/html#it>
> <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,
>
> cheers,
>
> Dan
>
Definitely helps (including the necessary RDFa),
Adrian

>
>>
>> -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? :(
>>
>>
>>
>>
>>
>
>