<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#restrictInQuery>
        a       <https://w3id.org/atomgraph/linkeddatahub#Content> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#value>
                "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h4 id=\"restrictInQuery\">Restricting Possible Graph IRIs</h4>\n\n<p>A variable used in the <code>GRAPH</code> clause may also be used in another <code>GRAPH</code> clause or in a graph pattern matched against the default graph in the dataset.</p>\n<p>The query below uses the graph with IRI <code>http://example.org/foaf/aliceFoaf</code> to find the profile document for Bob; it then matches another pattern against that graph. The pattern in the second <code>GRAPH</code> clause finds the blank node (variable <code>w</code>) for the person with the same mail box (given by variable <code>mbox</code>) as found in the first <code>GRAPH</code> clause (variable <code>whom</code>), because the blank node used to match for variable <code>whom</code> from Alice's FOAF file is not the same as the blank node in the profile document (they are in different graphs).</p>\n<pre xml:space=\"preserve\"><code class=\"language-sparql\">PREFIX  data:  &lt;http://example.org/foaf/&gt;\nPREFIX  foaf:  &lt;http://xmlns.com/foaf/0.1/&gt;\nPREFIX  rdfs:  &lt;http://www.w3.org/2000/01/rdf-schema#&gt;\n\nSELECT ?mbox ?nick ?ppd\nFROM NAMED &lt;http://example.org/foaf/aliceFoaf&gt;\nFROM NAMED &lt;http://example.org/foaf/bobFoaf&gt;\nWHERE\n{\n  GRAPH data:aliceFoaf\n  {\n    ?alice foaf:mbox &lt;mailto:alice@work.example&gt; ;\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</code></pre>\n<table class=\"resultTable table table-striped\">\n   <tr>\n      <th colspan=\"1\" rowspan=\"1\">mbox</th>\n      <th colspan=\"1\" rowspan=\"1\">nick</th>\n      <th colspan=\"1\" rowspan=\"1\">ppd</th>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">&lt;mailto:bob@work.example&gt;</td>\n      <td colspan=\"1\" rowspan=\"1\">\"Robert\"</td>\n      <td colspan=\"1\" rowspan=\"1\">&lt;http://example.org/foaf/bobFoaf&gt;</td>\n   </tr>\n</table></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#restrictInQuery> .

<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#accessByLabel>
        a       <https://w3id.org/atomgraph/linkeddatahub#Content> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#value>
                "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h4 id=\"accessByLabel\">Accessing Graph Names</h4>\n\n<p>The query below matches the graph pattern against each of the named graphs in the dataset and forms solutions which have the <code>src</code> variable bound to IRIs of the graph being matched. The graph pattern is matched with the active graph being each of the named graphs in the dataset.</p>\n<pre xml:space=\"preserve\"><code class=\"language-sparql\">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;\n\nSELECT ?src ?bobNick\nFROM NAMED &lt;http://example.org/foaf/aliceFoaf&gt;\nFROM NAMED &lt;http://example.org/foaf/bobFoaf&gt;\nWHERE\n  {\n    GRAPH ?src\n    { ?x foaf:mbox &lt;mailto:bob@work.example&gt; .\n      ?x foaf:nick ?bobNick\n    }\n  }\n</code></pre>\n<p>The query result gives the name of the graphs where the information was found and the value for Bob's nick:</p>\n<table class=\"resultTable table table-striped\">\n   <tr>\n      <th colspan=\"1\" rowspan=\"1\">src</th>\n      <th colspan=\"1\" rowspan=\"1\">bobNick</th>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">&lt;http://example.org/foaf/aliceFoaf&gt;</td>\n      <td colspan=\"1\" rowspan=\"1\">\"Bobby\"</td>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">&lt;http://example.org/foaf/bobFoaf&gt;</td>\n      <td colspan=\"1\" rowspan=\"1\">\"Robert\"</td>\n   </tr>\n</table></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#accessByLabel> .

