|
Hmm, well, someone wants examples. Here's a very quick one:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?s
WHERE {?s rdf:type <http://purl.org/dc/elements/1.1/Collection>}
Which will return a SPARQL XML Results document with all of the URIs of every weblog in the my.opera community knowledge base (there may be others not in the KB, of course; open world assumption and all that...)
Now, here's a query that finds everything asserted of one of those weblogs:
SELECT ?p ?o
WHERE {<http://my.opera.com/soumitra/blog/> ?p ?o}
Which returns another SPARQL Results document:
<?xml version="1.0"?>
<sparql xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result2" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd">
<head>
<variable name="p"/>
<variable name="o"/>
</head>
<results>
<result>
<binding name="p"><uri>http://purl.org/dc/elements/1.1/creator</uri></binding>
<binding name="o"><uri>http://my.opera.com/soumitra/xml/foaf#soumitra</uri></binding>
</result>
<result>
<binding name="p"><uri>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</uri></binding>
<binding name="o"><uri>http://purl.org/dc/elements/1.1/Collection</uri></binding>
</result>
<result>
<binding name="p"><uri>http://purl.org/dc/elements/1.1/description</uri></binding>
<binding name="o"><literal>my journal where I write about my coldplay experiences</literal></binding>
</result>
<result>
<binding name="p"><uri>http://purl.org/dc/elements/1.1/title</uri></binding>
<binding name="o"><literal>Check out http://www.soumitrabhattacharya.com .</literal></binding>
</result>
</results>
</sparql>
The next step is to get the Opera portal folks to publish a schema or ontology for their KB, so that people can figure out more interesting queries. Or for someone with more free time than I have to reverse engineer a schema document from a dump of the KB.
|