- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Fri, 10 Dec 2004 17:51:18 +0000
- To: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Pat,
In email, you were asking about CONSTRUCT:
Pat wrote:
>>There is one case that Im a bit puzzled about, which is the
>>CONSTRUCT answer where all the various answers are merged into a
>>single answer (Is that right? It took me a while to figure out that
>>is what was meant here, and I might not have it right.) So for
>>example suppose the target graph is
>>
>>bill loves _:who .
>>joe loves _:who .
>>
>>and the query is
>>
>>construct * where ?x loves ?y
>>
>>Now, as I understand it (and the definitions I sent say) , the
>>result will be the graph merge of two sub-answers, which will
>>themselves in this case be
>>
>> bill loves _:who . (first answer binding ?x/bill, ?y/_:who)
>>
>>and
>>
>>joe loves _:who . (second answer binding ?x/joe, ?y/_:who)
>>
>>But the merge of these will require the bnodes in the two
>>sub-answers to be separated, so that one will get something like
>>
>>bill loves _:a
>>joe loves _:b
>>
>>as the result graph in this case, which loses some information that
>>was in the target. Is that what was intended? If not, the
>>definitions need to be tweaked.
The intent of the CONSTRUCT is that it should not create two different bNodes:
---- Data:
@prefix : <http://example.org/ns#> .
<bill> :loves _:who .
<joe> :loves _:who .
---- cwm rule:
@prefix : <http://example.org/ns#> .
{ ?x :loves ?y } => { ?x :knows ?y } .
----
and with cwm I get:
<bill> :knows _:who .
<joe> :knows _:who .
that is, same bNode. Which, in SPARQL, is:
PREFIX : <http://example.org/ns#>
CONSTRUCT ( ?x :knows ?y )
WHERE ( ?x :loves ?y )
I see that "merge" is not the right language. Would this be better?
"""
The answer to a CONSTRUCT query:
CONSTRUCT pat1 WHERE pat2
where pat1 is a basic pattern is the set of RDF triples X formed by the union of
S(pat1) for all substitutions S where S is a solution of pat2.
"""
(a "solution" = "answer substitution" in your definitions)
Now "CONSTRUCT * WHERE pattern" is supposed to be a shorthand for using the
pattern as the template:
"CONSTRUCT pattern WHERE pattern"
Andy
Received on Friday, 10 December 2004 17:51:41 UTC