You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Reto Bachmann-Gmür <re...@apache.org> on 2013/12/03 13:27:17 UTC
FROM clause ignored by QueryExceutionFactory
Hello
Encountered an issue in clerezza of which the root cause seems to be in
Jena so forearding this here. The code is using jena-core and -arq version
2.11.
qexec = QueryExecutionFactory.create("SELECT *
FROM <urn:x-foo:bar>
WHERE { ?s ?p ?o }", dataset);
qexec.execSelect();
It seems to me that for this query the default graph in the dataset should
be ignored and instead a graph <urn:x-foo:bar> be looked up. However it
seems that only the default graph which is accessed via
dataset.asDatasetGraph().getDefaultGraph() is used.
Is there some special setting to have the FROM clause used?
Cheers,
Reto
---------- Forwarded message ----------
From: Reto Bachmann-Gmür <re...@apache.org>
Date: Tue, Dec 3, 2013 at 1:05 PM
Subject: Jena based SPARQL QueryEngine: FROM claused ignored
To: dev@clerezza.apache.org
Hello,
I've been investigating the issue that the FROM-clause is ignored and I've
opened CLEREZZA-846.
The query is passed including its from clause to
QueryExecutionFactory.create(Query, dataset), however only the default
graph is accessed in the underlying dataset.
So the FROM in
SELECT *
FROM <urn:x-localinstance:/graph-access.graph>
WHERE { ?s ?p ?o }
seems to be just ignored. Any ideas?
Cheers,
Reto
Re: FROM clause ignored by QueryExceutionFactory
Posted by Reto Bachmann-Gmür <re...@wymiwyg.com>.
On Wed, Dec 4, 2013 at 9:31 PM, Andy Seaborne <an...@apache.org> wrote:
> On 03/12/13 21:22, Reto Bachmann-Gmür wrote:
>
>> On Dec 3, 2013 7:44 PM, "Andy Seaborne" <an...@apache.org> wrote:
>>
>>>
>>> On 03/12/13 12:57, Reto Bachmann-Gmür wrote:
>>>
>>>>
>>>> Hi Andy,
>>>>
>>>>
>>>> On Tue, Dec 3, 2013 at 1:42 PM, Andy Seaborne <an...@apache.org> wrote:
>>>>
>>>> On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
>>>>>
>>>>> Hello
>>>>>>
>>>>>> Encountered an issue in clerezza of which the root cause seems to be
>>>>>> in
>>>>>> Jena so forearding this here. The code is using jena-core and -arq
>>>>>>
>>>>> version
>>
>>> 2.11.
>>>>>>
>>>>>>
>>>>> Work for me (using TDB which, from the way the question is asked is
>>>>> what
>>>>> you are doing else the thing is meaning less as it will deref
>>>>> <urn:x-foo:bar>).
>>>>>
>>>>>
>>>> Not using TDB just giving it what seems to be a minimalistic
>>>>
>>> implementation
>>
>>> of Dataset (TcDataset wrapping clerezza TcManager):
>>>>
>>>
>>>
>>> QueryExecutionFactory.create(, ds)
>>>
>>> will use ds as the dataset regardless. The main query engine will http
>>>
>> GET any FROM if you use QueryExecutionFactory.create(query)
>>
>> Not sure I understand. So the above call with ds should use the dataset
>> as
>> its universe? or should it use the web and ignore froms with non-http
>> uris?
>>
>
> An explicitly given dataset overrides the dataset description in the query
> when using the general query engine.
>
> The universe is not changed. The general query engine does not do what
> you want in a single line.
>
> See
> DatasetDescription
> DynamicDatasets
>
> to create a dataset and then use that to query.
>
This:
DatasetDescription dd = DatasetDescription.create(jenaQuery);
Dataset dynaDataset = DynamicDatasets.dynamicDataset(dd, dataset, false);
QueryExecution qexec = QueryExecutionFactory.create(jenaQuery, dynaDataset);
Seems to work!
Great, thanks a lot Andy.
(not sure how dynaDataset differs from dataset, but a live with this
ignorance ;) )
Reto
>
> These are used by TDB's query engine internally, but not the general one.
>
> Andy
>
>
Re: FROM clause ignored by QueryExceutionFactory
Posted by Andy Seaborne <an...@apache.org>.
On 03/12/13 21:22, Reto Bachmann-Gmür wrote:
> On Dec 3, 2013 7:44 PM, "Andy Seaborne" <an...@apache.org> wrote:
>>
>> On 03/12/13 12:57, Reto Bachmann-Gmür wrote:
>>>
>>> Hi Andy,
>>>
>>>
>>> On Tue, Dec 3, 2013 at 1:42 PM, Andy Seaborne <an...@apache.org> wrote:
>>>
>>>> On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
>>>>
>>>>> Hello
>>>>>
>>>>> Encountered an issue in clerezza of which the root cause seems to be in
>>>>> Jena so forearding this here. The code is using jena-core and -arq
> version
>>>>> 2.11.
>>>>>
>>>>
>>>> Work for me (using TDB which, from the way the question is asked is what
>>>> you are doing else the thing is meaning less as it will deref
>>>> <urn:x-foo:bar>).
>>>>
>>>
>>> Not using TDB just giving it what seems to be a minimalistic
> implementation
>>> of Dataset (TcDataset wrapping clerezza TcManager):
>>
>>
>> QueryExecutionFactory.create(, ds)
>>
>> will use ds as the dataset regardless. The main query engine will http
> GET any FROM if you use QueryExecutionFactory.create(query)
>
> Not sure I understand. So the above call with ds should use the dataset as
> its universe? or should it use the web and ignore froms with non-http uris?
An explicitly given dataset overrides the dataset description in the
query when using the general query engine.
The universe is not changed. The general query engine does not do what
you want in a single line.
See
DatasetDescription
DynamicDatasets
to create a dataset and then use that to query.
These are used by TDB's query engine internally, but not the general one.
Andy
Re: FROM clause ignored by QueryExceutionFactory
Posted by Reto Bachmann-Gmür <re...@wymiwyg.com>.
On Dec 3, 2013 7:44 PM, "Andy Seaborne" <an...@apache.org> wrote:
>
> On 03/12/13 12:57, Reto Bachmann-Gmür wrote:
>>
>> Hi Andy,
>>
>>
>> On Tue, Dec 3, 2013 at 1:42 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>>> On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
>>>
>>>> Hello
>>>>
>>>> Encountered an issue in clerezza of which the root cause seems to be in
>>>> Jena so forearding this here. The code is using jena-core and -arq
version
>>>> 2.11.
>>>>
>>>
>>> Work for me (using TDB which, from the way the question is asked is what
>>> you are doing else the thing is meaning less as it will deref
>>> <urn:x-foo:bar>).
>>>
>>
>> Not using TDB just giving it what seems to be a minimalistic
implementation
>> of Dataset (TcDataset wrapping clerezza TcManager):
>
>
> QueryExecutionFactory.create(, ds)
>
> will use ds as the dataset regardless. The main query engine will http
GET any FROM if you use QueryExecutionFactory.create(query)
Not sure I understand. So the above call with ds should use the dataset as
its universe? or should it use the web and ignore froms with non-http uris?
Cheers,
Reto
Re: FROM clause ignored by QueryExceutionFactory
Posted by Reto Bachmann-Gmür <re...@wymiwyg.com>.
> The source of TcDataset:
>> https://git-wip-us.apache.org/repos/asf?p=clerezza.git;a=
>> blob;f=rdf.jena.sparql/src/main/java/org/apache/clerezza/
>> rdf/jena/sparql/TcDataset.java;h=48b70a3e6932bd4fa98397aa84ae50
>> 043bc4706f;hb=HEAD
>>
>>
> Use
> DatasetFactory.create(TcDatasetGraph)
> instead?
>
>
Nice simplification. Unfortunately doesn't change anything to the behavior:
The FROM clauses are just ignored, they are neither looked up the the
DatasetGraph no dereferenced on the Web.
Cheers,
Reto
Re: FROM clause ignored by QueryExceutionFactory
Posted by Andy Seaborne <an...@apache.org>.
On 03/12/13 12:57, Reto Bachmann-Gmür wrote:
> Hi Andy,
>
>
> On Tue, Dec 3, 2013 at 1:42 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
>>
>>> Hello
>>>
>>> Encountered an issue in clerezza of which the root cause seems to be in
>>> Jena so forearding this here. The code is using jena-core and -arq version
>>> 2.11.
>>>
>>
>> Work for me (using TDB which, from the way the question is asked is what
>> you are doing else the thing is meaning less as it will deref
>> <urn:x-foo:bar>).
>>
>
> Not using TDB just giving it what seems to be a minimalistic implementation
> of Dataset (TcDataset wrapping clerezza TcManager):
QueryExecutionFactory.create(, ds)
will use ds as the dataset regardless. The main query engine will http
GET any FROM if you use QueryExecutionFactory.create(query) and
otherwise supplying the dataset overrides the query.
TDB is different as documented:
http://jena.apache.org/documentation/tdb/dynamic_datasets.html
because it never reaches out to the web.
It might be possible to put the code from QueryEngineTDB into
QueryEngineMain if that does not disturb the existing behaviour.
See
DatasetDescription
DynamicDatasets
>
> The source of TcDataset:
> https://git-wip-us.apache.org/repos/asf?p=clerezza.git;a=blob;f=rdf.jena.sparql/src/main/java/org/apache/clerezza/rdf/jena/sparql/TcDataset.java;h=48b70a3e6932bd4fa98397aa84ae50043bc4706f;hb=HEAD
>
Use
DatasetFactory.create(TcDatasetGraph)
instead?
> The only method accessed are:
>
> DatasetGraph.getContext, DatasetGraph.getDefaultGraph and
> DataSet.getDefaultModel
>
> DatasetGraph.getContext return null.
>
> Cheers,
> Reto
>
Re: FROM clause ignored by QueryExceutionFactory
Posted by Reto Bachmann-Gmür <re...@wymiwyg.com>.
Hi Andy,
On Tue, Dec 3, 2013 at 1:42 PM, Andy Seaborne <an...@apache.org> wrote:
> On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
>
>> Hello
>>
>> Encountered an issue in clerezza of which the root cause seems to be in
>> Jena so forearding this here. The code is using jena-core and -arq version
>> 2.11.
>>
>
> Work for me (using TDB which, from the way the question is asked is what
> you are doing else the thing is meaning less as it will deref
> <urn:x-foo:bar>).
>
Not using TDB just giving it what seems to be a minimalistic implementation
of Dataset (TcDataset wrapping clerezza TcManager):
The source of TcDataset:
https://git-wip-us.apache.org/repos/asf?p=clerezza.git;a=blob;f=rdf.jena.sparql/src/main/java/org/apache/clerezza/rdf/jena/sparql/TcDataset.java;h=48b70a3e6932bd4fa98397aa84ae50043bc4706f;hb=HEAD
The only method accessed are:
DatasetGraph.getContext, DatasetGraph.getDefaultGraph and
DataSet.getDefaultModel
DatasetGraph.getContext return null.
Cheers,
Reto
Re: FROM clause ignored by QueryExceutionFactory
Posted by Andy Seaborne <an...@apache.org>.
On 03/12/13 12:27, Reto Bachmann-Gmür wrote:
> Hello
>
> Encountered an issue in clerezza of which the root cause seems to be in
> Jena so forearding this here. The code is using jena-core and -arq version
> 2.11.
Work for me (using TDB which, from the way the question is asked is what
you are doing else the thing is meaning less as it will deref
<urn:x-foo:bar>).
-------------- D.trig
prefix : <http://example/>
:s :p :o .
:g1 { :s1 :p1 :o1 }
:g2 { :s2 :p2 :o2 }
--------------
tdbloader --loc=DB D.trig
--------------
SELECT *
FROM <http://example/g1>
WHERE {
?s ?p ?o
}
--------------
-------------------------------------------------------------------
| s | p | o |
===================================================================
| <http://example/s1> | <http://example/p1> | <http://example/o1> |
-------------------------------------------------------------------
>
> qexec = QueryExecutionFactory.create("SELECT *
> FROM <urn:x-foo:bar>
> WHERE { ?s ?p ?o }", dataset);
what kind of dataset is 'dataset'? Is it wrapping anything?
> qexec.execSelect();
>
> It seems to me that for this query the default graph in the dataset should
> be ignored and instead a graph <urn:x-foo:bar> be looked up.
Yep.
> However it
> seems that only the default graph which is accessed via
> dataset.asDatasetGraph().getDefaultGraph() is used.
dataset.asDatasetGraph().getDefaultGraph()
will still be the storage default graph.
> Is there some special setting to have the FROM clause used?
No.
Andy
>
> Cheers,
> Reto
>
>
> ---------- Forwarded message ----------
> From: Reto Bachmann-Gmür <re...@apache.org>
> Date: Tue, Dec 3, 2013 at 1:05 PM
> Subject: Jena based SPARQL QueryEngine: FROM claused ignored
> To: dev@clerezza.apache.org
>
>
> Hello,
>
> I've been investigating the issue that the FROM-clause is ignored and I've
> opened CLEREZZA-846.
>
> The query is passed including its from clause to
> QueryExecutionFactory.create(Query, dataset), however only the default
> graph is accessed in the underlying dataset.
>
> So the FROM in
>
> SELECT *
> FROM <urn:x-localinstance:/graph-access.graph>
> WHERE { ?s ?p ?o }
>
> seems to be just ignored. Any ideas?
>
> Cheers,
> Reto
>