CONSTRUCT *

CONSTRUCT * is currently defined as returning the RDF graph that
matches the query pattern.  This does not extend to the case of GRAPH 
because the query pattern isn't matching a single graph any more.  It is in 
danger of making it seem like there are assertions in the background graph 
that actually are in some named graph.



To start with, here are some examples:

1/ Get the background graph

CONSTRUCT * WHERE { ?s ?p ?o }
CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }


"""
ACTION: AndyS to explain how to get a whole graph with CONSTRUCT * and
GRAPH. [11]  recorded in http://www.w3.org/2005/03/01-dawg-irc#T16-16-04
"""

2/ getGraph(<uri>) can be imitated, if <uri> is in the dataset

CONSTRUCT { ?s ?p ?o } WHERE GRAPH <uri> { ?s ?p ?o }

But the form:
   CONSTRUCT * WHERE GRAPH <uri> { ?s ?p ?o }
does not make sense as the query pattern is not re-executable over the
result of CONSTRUCT * if that were to return the named graph.


3/ More problematic:

CONSTRUCT * WHERE
      GRAPH <g> { ... }
      GRAPH <h> { ... }

I don't know of a sensible meaning  - merging <g> and <h> (and loosing the 
labels) is not good.


4/ Mixing named graphs and the background graph:

CONSTRUCT { ?s ?p ?o } WHERE
   GRAPH ?g { ?s ?p ?o }
   { ?g dc:publisher <http://www.w3.org/> }
   { ?g dc:date ?date }
   FILTER app:myDate(?date) > "2005-02-28T00:00:00Z"^^xsd:dateTime

I don't know of a sensible meaning if it had said "CONSTRUCT *" unless the 
return is a dataset, not a single graph.


The problem is because the output of CONSTRUCT is a graph, not a dataset
(the query system is not closed).

Approach 1: "CONSTRUCT *" is illegal if the query uses GRAPH.  The
application writer has to be a bit more explicit and provide a template
that more accurately describes what they want.

Approach 2: "CONSTRUCT" returns a dataset.  Need to extend CONSTRUCT
templates to include GRAPH.

Approach 3: Drop "CONSTRUCT *" all together.

My preference is 3 > 1 > 2.

	Andy

Received on Sunday, 6 March 2005 09:58:03 UTC