Tag Archives: openid

RDFa profile and new URI

I just added a short profile about myself embedding RDFa that aims to replace my old FOAF file, in which I already moved some things (i.e. relationships) to external services.

I also gave me a nicer URI, http://apassant.net/alex that uses content-negociation to redirect either to the HTML version of this profile or to the extracted RDF one, depending on the Accept header, combining some rewrite rules that Ivan Herman defined for the SW Faq and the .htaccess used for the Flickr wrapper. My old foaf.rdf file is also now redirected to this extracted profile, and I’m using an owl:sameAs in RDFa link to be compliant with services that uses my old URI.

# Old foaf.rdf compliance
RedirectPermanent /foaf.rdf http://www.w3.org/2007/08/pyRdfa/extract?uri=http://apassant.net/about/
# RDF redirect for my URI
RewriteCond %{HTTP_ACCEPT} application/rdf+xml
RewriteRule ^alex$ http://www.w3.org/2007/08/pyRdfa/extract?uri=http://apassant.net/about/ [R=303,L]
# HTML redirect for my URI
RewriteRule ^alex$ about [R=303,L]

I’m also wondering, since this profile is used as http://apassant.net homepage which is also my OpenID URL, how it will work when loggin on websites using SparqlPress + OpenID as ARC2 embeds an RDFa extractor so that it should discover my FOAF data without using any autodiscovery link.

About these ads

owl:sameAs reciprocity with OpenID

Still working on SparqlPress, I just adapted foaf-output for it, as a part of the future export capabilities of the plugin. It exports users in a group, or individually. Once again, thanks to OpenID and SPARQL capabilities of the backend, I can retrieve the related FOAF document, and also the URI of the user.

Thus, the export can provide owl:sameAs + rdfs:seeAlso links to the original people / file, like on that profile (BTW, well done for wikini and its FOAF export). The great thing, imho, is that it shows how OpenID can add a trust layer to the Semantic Web, by providing an automatic way to have bi-directional owl:sameAs links between URIs, which means both parts agree on the fact that they’re the same. Since you can link from your foaf profile to any URI on the Semantic Web, you need a way from this URI to link to your original FOAF file. This SW+OpenID association provides it, and could be really useful in a Linked Data perspective.

NB: OK Morten, now we’ll have to check how to avoid recursion :)

One FOAF fits all

A few years ago, I created my FOAF profile with FOAF-O-Matic. But actually, I almost never updated it and its foaf:knows list.

So, now, I’ll let external websites manage those informations.
I have exports in RDF of my flickr, twitter and facebook accounts, as well as this weblog (in progress), and in most of them, I define those relationships to the people I know. Since all those files define a URI for myself, I can use my main (I mean hosted by my own) FOAF file as a reference profile that will link myself to my other URIs using owl:sameAs, and also add rdfs:seeAlso links to the related files (as described here), eg:



And I’ll get a decentralized foaf:knows network, as shown on this graph:onefoaf.pngThen, I can grab all these profiles in a local RDF store, or even better, use a dedicated Semantic Web “social graph manager” as Knowee or Beatnik to get all my contacts locally, get their e-mail, query profiles, or as David said, integrates in other desktop apps and sync with my iphone (ok, I don’t have one yet :) ) …

And if services as linked-in or bibliography repositories export FOAF URIs for anyone, as the FOAF/DBLP service already offers, I could even link to people I worked with. In case all those services exports data with only foaf:knows and I want to be more precice, I can refine relationships in my profile using the RELATIONSHIP vocabulary, or maybe even include rules in my profile that could then be taken into consideration by agents that will query it ? Something like:

