- From: David Booth <david@dbooth.org>
- Date: Thu, 23 Feb 2012 13:44:15 -0500
- To: Michael Brunnbauer <brunni@netestate.de>
- Cc: carsten.kessler@uni-muenster.de, public-lod@w3.org, Chad Hendrix <hendrix@un.org>
Hi Michael, On Thu, 2012-02-23 at 16:59 +0100, Michael Brunnbauer wrote: [ . . . ] > I do not see why you have to name thousands of graphs in the query. Is > the metadata not attached to the named graph with the named graph URI > as subject ? > > You could query it like this: > > select ?s ?p ?o where { > graph ?g1 { ?g <http://xmlns.com/foaf/0.1/maker> <http://www.brunni.de/foaf.rdf#me> } > graph ?g { ?s ?p ?o } > } That technique may usable in some cases, but it means something different from using multiple "FROM NAMED" clauses. In the example above, graph ?g is an *individual* graph -- the triples from all of the ?g graphs are never merged. The difference shows up when you need to join triples that originate in different graphs. For example, if your query wanted both "?s :p1 ?o" and "?s :p2 ?o" to be true and you wrote something like this: select ?s ?p ?o where { graph ?g1 { ?g <http://xmlns.com/foaf/0.1/maker> <http://www.brunni.de/foaf.rdf#me> } graph ?g { ?s :p1 ?o . ?s :p2 ?o .} } then this query will only work if both of these triples come from the *same* graph ?g, whereas if the graphs were all listed in "FROM NAMED" clauses, then one triple could come from one graph and the other from another. -- David Booth, Ph.D. http://dbooth.org/ Opinions expressed herein are those of the author and do not necessarily reflect those of his employer.
Received on Thursday, 23 February 2012 18:45:12 UTC