<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#this>
        a                          <https://kgdev.net/ns#Definition> , <https://w3id.org/atomgraph/linkeddatahub#Content> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#value>
                "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h3 id=\"this\">Querying the Dataset</h3>\n\n<p>When querying a collection of graphs, the <code>GRAPH</code> keyword is used to match patterns against named graphs. <code>GRAPH</code> can provide an IRI to select one graph or use a variable which will range over the IRI of all the named graphs in the query's RDF dataset.</p>\n<p>The use of <code>GRAPH</code> changes the active graph for matching graph patterns within that part of the query. Outside the use of <code>GRAPH</code>, matching is done using the default graph.</p>\n<p>The following two graphs will be used in examples:</p>\n<pre xml:space=\"preserve\"><code class=\"language-turtle\"># Named graph: http://example.org/foaf/aliceFoaf\n@prefix  foaf:     &lt;http://xmlns.com/foaf/0.1/&gt; .\n@prefix  rdf:      &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .\n@prefix  rdfs:     &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .\n\n_:a  foaf:name     \"Alice\" .\n_:a  foaf:mbox     &lt;mailto:alice@work.example&gt; .\n_:a  foaf:knows    _:b .\n\n_:b  foaf:name     \"Bob\" .\n_:b  foaf:mbox     &lt;mailto:bob@work.example&gt; .\n_:b  foaf:nick     \"Bobby\" .\n_:b  rdfs:seeAlso  &lt;http://example.org/foaf/bobFoaf&gt; .\n\n&lt;http://example.org/foaf/bobFoaf&gt;\n     rdf:type      foaf:PersonalProfileDocument .\n</code></pre>\n<pre xml:space=\"preserve\"><code class=\"language-turtle\"># Named graph: http://example.org/foaf/bobFoaf\n@prefix  foaf:     &lt;http://xmlns.com/foaf/0.1/&gt; .\n@prefix  rdf:      &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .\n@prefix  rdfs:     &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .\n\n_:z  foaf:mbox     &lt;mailto:bob@work.example&gt; .\n_:z  rdfs:seeAlso  &lt;http://example.org/foaf/bobFoaf&gt; .\n_:z  foaf:nick     \"Robert\" .\n\n&lt;http://example.org/foaf/bobFoaf&gt;\n     rdf:type      foaf:PersonalProfileDocument .\n</code></pre>\n<p>Any triple in Alice's FOAF file giving Bob's <code>nick</code> is not used to provide a nick for Bob because the pattern involving variable <code>nick</code> is restricted by <code>ppd</code> to a particular Personal Profile Document.</p></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#queryDataset> ;
        <https://schema.org/name>  "Querying the Dataset" .

<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/>
        a       <https://www.w3.org/ns/ldt/document-hierarchy#Item> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#this> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#accessByLabel> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#_3>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#restrictByLabel> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#_4>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#restrictInQuery> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#_5>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#namedAndDefaultGraph> ;
        <http://purl.org/dc/terms/modified>
                "2023-07-10T15:44:20.596Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <http://purl.org/dc/terms/title>
                "Querying the Dataset" ;
        <http://rdfs.org/sioc/ns#has_container>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#queryDataset> ;
        <http://xmlns.com/foaf/0.1/primaryTopic>
                <https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#this> .

<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#restrictByLabel>
        a       <https://w3id.org/atomgraph/linkeddatahub#Content> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#value>
                "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h4 id=\"restrictByLabel\">Restricting by Graph IRI</h4>\n\n<p>The query can restrict the matching applied to a specific graph by supplying the graph IRI. This sets the active graph to the graph named by the IRI. This query looks for Bob's nick as given in the graph <code>http://example.org/foaf/bobFoaf</code>.</p>\n<pre xml:space=\"preserve\"><code class=\"language-sparql\">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;\nPREFIX data: &lt;http://example.org/foaf/&gt;\n\nSELECT ?nick\nFROM NAMED &lt;http://example.org/foaf/aliceFoaf&gt;\nFROM NAMED &lt;http://example.org/foaf/bobFoaf&gt;\nWHERE\n  {\n     GRAPH data:bobFoaf {\n         ?x foaf:mbox &lt;mailto:bob@work.example&gt; .\n         ?x foaf:nick ?nick }\n  }\n</code></pre>\n<p>which yields a single solution:</p>\n<table class=\"resultTable table table-striped\">\n   <tr>\n      <th colspan=\"1\" rowspan=\"1\">nick</th>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">\"Robert\"</td>\n   </tr>\n</table></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#restrictByLabel> .