( GRAPH <http://linkedin/foafexport/mygraph> { #me foaf:knows ?x } )
( #me rel:collaboratesWith ?x )

that will be in my profile itself.

Finally, since I can create a link to this FOAF profile from my OpenID, I can reuse this graph in many applications. And when login to a new service, ask him “is there anyone here that I know from flickr ?”.

More than social network, I can also link from the same profile (or, actually, from the profiles that have been linked to the reference one) to various things I wrote or done on the Web, as data from last-fm, revyu or flickr, thanks to SIOC, as explained here.

So: One reference profile. Lots of distributed information. One Giant Global Graph.

NB: Also check some of Dan Brickley’s experiments about related topics.

NB2: I did not take trust issues in consideration in that post, i.e. how can we be sure that the owl:sameAs relationship is linked to an URI which is really *me*. I think one solution would be to authenticate on those websites using OpenID so that it can find my FOAF file, then my URI, and add an owl:sameAs link in the other direction. Both files should also be signed, and I think that will be ok (?).

Using the foaf:openid property

A nice feature of the foaf:openid property is that it helps to retrieve the unique foaf:Agent associated to an OpenID URI, since its an owl:InverseFunctionalProperty.

When I wrote PHOAF, I have to deal with the question of identifying who was the main subject of a FOAF profile (either a Person or a Group) in order to get links to their homepage, depiction…

In most of people’s files, thanks to foaf-o-matic, there’s foaf:PersonalProfileDocument + foaf:primaryTopic so that’s quite easy. Yet, if there’s not such property, I used this kind of rule:

  • if there’s only one person in the file, he should be the main subject of the profile;
  • if there’s more than one person, and no group in the profile, the main topic should be the one that do not have anyone linking to him with foaf:knows;
  • yet, there should be some cases when it cannot be solved.

Now, using the foaf:openid property and authenticating with OpenID – plus retrieving the FOAF profile associated with that URI – solves this with a single SPARQL query:

select ?who
where {
  ?who foaf:openid <openid_uri>

More than a way to solve people ambiguity in a profile, FOAF + OpenID also offers nice views regarding decentralized identity management. Trust an OpenID provider for authentication, but store all your personal informations in your FOAF profile.

Retrieving FOAF profile from OpenID

Following Dan Brickley’s experiments, I’ve just setup an OpenID plug-in for this weblog, allowing anyone to register using OpenID, since users now need to register to comment.

Actually, one of the reason I installed it is that I thaught it would be an easy way to retrieve a FOAF profile for any registered user on this weblog. I’m using auto-discovery to get it from the OpenID URL. I don’t know if there’s any OpenID provider that have such a feature, but it can easilly be done if you’re delegating your OpenID to your own webpage, by adding the auto-discovery line in the header of your OpenID URL (check the source of this page if needed). BTW, WP users, here’s another plugin that helps to delegate your OpenID to your weblog.

The method I used to retrieve the profile is the following:

function fetch_foaf_profile($url) {
  $html = file_get_contents($url);
  preg_match_all('/<head.*<link.*rel="meta".*title="foaf".*href="(.*)".*/>.*</head>/Usi', $html, $links);
  if($links) {
    if($foaf = $links[1][0]) {
      $ex = parse_url($foaf);
      if($ex['scheme']) return $foaf;
      elseif(substr($ex['path'], 0, 1) == '/') {
        $ex = parse_url($url);
        return $ex['scheme'].'://'.$ex['host'].$foaf;
      else return $url.$foaf;
  return null;

Then, the profile is added to wp_usermeta table. The complete svn diff for the latest version of the plug-in is available here.

So, now that I can have FOAF profiles for users, I’ll be able to experiment the FOAF-avatar idea I had a long time ago. Other steps would be to combine people URIs with Morten Frederiksen’s FOAF output plugin (cannot find how to make it work with WP2.3) , using owl:sameAs to link users’ URIs created from this weblog to their profiles URI, and also to use it in the SIOC output plugin.

Regarding social networking Dan is talking about, I think that would be a great way answer questions as: do people commenting this blog already know themself in the SemWeb world ? Are they friends re. their FOAF profile ? re. Facebook ? Do they share interests ?

So, If you have FOAF and OpenID connected thanks to auto-discovery, I’ll be happy you try it so that I can start experimenting some of these ideas.

Update: The script now also retrieve SIOC profile if available.