FOAF hacks of the day

A bit of hacking tonight, after a lot of interesting talks this afternoon about FOAF, OpenID and online identity (and certainly more to come tomorrow):

accounts.png

foafgear2.png

Time to sleep now …

 

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

SparlPress and foaf:openid

This website now uses SparqlPress.

Morten did a lot of work to include a scutter with ARC2-integration into the plugin, and so this blog now features a RDF backend, that stores some data from my website and related documents (FOAF profile, related seeAlso’s) and also from people who commented there. After 3 great weeks in DERI, I finally took time to dig in the source code of the plugin and start hacking.

A cool thing with this plugin is that the openid patch I wrote some times ago, which implied to hack the original plug-in, is now powered by SparqlPress itself. Each time someone registers to the website, its openid URL is parsed by ARC’s SemHTMLParser which retrieves the FOAF profile, that then goes in the scutter’s queue. There maybe some delay before the files is fetched, but this issue should be covered soon.

Yet, you may notice that some FOAF links disappeared from the comments. While the first version only retrieved the profile using auto-discovery links, I can now SPARQL the file to check if there’s a foaf:openid link to the URL, which lets identify that’s the foaf profile belongs to (or mentions) the related user. So, if your foaf link disappeared, that’s certainly because you don’t have this property in your profile, of it’s not the same than the URL you used to register here (be careful with trailing /). On the other hand, thanks to SPARQL capabilities, comments now also feature links to homepage and blog, picture and others things may come soon.

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?graph ?uri ?home ?blog
WHERE {
  GRAPH ?graph {
    ?uri rdf:type foaf:Person ;
      foaf:openid <$openid> .
    OPTIONAL { ?uri foaf:homepage ?home } .
    OPTIONAL { ?uri foaf:weblog ?blog } .
  }
} LIMIT 1

There should also be some privacy settings in the future (in case you do not want your information to be used), as well as SIOC / FOAF / SKOS exports and some other widgets / social network stuff. If you’re interested, check this page (repositories are not merged yet).