[foaf-dev] accountProfilePage

Dan Brickley danbri at danbri.org
Tue Jun 19 01:33:06 BST 2007


R. Steven Rainwater wrote:
> On Sat, 2007-06-16 at 16:14 +0100, Ian Davis wrote:
>> On 16/06/2007 15:41, Dan Brickley wrote:
>>  > I like the idea too. Anyone else have a view?
>>
>> +1 from me, but I argued for it in the first place :)
> 
> I like the idea too. I'm planning on adding fields in the Advogato
> profiles to allow users to specify their other online profiles, so this
> would fit right in. 

Ah, this is great.

> My one suggestion is to make this feature a little more generic than the
> instant message IDs in FOAF. In other words a single accountProfilePage
> tag is good but a whole pile of site-specific tags with names like
> MySpaceAccountProfilePage, AdvogatoAccountProfilePage,
> FreshmeatAccountProfilePage, etc. is bad from my point of view. 

Yes, It is easy to get cluttered. I wouldn't want to have a property per 
common socially-oriented website. For the major global IM/communication 
networks it is just about bearable as there are fewer of these, though I 
wish everyone just used Jabber. I've just updated my own FOAF with some 
OnlineAccount descriptions (and an experimental foaf:openid property) 
and have done a quick test in SPARQL to see if we can use queries to 
generate simple markup (eg. using 3rd party vocab) from complex FOAF 
descriptions of online accounts.

For example:

I have this markup...

	<foaf:holdsAccount>
       <foaf:OnlineAccount>
         <foaf:accountServiceHomepage 
rdf:resource="http://www.livejournal.com/"/>
         <foaf:accountProfilePage 
rdf:resource="http://danbri.livejournal.com/"/>
         <foaf:accountName>danbri</foaf:accountName>

       </foaf:OnlineAccount>
     </foaf:holdsAccount>

The following query says (more or less) "get me the profile page(s) and 
account name(s) for livejournal account of the person who has openid of 
http://danbri.org/".

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT *
FROM  <http://danbri.org/foaf.rdf>
WHERE {
[ a foaf:Person ;
   foaf:openid <http://danbri.org/> ;
   foaf:holdsAccount
     [
       foaf:accountServiceHomepage <http://www.livejournal.com/> ;
       foaf:accountProfilePage ?profile ;
       foaf:accountName ?userid ;
     ]
   ]
}

It returns a table. In my case (since I only have one LJ account) it has 
a single row:

./arq.sparql --query im2.rq
--------------------------------------------------
| profile                          | userid      |
==================================================
| <http://danbri.livejournal.com/> | "danbri"@en |
--------------------------------------------------


But wait, there's more :)

SPARQL results can be used to generate RDF too, as well as these SQL-ish 
resultset tables.

The following query generates some triples based on the above match.

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX ex: <http://morestuff.example.com/vocab#>
CONSTRUCT {
  [
   a foaf:Person ;
   a ex:LJUser ;
   foaf:openid <http://danbri.org/> ;
   ex:livejournalID ?userid ;
   foaf:isPrimaryTopicOf ?profile ;
  ]
}
FROM <http://danbri.org/foaf.rdf>
WHERE {
  [
   a foaf:Person ;
   foaf:openid <http://danbri.org/> ;
   foaf:holdsAccount
    [
     foaf:accountServiceHomepage <http://www.livejournal.com/> ;
     foaf:accountProfilePage ?profile ;
     foaf:accountName ?userid ;
    ]
  ]
}


The resulting RDF/XML is:

<rdf:RDF
     xmlns:foaf="http://xmlns.com/foaf/0.1/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:ex="http://morestuff.example.com/vocab#">
   <ex:LJUser>
     <foaf:isPrimaryTopicOf rdf:resource="http://danbri.livejournal.com/"/>
     <foaf:openid rdf:resource="http://danbri.org/"/>
     <ex:livejournalID xml:lang="en">danbri</ex:livejournalID>
     <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
   </ex:LJUser>
</rdf:RDF>

This shows that we can define simple transformations between long-winded 
forms which don't require vocab items "per site/service" and shorter 
convenience forms where they exist. In effect SPARQL can be used as a 
simple rule language.



> I'd actually still prefer to see a single generic IM tag instead of a
> bunch of site-specific ones (e.g. one ChatID tag instead of icqChatID,
> aimChatID yahooChatID, etc). 

The above idiom should work for each of these two. It is more 
longwinded, but also reasonably clear (and gives opportunity to point to 
profile page now too, via the proposed accountProfilePage). What we 
should do is define a canonical accountServiceHomepage URI for each of 
the hardcoded services, ie. MSN, ICQ, AIM, Yahoo etc. and write the 
SPARQL transformations per the example above. In other words, show what 
long-form representation the convenience shortcut "stands for".


> 					But I think there was some
> RDF-magic-related reason for that I didn't fully comprehend when it was
> explained to me. :)

I think there were probably two things going on.

Firstly, RDF is sometimes considered verbose, particularly when written 
in the default RDF/XML notation.

Some people might prefer to write: <livejournalID>danbri</livejournalID> 
instead of:

	<foaf:holdsAccount>
       <foaf:OnlineAccount>
         <foaf:accountServiceHomepage 
rdf:resource="http://www.livejournal.com/"/>
         <foaf:accountProfilePage 
rdf:resource="http://danbri.livejournal.com/"/>
         <foaf:accountName>danbri</foaf:accountName>
       </foaf:OnlineAccount>
     </foaf:holdsAccount>

...and there aren't many ways in RDF to slim things down into a size 
somewhere between the two.

Secondly, when a single property is used, RDF (via OWL) has a way of 
indicating the "at most one" meaning that attaches to this: that there 
is at-most-one person/agent that has any given aol or livejournal ID. 
This can be used for automatic merging of data across files.

 > So, I'll try to support it in Advogato either way.

Cool, thanks! :)

BTW re Advogato, I spent some time at http://www.hackday.org/ revisiting 
the PGP-signed FOAF idea, which is now a lot more interesting thanks to 
the existence of the SPARQL query language. I think there might be some 
scenarios worth investigating around sites like Advogato. Will try blog 
my hack-in-progress asap...

cheers,

Dan

> -Steve
> 
> _______________________________________________
> foaf-dev mailing list
> foaf-dev at lists.foaf-project.org
> http://lists.foaf-project.org/mailman/listinfo/foaf-dev
> 



More information about the foaf-dev mailing list