<https://kgdev.net/specifications/sparql11-query/rdfDataset/queryDataset/#namedAndDefaultGraph>
        a       <https://w3id.org/atomgraph/linkeddatahub#Content> ;
        <http://www.w3.org/1999/02/22-rdf-syntax-ns#value>
                "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h4 id=\"namedAndDefaultGraph\">Named and Default Graphs</h4>\n\n<p>Query patterns can involve both the default graph and the named graphs. In this example, an aggregator has read in a Web resource on two different occasions. Each time a graph is read into the aggregator, it is given an IRI by the local system. The graphs are nearly the same but the email address for \"Bob\" has changed.</p>\n<p>In this example, the default graph is being used to record the provenance information and the RDF data actually read is kept in two separate graphs, each of which is given a different IRI by the system. The RDF dataset consists of two named graphs and the information about them.</p>\n<p>RDF Dataset:</p>\n<pre xml:space=\"preserve\"><code class=\"language-turtle\"># Default graph\n@prefix dc: &lt;http://purl.org/dc/elements/1.1/&gt; .\n@prefix g:  &lt;tag:example.org,2005-06-06:&gt; .\n@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; .\n\ng:graph1 dc:publisher \"Bob\" .\ng:graph1 dc:date \"2004-12-06\"^^xsd:date .\n\ng:graph2 dc:publisher \"Bob\" .\ng:graph2 dc:date \"2005-01-10\"^^xsd:date .\n</code></pre>\n<pre xml:space=\"preserve\"><code class=\"language-turtle\"># Graph: locally allocated IRI: tag:example.org,2005-06-06:graph1\n@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .\n\n_:a foaf:name \"Alice\" .\n_:a foaf:mbox &lt;mailto:alice@work.example&gt; .\n\n_:b foaf:name \"Bob\" .\n_:b foaf:mbox &lt;mailto:bob@oldcorp.example.org&gt; .\n</code></pre>\n<pre xml:space=\"preserve\"><code class=\"language-turtle\"># Graph: locally allocated IRI: tag:example.org,2005-06-06:graph2\n@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .\n\n_:a foaf:name \"Alice\" .\n_:a foaf:mbox &lt;mailto:alice@work.example&gt; .\n\n_:b foaf:name \"Bob\" .\n_:b foaf:mbox &lt;mailto:bob@newcorp.example.org&gt; .\n</code></pre>\n<p>This query finds email addresses, detailing the name of the person and the date the information was discovered.</p>\n<pre xml:space=\"preserve\"><code class=\"language-sparql\">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;\nPREFIX dc:   &lt;http://purl.org/dc/elements/1.1/&gt;\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</code></pre>\n<p>The results show that the email address for \"Bob\" has changed.</p>\n<table class=\"resultTable table table-striped\">\n   <tr>\n      <th colspan=\"1\" rowspan=\"1\">name</th>\n      <th colspan=\"1\" rowspan=\"1\">mbox</th>\n      <th colspan=\"1\" rowspan=\"1\">date</th>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">\"Bob\"</td>\n      <td colspan=\"1\" rowspan=\"1\">&lt;mailto:bob@oldcorp.example.org&gt;</td>\n      <td colspan=\"1\" rowspan=\"1\">\"2004-12-06\"^^xsd:date</td>\n   </tr>\n   <tr>\n      <td colspan=\"1\" rowspan=\"1\">\"Bob\"</td>\n      <td colspan=\"1\" rowspan=\"1\">&lt;mailto:bob@newcorp.example.org&gt;</td>\n      <td colspan=\"1\" rowspan=\"1\">\"2005-01-10\"^^xsd:date</td>\n   </tr>\n</table></div>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> ;
        <http://www.w3.org/ns/prov#wasDerivedFrom>
                <https://www.w3.org/TR/sparql11-query/#namedAndDefaultGraph> .
