There really isn't any concept of "nesting" in RDF, that's just a
consequence of the particular XML serialization that you are looking at.
To grasp this better convert that RDF/XML data to Turtle, then think
of SPARQL as filters on those triples. You'll quickly see the path to
get the results you want.
On 18 Aug 2009, at 6:32 PM, On Lee wrote:
http://danbri.org/foaf.rdf has the following nested info:
<knows>
<Person>
<name>Aaron Swartz</name>
<made>
<rss:channel rdf:about="http://www.blogspace.com/rss/rss10">
<rss:title>RSS Info</rss:title>
<rdfs:seeAlso
rdf:resource="http://www.blogspace.com/rss/rss10"/>
</rss:channel>
</made>
<rdfs:seeAlso rdf:resource="http://www.aaronsw.com/
about.xrdf"/>
</Person>
</knows>
http://sparql.org/sparql.html executed the following SPARQL:
REFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT *
WHERE
{
<http://danbri.org/foaf.rdf#danbri> foaf:knows ?known .
?known ?predicate ?object .
}
It produced the first level info. For example,
?known = _:b19
?predicate = <http://xmlns.com/foaf/0.1/made>
?object = <http://www.blogspace.com/rss/rss10>
Based on the above info, I could then get the next level info by the
following SPARQL: "SELECT * WHERE { <http://www.blogspace.com/rss/rss10
>
?predicate ?object .}".
How to write a single SPARQL so I could retrieve the nested level
info even
it has 10 levels deep?
Thanks in advance for your help.
Best,
-- On Lee