Re: test cases for SPARQL CONSTRUCT

jos.deroo@agfa.com wrote:
> making use of the excellent service at
> http://sparql.org/query.html
> 
> I asked
> 
> 1/
> 
> PREFIX dc:      <http://purl.org/dc/elements/1.1/>
> PREFIX owl:     <http://www.w3.org/2002/07/owl#>
> PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> CONSTRUCT ($book rdf:type owl:Nothing) WHERE ($book dc:title $title)

Great! (sigh of relief that it worked - the log file has a warning abount the 
unbound variables.

> 
> 
> and got result graph
> 
> @prefix dc:      <http://purl.org/dc/elements/1.1/> .
> @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix owl:     <http://www.w3.org/2002/07/owl#> .
> 
> <http://example.org/book/book2>
>       a       owl:Nothing .
> 
> <http://example.org/book/book4>
>       a       owl:Nothing .
> 
> <http://example.org/book/book1>
>       a       owl:Nothing .
> 
> <http://example.org/book/book5>
>       a       owl:Nothing .
> 
> <http://example.org/book/book3>
>       a       owl:Nothing .
> 
> 
> which is inconsistent and that is because the query
> (when seen as rule) is inconsistent.

There isn't an OWL processor behind the data so you only get the RDF-isms.

> 
> 
> 2/
> 
> PREFIX dc:      <http://purl.org/dc/elements/1.1/>
> PREFIX owl:     <http://www.w3.org/2002/07/owl#>
> PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> CONSTRUCT ($book dc:title $test) WHERE ($book dc:title $title)
> 
> 
> and got empty result graph

Yes - I made the arbitrary-at-the-time decision that unbound variables are an 
error.  The code isn't fixed - may it should stop the whole substitution for 
that query solution and and I think I only stop the triple.

Tries ...

PREFIX dc:      <http://purl.org/dc/elements/1.1/>
PREFIX owl:     <http://www.w3.org/2002/07/owl#>
PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX :        <http://www.example.org/>
CONSTRUCT ($book dc:title $test) ($book rdf:type :book)
WHERE ($book dc:title $title)

and gets ...

@prefix dc:      <http://purl.org/dc/elements/1.1/> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix :        <http://www.example.org/> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

<http://example.org/book/book2>
       a       :book .

<http://example.org/book/book4>
       a       :book .

<http://example.org/book/book1>
       a       :book .

<http://example.org/book/book5>
       a       :book .

<http://example.org/book/book3>
       a       :book .

Yep - I'll do whatever the WG decides.


> 
> My implementation actually returns
> :Paper :authorName ?test.
> 
> which is because we made it so to return
> substitution results (constructed as RDF graph)
> for unbound variables (e.g. in the case of OR
> or OPTIONAL)

That would require returning query variables which can't be expressed in RDF (or 
we have to have a DAWG-convention) but I see nothing to stop that being done at 
the practical level.  I look for guidance on the theoretical level.

> 
> But I can understand the returning of the empty graph
> as it is according to my understanding that the proof
> result atoms should be in the Herbrand base of the
> query formula.
> 
> (Herbrand Base is the set of all ground atoms that can
> be formed from predicate symbols from a clause in Skolemized
> form S and terms from the Herbrand universe H of S.
> Herbrand universe of S is the set of all closed terms
> constructed from the constant and function symbols of S)
> 
> 

That would suggest that my test case should create the (?book rdf:type :book) 
triples even when ?test is unbound - have I got this right?

	Andy

Received on Thursday, 11 November 2004 15:31:30 UTC