Reputation: 4222
Is it possible to query linked data with SPARQL?
For example, I have a RDF file (lets say this one) and a SPARQL query like this one:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX cc: <http://creativecommons.org/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX s: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX con: <http://www.w3.org/2000/10/swap/pim/contact#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
select ?friends (COUNT(?cff) as ?count_friends_of_friends) where {
?me foaf:knows ?friends .
?friends foaf:knows ?cff .
}
I didn't get any results. Does SPARQL follow linked resources? Or do I have to make multiple queries?
Upvotes: 2
Views: 363
Reputation: 959
No, SPARQL does not follow linked resources when they are distributed. It looks like you are looking for federated queries. You will be able to find more information in the W3C Specification: http://www.w3.org/TR/sparql11-federated-query/
SPARQL is a query language. It allows to issue queries against RDF graphs. If the graphs are distributed, then you need query federation.
By default the URIs don't have to be resolvable, they are just identifiers (<#a> is a valid URI). For example, your piece of RDF could be saying that <http://www.w3.org/People/Berners-Lee/card#i> foaf:knows <http://www.lassila.org/ora.rdf#me>
the latter url could return a 404.
Upvotes: 4