[an error occurred while processing this directive]
Most of these examples are derived from the testbed for Squish set up by Dan Brickley and Libby Miller [1][2]. See also Query and Rule languages Use Cases and Examples and W3C RDF Query (and Rule) Testcase Repository.
Example 1
Find dc::title, dcq::abstract, details of creation and modification date(s), and the creators name and email address.
SELECT ?x, ?title, ?a, ?moddate, ?createddate, ?name, ?creatormail FROM <http://rdfweb.org/people/danbri/2001/06/dcarch-test/dc3.rdf> WHERE ( ?x, <dc:title>, ?title), ( ?x, <dcq:abstract>, ?a), ( ?x, <dcq:modified>, ?m), ( ?x, <dcq:created>, ?cd), ( ?m, <rdf:value>, ?moddate), ( ?cd, <rdf:value>, ?createddate), ( ?x, <dc:creator>, ?cr), ( ?cr, <vcard:FN>, ?name), ( ?cr, <vcard:EMAIL>, ?creatormail) USING dcq for <http://dublincore.org/2000/03/13/dcq#>, rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, vcard for <http://www.w3.org/2001/vcard-rdf/3.0#>, dc for <http://purl.org/dc/elements/1.1/>
Example 2
Find dc::title, dcq::abstract, details of creation and modification date(s), and the creators name and email address.
SELECT ?x, ?title, ?a, ?moddate, ?createddate, ?name, ?creatormail FROM <http://testers.mkdoc.com/dc.rdf>, <http://testers.mkdoc.com/features/dc.rdf>, <http://testers.mkdoc.com/cma/dc.rdf> WHERE (?x, <dc:title>, ?title), (?x, <dcq:abstract>, ?a), (?x, <dcq:modified>, ?m), (?x, <dcq:created>, ?cd), (?m, <rdf:value>, ?moddate), (?cd, <rdf:value>, ?createddate), (?x, <dc:creator>, ?cr), (?cr, <vcard:FN>, ?name), (?cr, <vcard:EMAIL>, ?creatormail) USING dcq for <http://dublincore.org/2000/03/13/dcq#>, rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, vcard for <http://www.w3.org/2001/vcard-rdf/3.0#>, dc for <http://purl.org/dc/elements/1.1/>
Example 3
Find dc::title, dcq::abstract, for any pairs of pages x and y where x references y; find the last modified date of the referenced page.
SELECT ?x, ?y, ?title1, ?title2, ?abstract1, ?abstract2, ?lastmod FROM <http://rdfweb.org/people/danbri/2001/06/dcarch-test/relations/features_fix.rdf>, <http://rdfweb.org/people/danbri/2001/06/dcarch-test/relations/humans_fix.rdf> WHERE (?x, <dc:title>, ?title1), (?y, <dc:title>, ?title2), (?x, <dcq:abstract>, ?abstract1), (?y, <dcq:abstract>, ?abstract2), (?x, <dcq:references>, ?y), (?y, <dcq:modified>, ?m), (?m, <rdf:value>, ?lastmod) USING dcq for <http://dublincore.org/2000/03/13/dcq#>, rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, vcard for <http://www.w3.org/2001/vcard-rdf/3.0#>, dc for <http://purl.org/dc/elements/1.1/>
Example 4
Find me the title, subject, description, identifier and language of the resource btw: find out also the language which each value is
SELECT ?title_value, ?title_language, ?subject_value,?subject_language, ?description_value, ?description_language, ?language, ?identifier FROM <http://braveheart.eun.org/xml/rdf/example10.xml> WHERE ( ?x, <dc:title>, ?tt), ( ?tt, <rdf:value>, ?title_value), ( ?tt, <dc:language>, ?ttl), ( ?ttl, <dcq:RFC1766>, ?title_language), ( ?x, <dc:subject>, ?ss1), ( ?ss1, <etbthes:ETBT>, ?ss2), ( ?ss2, <rdf:value>, ?subject_value), ( ?ss2, <dc:language>, ?ss3), ( ?ss3, <dcq:RFC1766>, ?subject_language), ( ?x, <dc:description>, ?dd), ( ?dd, <rdf:value>, ?description_value), ( ?dd, <dc:language>, ?ddl), ( ?ddl, <dcq:RFC1766>, ?description_language), ( ?x, <dc:identifier>, ?identifier), ( ?x, <dc:language>, ?ll1), ( ?ll1, <dcq:RFC1766>, ?language) USING rdf for <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, rdfs for <http://www.w3.org/2000/01/rdf-schema#>, dc for <http://purl.org/dc/elements/1.1/>, dcq for <http://purl.org/dc/terms/>, dct for <http://purl.org/dc/dcmitype/>, etb for <http://eun.org/etb/elements/>, etbthes for <http://eun.org/etb/thesaurus/elements/>
Example 5
Find me the job with a salary >= 100000
SELECT ?sal, ?t, ?x FROM <http://ilrt.org/discovery/2000/11/rss-query/jobs-rss.rdf>, <http://ilrt.org/discovery/2000/11/rss-query/jobs.rss> WHERE (?x, <job:advertises>, ?y), (?y, <job:salary>, ?sal), (?y, <job:title>, ?t) AND (?sal >= 100000) USING job for <http://ilrt.org/discovery/2000/11/rss-query/jobvocab.rdf#>
Example 6
Get me all the names and any other information about the rooms used at SWWS
SELECT ?name, ?info SOURCE <http://www.ilrt.bris.ac.uk/discovery/2001/06/content/swws2001-07-30.rdf> WHERE (?cal, <dc::source>, <http://www.SemanticWeb.org/SWWS/program/>), (?cal, <ical::VEVENT-PROP>, ?event), (?event, <ical::LOCATION>, ?geo), (?geo, <ical::GEO-NAME>, ?text), (?text, <rdf::value>, ?name), (?geo, <rdfs::seeAlso>, ?info) USING rdf FOR <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, rdfs FOR <http://www.w3.org/2000/01/rdf-schema#>, ical FOR <http://ilrt.org/discovery/2001/06/schemas/ical-full/hybrid.rdf#>, util FOR <http://ilrt.org/discovery/2001/06/schemas/swws/index.rdf#>, foaf FOR <http://xmlns.com/foaf/0.1/>, dc FOR <http://purl.org/dc/elements/1.1/>
Example 7
Give me the URL of the item having a rss:title starting with the word "RDQL"
SELECT ?link SOURCE <http://xmlhack.com/rss10.php> WHERE (?x, <rss::title>, ?title), (?x, <rss::link>, ?link) AND ?title LIKE '/^RdQL/i' USING rss for <http://purl.org/rss/1.0/>