GRDDL Primer SPARQL

I have included the SPARQL example code with some ficticious URLs in
the FROM portion. I have also re-written the text slightly to match
more with the examples.

Please update the Primer with the following, replacing the
corresponding paragraphs currently there.

-brian

===

If Stephan was looking for a Guitar with a specific review rating or
higher, from a selected group of friends, we now have enough data in
RDF to do just that.

PREFIX foaf:   <http://xmlns.com/foaf/0.1/>
PREFIX rev: <http:/www.purl.org/stuff/rev#>

SELECT DISTINCT ?name ?rating

FROM <http://example.org/guitar/1234/>

WHERE {
?x rev:reviewer ?rname.
?x rev:rating ?rating FILTER (?rating > "2")
?rname foaf:name ?name
}

The first restriction on the data can be a pass on review data such as
rating. Once we have all the matching reviews, we can then restricted
based on Stephan's friends. Using a seeded list of XFN URLs given by
Stephan that are converted to FoaF, we can match the URLs to any URLs
from the FoaF generated from the guitar reviews. Now we have a list of
members that Stephan trusts relative to the guitar site. We can then
match the URLs of the reviewers to the URLs in the XFN list.

PREFIX foaf:   <http://xmlns.com/foaf/0.1/>
PREFIX rev: <http:/www.purl.org/stuff/rev#>
PREFIX xfn: <http://gmpg.org/xfn/11#>

SELECT DISTINCT ?name ?rating ?xfnhomepage ?foafhomepage

FROM <http://example.org/guitar/1234/>
FROM <http://stevens-homepage.org/blogroll/xfn/>

WHERE {
?x rev:reviewer ?rname.
?x rev:rating ?rating FILTER (?rating > "2")
?rname foaf:name ?name.
?rname foaf:homepage ?foafhomepage.
?y xfn:friend ?xperson.
?xperson foaf:homepage ?xfnhomepage FILTER (?xfnhomepage = ?foafhomepage)
}

This SPARQL result is in XML or JSON and can easily be consumed by
another application. This can display the results on screen, email
them to Stephan or it can be pulled into another application to search
the web for the best prices on the short list of guitars.

-- 
brian suda
http://suda.co.uk

Received on Thursday, 14 September 2006 23:03:05 UTC