Querying across ‘social graph’ fragments

PREFIX : <http://xmlns.com/foaf/0.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT DISTINCT ?who ?src
WHERE
{
GRAPH <http://xmlns.com/foaf/spec/index.rdf> { ?p a owl:InverseFunctionalProperty . }
GRAPH <http://danbri.org/foaf.rdf> { [ :openid <http://danbri.org/> ; ?p ?pv ] }
GRAPH ?src { [ ?p ?pv ; :knows [ :name ?who ] ] }
}
ORDER BY ?who

Just a quick post to record this cut down version of a SPARQL query I’ve been using. The idea is that it is evaluated against a SPARQL RDF dataset where multiple sources are brought together. It tries to find the names of anyone those sources claim knows me, regardless of how those datasets actually identify me (mailbox, mailbox hash, IM accounts, weblog or homepage or openid URL, etc). So long as they use a property/value pair that matches something in my main FOAF file, and so long as the property is tagged as “inverse functional” (ie. uniquely identifying) in the FOAF spec, the identification should go through OK.