Re: CONSTRUCT operator

Hi, Sergio
First of all, thanks for your previous test cases!

[...]
> Q1) Build a graph which is graph-equivalent to the Dataset (identity):
>
>      CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }
>
> Q2) Build a reification of the Dataset
>
>      CONSTRUCT { _:s rdf:subject ?s .
>                  _:s rdf:predicate ?p .
>                  _:s rdf:object ?o } WHERE { ?s ?p ?o }
>
> Assume the following Dataset:
>
> _:a foaf:name "Alice" .
> _:a foaf:mbox <mailto:alice@example.org> .

Those gave me trouble with a 7 year old bug..
but now, after fixing, I am getting:

A1)
_:a_0_ foaf:name "Alice".
_:a_0_ foaf:mbox <mailto:alice@example.org>.

A2)
_:e0_ rdf:subject _:a_0_.
_:e1_ rdf:subject _:a_0_.
_:e0_ rdf:predicate foaf:name.
_:e1_ rdf:predicate foaf:mbox.
_:e0_ rdf:object "Alice".
_:e1_ rdf:object <mailto:alice@example.org>.

The trouble was with the latter as a backward chainer
is not easily happy with existentials in the consequent.
It is done with following filter rule:

{?s ?p ?o.
 ?f e:tuple (?s ?p ?o)}
 =>
 {?f rdf:subject ?s.
  ?f rdf:predicate ?p.
  ?f rdf:object ?o}.

where e:tuple is a builtin skolem function generator.

-- 
Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/

Received on Wednesday, 25 January 2006 22:32:13 UTC