WolfgangFahl / snapquery

Frontend to Introduce Named Queries and Named Query Middleware to wikidata
Apache License 2.0
6 stars 4 forks source link

Extract example queries from SPARQL 1.1 Query Language #52

Open tholzheim opened 6 days ago

tholzheim commented 6 days ago

Extract sample queries from SPARQL 1.1 Query Language

Additionally from https://w3c.github.io/sparql-query/spec/ to compare SPARQL 1.1 with 1.2

tholzheim commented 6 days ago

125 queries can be etracted from SPARQL 1.1 Query Language. The question is of they should be added to the samples as they written for sample rdf triples defined for each query individually.

{
   "domain":"w3.org",
   "namespace":"sparql_1.1",
   "target_graph_name":"",
   "queries":[
      {
         "name":"2.1 Writing a Simple Query",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-1-writing-a-simple-query--sparql_1.1@w3.org",
         "sparql":"SELECT ?title\nWHERE\n{\n  <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title .\n}",
         "url":null,
         "title":"2.1 Writing a Simple Query",
         "description":null,
         "comment":null
      },
      {
         "name":"2.2 Multiple Matches",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-2-multiple-matches--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:   <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\nWHERE\n  { ?x foaf:name ?name .\n    ?x foaf:mbox ?mbox }",
         "url":null,
         "title":"2.2 Multiple Matches",
         "description":null,
         "comment":null
      },
      {
         "name":"2.3.1 Matching Literals with Language Tags",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-3-1-matching-literals-with-language-tags--sparql_1.1@w3.org",
         "sparql":"SELECT ?v WHERE { ?v ?p \"cat\" }",
         "url":null,
         "title":"2.3.1 Matching Literals with Language Tags",
         "description":null,
         "comment":null
      },
      {
         "name":"2.3.2 Matching Literals with Numeric Types",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-3-2-matching-literals-with-numeric-types--sparql_1.1@w3.org",
         "sparql":"SELECT ?v WHERE { ?v ?p 42 }\n",
         "url":null,
         "title":"2.3.2 Matching Literals with Numeric Types",
         "description":null,
         "comment":null
      },
      {
         "name":"2.3.3 Matching Literals with Arbitrary Datatypes",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-3-3-matching-literals-with-arbitrary-datatypes--sparql_1.1@w3.org",
         "sparql":"SELECT ?v WHERE { ?v ?p \"abc\"^^<http://example.org/datatype#specialDatatype> }\n",
         "url":null,
         "title":"2.3.3 Matching Literals with Arbitrary Datatypes",
         "description":null,
         "comment":null
      },
      {
         "name":"2.4 Blank Node Labels in Query Results",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-4-blank-node-labels-in-query-results--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:   <http://xmlns.com/foaf/0.1/>\nSELECT ?x ?name\nWHERE  { ?x foaf:name ?name }\n",
         "url":null,
         "title":"2.4 Blank Node Labels in Query Results",
         "description":null,
         "comment":null
      },
      {
         "name":"2.5 Creating Values with Expressions",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-5-creating-values-with-expressions--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:   <http://xmlns.com/foaf/0.1/>\nSELECT ( CONCAT(?G, \" \", ?S) AS ?name )\nWHERE  { ?P foaf:givenName ?G ; foaf:surname ?S }",
         "url":null,
         "title":"2.5 Creating Values with Expressions",
         "description":null,
         "comment":null
      },
      {
         "name":"2.6 Building RDF Graphs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"2-6-building-rdf-graphs--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:   <http://xmlns.com/foaf/0.1/>\nPREFIX org:    <http://example.com/ns#>\n\nCONSTRUCT { ?x foaf:name ?name }\nWHERE  { ?x org:employeeName ?name }",
         "url":null,
         "title":"2.6 Building RDF Graphs",
         "description":null,
         "comment":null
      },
      {
         "name":"3.1 Restricting the Value of Strings",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"3-1-restricting-the-value-of-strings--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc:  <http://purl.org/dc/elements/1.1/>\nSELECT  ?title\nWHERE   { ?x dc:title ?title\n          FILTER regex(?title, \"^SPARQL\") \n        }\n",
         "url":null,
         "title":"3.1 Restricting the Value of Strings",
         "description":null,
         "comment":null
      },
      {
         "name":"3.2 Restricting Numeric Values",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"3-2-restricting-numeric-values--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc:  <http://purl.org/dc/elements/1.1/>\nPREFIX  ns:  <http://example.org/ns#>\nSELECT  ?title ?price\nWHERE   { ?x ns:price ?price .\n          FILTER (?price < 30.5)\n          ?x dc:title ?title . }",
         "url":null,
         "title":"3.2 Restricting Numeric Values",
         "description":null,
         "comment":null
      },
      {
         "name":"4.2 Syntax for Triple Patterns",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"4-2-syntax-for-triple-patterns--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc: <http://purl.org/dc/elements/1.1/>\nSELECT  ?title\nWHERE   { <http://example.org/book/book1> dc:title ?title }  \n",
         "url":null,
         "title":"4.2 Syntax for Triple Patterns",
         "description":null,
         "comment":null
      },
      {
         "name":"5.2 Group Graph Patterns",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"5-2-group-graph-patterns--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:\u00a0\u00a0\u00a0 <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\nWHERE\u00a0 {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?x foaf:name ?name .\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?x foaf:mbox ?mbox .\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }\n",
         "url":null,
         "title":"5.2 Group Graph Patterns",
         "description":null,
         "comment":null
      },
      {
         "name":"5.2.2 Scope of Filters",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"5-2-2-scope-of-filters--sparql_1.1@w3.org",
         "sparql":"\u00a0{\u00a0 ?x foaf:name ?name .\n    ?x foaf:mbox ?mbox .\n\u00a0\u00a0\u00a0 FILTER regex(?name, \"Smith\")\n }\n  ",
         "url":null,
         "title":"5.2.2 Scope of Filters",
         "description":null,
         "comment":null
      },
      {
         "name":"5.2.3 Group Graph Pattern Examples",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"5-2-3-group-graph-pattern-examples--sparql_1.1@w3.org",
         "sparql":"\u00a0 {\n\u00a0\u00a0\u00a0 ?x foaf:name ?name .\n\u00a0\u00a0\u00a0 ?x foaf:mbox ?mbox .\n\u00a0 }",
         "url":null,
         "title":"5.2.3 Group Graph Pattern Examples",
         "description":null,
         "comment":null
      },
      {
         "name":"6.1 Optional Pattern Matching",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"6-1-optional-pattern-matching--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\nWHERE  { ?x foaf:name  ?name .\n         OPTIONAL { ?x  foaf:mbox  ?mbox }\n       }\n",
         "url":null,
         "title":"6.1 Optional Pattern Matching",
         "description":null,
         "comment":null
      },
      {
         "name":"6.2 Constraints \nin Optional Pattern Matching",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"6-2-constraints-in-optional-pattern-matching--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc:  <http://purl.org/dc/elements/1.1/>\nPREFIX  ns:  <http://example.org/ns#>\nSELECT  ?title ?price\nWHERE   { ?x dc:title ?title .\n          OPTIONAL { ?x ns:price ?price . FILTER (?price < 30) }\n        }\n",
         "url":null,
         "title":"6.2 Constraints \nin Optional Pattern Matching",
         "description":null,
         "comment":null
      },
      {
         "name":"6.3 Multiple Optional Graph \nPatterns",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"6-3-multiple-optional-graph-patterns--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox ?hpage\nWHERE  { ?x foaf:name  ?name .\n         OPTIONAL { ?x foaf:mbox ?mbox } .\n         OPTIONAL { ?x foaf:homepage ?hpage }\n       }\n",
         "url":null,
         "title":"6.3 Multiple Optional Graph \nPatterns",
         "description":null,
         "comment":null
      },
      {
         "name":"7 Matching Alternatives",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"7-matching-alternatives--sparql_1.1@w3.org",
         "sparql":"PREFIX dc10:  <http://purl.org/dc/elements/1.0/>\nPREFIX dc11:  <http://purl.org/dc/elements/1.1/>\n\nSELECT ?title\nWHERE  { { ?book dc10:title  ?title } UNION { ?book dc11:title  ?title } }\n",
         "url":null,
         "title":"7 Matching Alternatives",
         "description":null,
         "comment":null
      },
      {
         "name":"8.1.1 Testing For the Absence of a Pattern",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-1-1-testing-for-the-absence-of-a-pattern--sparql_1.1@w3.org",
         "sparql":"PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \nPREFIX  foaf:   <http://xmlns.com/foaf/0.1/> \n\nSELECT ?person\nWHERE \n{\n    ?person rdf:type  foaf:Person .\n    FILTER NOT EXISTS { ?person foaf:name ?name }\n}     ",
         "url":null,
         "title":"8.1.1 Testing For the Absence of a Pattern",
         "description":null,
         "comment":null
      },
      {
         "name":"8.1.2 Testing For the Presence of a Pattern",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-1-2-testing-for-the-presence-of-a-pattern--sparql_1.1@w3.org",
         "sparql":"PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \nPREFIX  foaf:   <http://xmlns.com/foaf/0.1/> \n\nSELECT ?person\nWHERE \n{\n    ?person rdf:type  foaf:Person .\n    FILTER EXISTS { ?person foaf:name ?name }\n}",
         "url":null,
         "title":"8.1.2 Testing For the Presence of a Pattern",
         "description":null,
         "comment":null
      },
      {
         "name":"8.2 Removing Possible Solutions",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-2-removing-possible-solutions--sparql_1.1@w3.org",
         "sparql":"PREFIX :       <http://example/>\nPREFIX foaf:   <http://xmlns.com/foaf/0.1/>\n\nSELECT DISTINCT ?s\nWHERE {\n   ?s ?p ?o .\n   MINUS {\n      ?s foaf:givenName \"Bob\" .\n   }\n}",
         "url":null,
         "title":"8.2 Removing Possible Solutions",
         "description":null,
         "comment":null
      },
      {
         "name":"8.3.1 Example: Sharing of variables",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-3-1-example-sharing-of-variables--sparql_1.1@w3.org",
         "sparql":"SELECT *\n{ \n  ?s ?p ?o\n  FILTER NOT EXISTS { ?x ?y ?z }\n}",
         "url":null,
         "title":"8.3.1 Example: Sharing of variables",
         "description":null,
         "comment":null
      },
      {
         "name":"8.3.2 Example: Fixed pattern",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-3-2-example-fixed-pattern--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://example/>\nSELECT * \n{ \n  ?s ?p ?o \n  FILTER NOT EXISTS { :a :b :c }\n}",
         "url":null,
         "title":"8.3.2 Example: Fixed pattern",
         "description":null,
         "comment":null
      },
      {
         "name":"8.3.3 Example: Inner FILTERs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"8-3-3-example-inner-filters--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://example.com/>\nSELECT * WHERE {\n        ?x :p ?n\n        FILTER NOT EXISTS {\n                ?x :q ?m .\n                FILTER(?n = ?m)\n        }\n}",
         "url":null,
         "title":"8.3.3 Example: Inner FILTERs",
         "description":null,
         "comment":null
      },
      {
         "name":"9.2 Examples",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"9-2-examples--sparql_1.1@w3.org",
         "sparql":"  { :book1 dc:title|rdfs:label ?displayString }",
         "url":null,
         "title":"9.2 Examples",
         "description":null,
         "comment":null
      },
      {
         "name":"9.3 Property Paths and Equivalent Patterns",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"9-3-property-paths-and-equivalent-patterns--sparql_1.1@w3.org",
         "sparql":"PREFIX :   <http://example/>\nSELECT * \n{  ?s :item/:price ?x . }",
         "url":null,
         "title":"9.3 Property Paths and Equivalent Patterns",
         "description":null,
         "comment":null
      },
      {
         "name":"9.4 Arbitrary Length Path Matching",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"9-4-arbitrary-length-path-matching--sparql_1.1@w3.org",
         "sparql":"  PREFIX  rdfs:   <http://www.w3.org/2000/01/rdf-schema#> . \n  PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n  SELECT ?x ?type\n  { \n    ?x rdf:type/rdfs:subClassOf* ?type\n  }",
         "url":null,
         "title":"9.4 Arbitrary Length Path Matching",
         "description":null,
         "comment":null
      },
      {
         "name":"10.1 BIND: Assigning to Variables",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"10-1-bind-assigning-to-variables--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc:  <http://purl.org/dc/elements/1.1/>\nPREFIX  ns:  <http://example.org/ns#>\n\nSELECT  ?title ?price\n{  ?x ns:price ?p .\n   ?x ns:discount ?discount\n   BIND (?p*(1-?discount) AS ?price)\n   FILTER(?price < 20)\n   ?x dc:title ?title . \n}",
         "url":null,
         "title":"10.1 BIND: Assigning to Variables",
         "description":null,
         "comment":null
      },
      {
         "name":"10.2.2 VALUES Examples",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"10-2-2-values-examples--sparql_1.1@w3.org",
         "sparql":"PREFIX dc:   <http://purl.org/dc/elements/1.1/> \nPREFIX :     <http://example.org/book/> \nPREFIX ns:   <http://example.org/ns#> \n\nSELECT ?book ?title ?price\n{\n   VALUES ?book { :book1 :book3 }\n   ?book dc:title ?title ;\n         ns:price ?price .\n}",
         "url":null,
         "title":"10.2.2 VALUES Examples",
         "description":null,
         "comment":null
      },
      {
         "name":"11.1 Aggregate Example",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"11-1-aggregate-example--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://books.example/>\nSELECT (SUM(?lprice) AS ?totalPrice)\nWHERE {\n  ?org :affiliates ?auth .\n  ?auth :writesBook ?book .\n  ?book :price ?lprice .\n}\nGROUP BY ?org\nHAVING (SUM(?lprice) > 10)",
         "url":null,
         "title":"11.1 Aggregate Example",
         "description":null,
         "comment":null
      },
      {
         "name":"11.2 GROUP BY",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"11-2-group-by--sparql_1.1@w3.org",
         "sparql":"SELECT (AVG(?y) AS ?avg)\nWHERE {\n  ?a :x ?x ;\n     :y ?y .\n}\nGROUP BY ?x",
         "url":null,
         "title":"11.2 GROUP BY",
         "description":null,
         "comment":null
      },
      {
         "name":"11.3 HAVING",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"11-3-having--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://data.example/>\nSELECT (AVG(?size) AS ?asize)\nWHERE {\n  ?x :size ?size\n}\nGROUP BY ?x\nHAVING(AVG(?size) > 10)",
         "url":null,
         "title":"11.3 HAVING",
         "description":null,
         "comment":null
      },
      {
         "name":"11.4 Aggregate Projection Restrictions",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"11-4-aggregate-projection-restrictions--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://example.com/data/#>\nSELECT ?x (MIN(?y) * 2 AS ?min)\nWHERE {\n  ?x :p ?y .\n  ?x :q ?z .\n} GROUP BY ?x (STR(?z))",
         "url":null,
         "title":"11.4 Aggregate Projection Restrictions",
         "description":null,
         "comment":null
      },
      {
         "name":"11.5 Aggregate Example (with errors)",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"11-5-aggregate-example-with-errors--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://example.com/data/#>\nSELECT ?g (AVG(?p) AS ?avg) ((MIN(?p) + MAX(?p)) / 2 AS ?c)\nWHERE {\n  ?g :p ?p .\n}\nGROUP BY ?g",
         "url":null,
         "title":"11.5 Aggregate Example (with errors)",
         "description":null,
         "comment":null
      },
      {
         "name":"Example",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"example--sparql_1.1@w3.org",
         "sparql":"PREFIX : <http://people.example/>\nPREFIX : <http://people.example/>\nSELECT ?y ?minName\nWHERE {\n  :alice :knows ?y .\n  {\n    SELECT ?y (MIN(?name) AS ?minName)\n    WHERE {\n      ?y :name ?name .\n    } GROUP BY ?y\n  }\n}",
         "url":null,
         "title":"Example",
         "description":null,
         "comment":null
      },
      {
         "name":"13.2.1 Specifying the Default Graph",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-2-1-specifying-the-default-graph--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT  ?name\nFROM    <http://example.org/foaf/aliceFoaf>\nWHERE   { ?x foaf:name ?name }\n",
         "url":null,
         "title":"13.2.1 Specifying the Default Graph",
         "description":null,
         "comment":null
      },
      {
         "name":"13.2.2 Specifying Named Graphs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-2-2-specifying-named-graphs--sparql_1.1@w3.org",
         "sparql":"...\nFROM NAMED <http://example.org/alice>\nFROM NAMED <http://example.org/bob>\n...",
         "url":null,
         "title":"13.2.2 Specifying Named Graphs",
         "description":null,
         "comment":null
      },
      {
         "name":"13.2.3 Combining FROM and FROM NAMED",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-2-3-combining-from-and-from-named--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX dc: <http://purl.org/dc/elements/1.1/>\n\nSELECT ?who ?g ?mbox\nFROM <http://example.org/dft.ttl>\nFROM NAMED <http://example.org/alice>\nFROM NAMED <http://example.org/bob>\nWHERE\n{\n   ?g dc:publisher ?who .\n   GRAPH ?g { ?x foaf:mbox ?mbox }\n}\n",
         "url":null,
         "title":"13.2.3 Combining FROM and FROM NAMED",
         "description":null,
         "comment":null
      },
      {
         "name":"13.3.1 Accessing Graph Names",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-3-1-accessing-graph-names--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n\nSELECT ?src ?bobNick\nFROM NAMED <http://example.org/foaf/aliceFoaf>\nFROM NAMED <http://example.org/foaf/bobFoaf>\nWHERE\n  {\n    GRAPH ?src\n    { ?x foaf:mbox <mailto:bob@work.example> .\n      ?x foaf:nick ?bobNick\n    }\n  }\n",
         "url":null,
         "title":"13.3.1 Accessing Graph Names",
         "description":null,
         "comment":null
      },
      {
         "name":"13.3.2 Restricting by Graph \n  IRI",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-3-2-restricting-by-graph-iri--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX data: <http://example.org/foaf/>\n\nSELECT ?nick\nFROM NAMED <http://example.org/foaf/aliceFoaf>\nFROM NAMED <http://example.org/foaf/bobFoaf>\nWHERE\n  {\n     GRAPH data:bobFoaf {\n         ?x foaf:mbox <mailto:bob@work.example> .\n         ?x foaf:nick ?nick }\n  }\n",
         "url":null,
         "title":"13.3.2 Restricting by Graph \n  IRI",
         "description":null,
         "comment":null
      },
      {
         "name":"13.3.3 Restricting Possible Graph IRIs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-3-3-restricting-possible-graph-iris--sparql_1.1@w3.org",
         "sparql":"PREFIX  data:  <http://example.org/foaf/>\nPREFIX  foaf:  <http://xmlns.com/foaf/0.1/>\nPREFIX  rdfs:  <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT ?mbox ?nick ?ppd\nFROM NAMED <http://example.org/foaf/aliceFoaf>\nFROM NAMED <http://example.org/foaf/bobFoaf>\nWHERE\n{\n  GRAPH data:aliceFoaf\n  {\n    ?alice foaf:mbox <mailto:alice@work.example> ;\n           foaf:knows ?whom .\n    ?whom  foaf:mbox ?mbox ;\n           rdfs:seeAlso ?ppd .\n    ?ppd  a foaf:PersonalProfileDocument .\n  } .\n  GRAPH ?ppd\n  {\n      ?w foaf:mbox ?mbox ;\n         foaf:nick ?nick\n  }\n}\n",
         "url":null,
         "title":"13.3.3 Restricting Possible Graph IRIs",
         "description":null,
         "comment":null
      },
      {
         "name":"13.3.4 Named and Default \nGraphs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"13-3-4-named-and-default-graphs--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX dc:   <http://purl.org/dc/elements/1.1/>\n\nSELECT ?name ?mbox ?date\nWHERE\n  {  ?g dc:publisher ?name ;\n        dc:date ?date .\n    GRAPH ?g\n      { ?person foaf:name ?name ; foaf:mbox ?mbox }\n  }\n",
         "url":null,
         "title":"13.3.4 Named and Default \nGraphs",
         "description":null,
         "comment":null
      },
      {
         "name":"15.1 ORDER BY",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-1-order-by--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\n\nSELECT ?name\nWHERE { ?x foaf:name ?name }\nORDER BY ?name\n",
         "url":null,
         "title":"15.1 ORDER BY",
         "description":null,
         "comment":null
      },
      {
         "name":"15.2 Projection",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-2-projection--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:       <http://xmlns.com/foaf/0.1/>\nSELECT ?name\nWHERE\n { ?x foaf:name ?name }\n",
         "url":null,
         "title":"15.2 Projection",
         "description":null,
         "comment":null
      },
      {
         "name":"15.3 Duplicate Solutions",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-3-duplicate-solutions--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nSELECT ?name WHERE { ?x foaf:name ?name }\n",
         "url":null,
         "title":"15.3 Duplicate Solutions",
         "description":null,
         "comment":null
      },
      {
         "name":"15.3.1 DISTINCT",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-3-1-distinct--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nSELECT DISTINCT ?name WHERE { ?x foaf:name ?name }\n",
         "url":null,
         "title":"15.3.1 DISTINCT",
         "description":null,
         "comment":null
      },
      {
         "name":"15.3.2 REDUCED",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-3-2-reduced--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nSELECT REDUCED ?name WHERE { ?x foaf:name ?name }\n",
         "url":null,
         "title":"15.3.2 REDUCED",
         "description":null,
         "comment":null
      },
      {
         "name":"15.4 OFFSET",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-4-offset--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\n\nSELECT  ?name\nWHERE   { ?x foaf:name ?name }\nORDER BY ?name\nLIMIT   5\nOFFSET  10",
         "url":null,
         "title":"15.4 OFFSET",
         "description":null,
         "comment":null
      },
      {
         "name":"15.5 LIMIT",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"15-5-limit--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\n\nSELECT ?name\nWHERE { ?x foaf:name ?name }\nLIMIT 20\n",
         "url":null,
         "title":"15.5 LIMIT",
         "description":null,
         "comment":null
      },
      {
         "name":"16.1.1 Projection",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-1-1-projection--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nSELECT ?nameX ?nameY ?nickY\nWHERE\n  { ?x foaf:knows ?y ;\n       foaf:name ?nameX .\n    ?y foaf:name ?nameY .\n    OPTIONAL { ?y foaf:nick ?nickY }\n  }",
         "url":null,
         "title":"16.1.1 Projection",
         "description":null,
         "comment":null
      },
      {
         "name":"16.1.2 SELECT Expressions",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-1-2-select-expressions--sparql_1.1@w3.org",
         "sparql":"PREFIX  dc:  <http://purl.org/dc/elements/1.1/>\nPREFIX  ns:  <http://example.org/ns#>\nSELECT  ?title (?p*(1-?discount) AS ?price)\n{ ?x ns:price ?p .\n  ?x dc:title ?title . \n  ?x ns:discount ?discount \n}",
         "url":null,
         "title":"16.1.2 SELECT Expressions",
         "description":null,
         "comment":null
      },
      {
         "name":"16.2 CONSTRUCT",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-2-construct--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nPREFIX vcard:   <http://www.w3.org/2001/vcard-rdf/3.0#>\nCONSTRUCT   { <http://example.org/person#Alice> vcard:FN ?name }\nWHERE       { ?x foaf:name ?name }\n",
         "url":null,
         "title":"16.2 CONSTRUCT",
         "description":null,
         "comment":null
      },
      {
         "name":"16.2.1 Templates with Blank Nodes",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-2-1-templates-with-blank-nodes--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nPREFIX vcard:   <http://www.w3.org/2001/vcard-rdf/3.0#>\n\nCONSTRUCT { ?x  vcard:N _:v .\n            _:v vcard:givenName ?gname .\n            _:v vcard:familyName ?fname }\nWHERE\n {\n    { ?x foaf:firstname ?gname } UNION  { ?x foaf:givenname   ?gname } .\n    { ?x foaf:surname   ?fname } UNION  { ?x foaf:family_name ?fname } .\n }\n",
         "url":null,
         "title":"16.2.1 Templates with Blank Nodes",
         "description":null,
         "comment":null
      },
      {
         "name":"16.2.2 Accessing Graphs in the RDF Dataset",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-2-2-accessing-graphs-in-the-rdf-dataset--sparql_1.1@w3.org",
         "sparql":"CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <http://example.org/aGraph> { ?s ?p ?o } . }\n",
         "url":null,
         "title":"16.2.2 Accessing Graphs in the RDF Dataset",
         "description":null,
         "comment":null
      },
      {
         "name":"16.2.3 Solution Modifiers and CONSTRUCT",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-2-3-solution-modifiers-and-construct--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX site: <http://example.org/stats#>\n\nCONSTRUCT { [] foaf:name ?name }\nWHERE\n{ [] foaf:name ?name ;\n     site:hits ?hits .\n}\nORDER BY desc(?hits)\nLIMIT 2\n",
         "url":null,
         "title":"16.2.3 Solution Modifiers and CONSTRUCT",
         "description":null,
         "comment":null
      },
      {
         "name":"16.2.4 CONSTRUCT WHERE",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-2-4-construct-where--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nCONSTRUCT WHERE { ?x foaf:name ?name } \n",
         "url":null,
         "title":"16.2.4 CONSTRUCT WHERE",
         "description":null,
         "comment":null
      },
      {
         "name":"16.3 ASK",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-3-ask--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:    <http://xmlns.com/foaf/0.1/>\nASK  { ?x foaf:name  \"Alice\" }\n",
         "url":null,
         "title":"16.3 ASK",
         "description":null,
         "comment":null
      },
      {
         "name":"16.4.1 Explicit IRIs",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-4-1-explicit-iris--sparql_1.1@w3.org",
         "sparql":"DESCRIBE <http://example.org/>\n",
         "url":null,
         "title":"16.4.1 Explicit IRIs",
         "description":null,
         "comment":null
      },
      {
         "name":"16.4.2 Identifying Resources",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-4-2-identifying-resources--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf:   <http://xmlns.com/foaf/0.1/>\nDESCRIBE ?x\nWHERE    { ?x foaf:mbox <mailto:alice@org> }\n",
         "url":null,
         "title":"16.4.2 Identifying Resources",
         "description":null,
         "comment":null
      },
      {
         "name":"16.4.3 Descriptions of Resources",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"16-4-3-descriptions-of-resources--sparql_1.1@w3.org",
         "sparql":"PREFIX ent:  <http://org.example.com/employees#>\nDESCRIBE ?x WHERE { ?x ent:employeeId \"1234\" }\n",
         "url":null,
         "title":"16.4.3 Descriptions of Resources",
         "description":null,
         "comment":null
      },
      {
         "name":"17 Expressions and Testing Values",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-expressions-and-testing-values--sparql_1.1@w3.org",
         "sparql":"PREFIX a:      <http://www.w3.org/2000/10/annotation-ns#>\nPREFIX dc:     <http://purl.org/dc/elements/1.1/>\nPREFIX xsd:    <http://www.w3.org/2001/XMLSchema#>\n\nSELECT ?annot\nWHERE { ?annot  a:annotates  <http://www.w3.org/TR/rdf-sparql-query/> .\n        ?annot  dc:date      ?date .\n        FILTER ( ?date > \"2005-01-01T00:00:00Z\"^^xsd:dateTime ) }",
         "url":null,
         "title":"17 Expressions and Testing Values",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.1.1 bound",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-1-1-bound--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX dc:   <http://purl.org/dc/elements/1.1/>\nPREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>\nSELECT ?givenName\n WHERE { ?x foaf:givenName  ?givenName .\n         OPTIONAL { ?x dc:date ?date } .\n         FILTER ( bound(?date) ) }\n",
         "url":null,
         "title":"17.4.1.1 bound",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.1.7 RDFterm-equal",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-1-7-rdfterm-equal--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name1 ?name2\nWHERE { ?x foaf:name  ?name1 ;\n        foaf:mbox  ?mbox1 .\n        ?y foaf:name  ?name2 ;\n        foaf:mbox  ?mbox2 .\n        FILTER (?mbox1 = ?mbox2 && ?name1 != ?name2)\n      }",
         "url":null,
         "title":"17.4.1.7 RDFterm-equal",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.1.8 sameTerm",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-1-8-sameterm--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name1 ?name2\nWHERE { ?x foaf:name  ?name1 ;\n        foaf:mbox  ?mbox1 .\n         ?y foaf:name  ?name2 ;\n         foaf:mbox  ?mbox2 .\n         FILTER (sameTerm(?mbox1, ?mbox2) && !sameTerm(?name1, ?name2))\n      } ",
         "url":null,
         "title":"17.4.1.8 sameTerm",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.1 isIRI",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-1-isiri--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\n WHERE { ?x foaf:name  ?name ;\n            foaf:mbox  ?mbox .\n         FILTER isIRI(?mbox) }",
         "url":null,
         "title":"17.4.2.1 isIRI",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.2 isBlank",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-2-isblank--sparql_1.1@w3.org",
         "sparql":"PREFIX a:      <http://www.w3.org/2000/10/annotation-ns#>\nPREFIX dc:     <http://purl.org/dc/elements/1.1/>\nPREFIX foaf:   <http://xmlns.com/foaf/0.1/>\n\nSELECT ?given ?family\nWHERE { ?annot  a:annotates  <http://www.w3.org/TR/rdf-sparql-query/> .\n  ?annot  dc:creator   ?c .\n  OPTIONAL { ?c  foaf:given   ?given ; foaf:family  ?family } .\n  FILTER isBlank(?c)\n}",
         "url":null,
         "title":"17.4.2.2 isBlank",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.3 isLiteral",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-3-isliteral--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\nWHERE { ?x foaf:name  ?name ;\n        foaf:mbox  ?mbox .\n        FILTER isLiteral(?mbox) }",
         "url":null,
         "title":"17.4.2.3 isLiteral",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.5 str",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-5-str--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\n WHERE { ?x foaf:name  ?name ;\n            foaf:mbox  ?mbox .\n         FILTER regex(str(?mbox), \"@work\\\\.example$\") }\n",
         "url":null,
         "title":"17.4.2.5 str",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.6 lang",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-6-lang--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name ?mbox\n WHERE { ?x foaf:name  ?name ;\n            foaf:mbox  ?mbox .\n         FILTER ( lang(?name) = \"es\" ) }",
         "url":null,
         "title":"17.4.2.6 lang",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.2.7 datatype",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-2-7-datatype--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>\nPREFIX eg:   <http://biometrics.example/ns#>\nSELECT ?name ?shoeSize\n WHERE { ?x foaf:name  ?name ; eg:shoeSize  ?shoeSize .\n         FILTER ( datatype(?shoeSize) = xsd:integer ) }",
         "url":null,
         "title":"17.4.2.7 datatype",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.3.13 langMatches",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-3-13-langmatches--sparql_1.1@w3.org",
         "sparql":"PREFIX dc: <http://purl.org/dc/elements/1.1/>\nSELECT ?title\n WHERE { ?x dc:title  \"That Seventies Show\"@en ;\n            dc:title  ?title .\n         FILTER langMatches( lang(?title), \"FR\" ) }",
         "url":null,
         "title":"17.4.3.13 langMatches",
         "description":null,
         "comment":null
      },
      {
         "name":"17.4.3.14 REGEX",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-4-3-14-regex--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nSELECT ?name\n WHERE { ?x foaf:name  ?name\n         FILTER regex(?name, \"^ali\", \"i\") }\n",
         "url":null,
         "title":"17.4.3.14 REGEX",
         "description":null,
         "comment":null
      },
      {
         "name":"17.6 Extensible Value Testing",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"17-6-extensible-value-testing--sparql_1.1@w3.org",
         "sparql":"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX func: <http://example.org/functions#>\nSELECT ?name ?id\nWHERE { ?x foaf:name  ?name ;\n           func:empId   ?id .\n        FILTER (func:even(?id)) }",
         "url":null,
         "title":"17.6 Extensible Value Testing",
         "description":null,
         "comment":null
      },
      {
         "name":"18.2.4.1 Grouping and Aggregation",
         "namespace":"sparql_1.1",
         "domain":"w3.org",
         "query_id":"18-2-4-1-grouping-and-aggregation--sparql_1.1@w3.org",
         "sparql":"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nSELECT (SUM(?val) AS ?sum) (COUNT(?a) AS ?count)\nWHERE {\n  ?a rdf:value ?val .\n} GROUP BY ?a",
         "url":null,
         "title":"18.2.4.1 Grouping and Aggregation",
         "description":null,
         "comment":null
      }
   ]
}