Hi Ivan.
Thanks for the explanation.
Br,
Timo Westkämper
On 03/08/2011 05:25 PM, Ivan Mikhailov wrote:
Hello Timo,
On Mon, 2011-03-07 at 14:29 +0200, Timo Westkämper wrote:
Hi all.
How do I correctly bind the named graph context of the following SPARQL
query :
CONSTRUCT { ?s ?p ?o} FROM ?context WHERE { ?s ?p ?o }
I tried the following options
CONSTRUCT { ?s ?p ?o} FROM `iri(??)` WHERE { ?s ?p ?o }
CONSTRUCT { ?s ?p ?o} FROM iri(??) WHERE { ?s ?p ?o }
Both throw Exceptions.
What is the right way to do it?
I am aware that it works also as
CONSTRUCT { ?s ?p ?o} WHERE { graph ?context { ?s ?p ?o } }
but I prefer the syntax form using FROM.
CONSTRUCT { ?s ?p ?o} WHERE { graph `iri(??)` { ?s ?p ?o } }
is the only choice, due to performance implications. The FROM clause
needs a constant in order to check at the compile time whether the IRI
refers to a graph or a graph group. In first case it can make security
checks at the compile time (i.e., once) and not waste time at the run
time. In second case, a compile-time check, a run-time check or 50/50
mix of them can be performed, depending on the security policies.
FROM without constant would mean that security rules, if they present in
the storage, are used at the run time, for every triple that matches
every triple pattern in the default graph. This issue can be reproduced
if FROM is not specified at all: if security differs from default then
the effect is noticeably bad.
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com