You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Alessandro Adamou <ad...@cs.unibo.it> on 2012/01/31 12:12:12 UTC

SPARQL path query with JenaSparqlEngine

Hi, I tried to execute this query - path of length 2 - on a partial dump 
of Revyu, using a JenaSparqlEngine registered with QueryParser:

SELECT  ?r0 ?x0  ?r1
WHERE {
<http://semanticweb.org/dumps/people/teddypolar> ?r0 ?x0 .
  ?x0 ?r1 
<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
}

and got the RuntimeException whose partial trace is attached at the end 
of this message:

java.lang.RuntimeException: cannot convert 
"dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" to NonLiteral

Indeed it is because the value 
"dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" (for ?x0) is an untyped 
literal, so no paths con be constructed there. Still I hoped datatype 
and annotation assertions would be skipped instead of throwing exceptions.

So I thought I could just make the second step in the path OPTIONAL  - 
after all I need shorter paths too - like this:

SELECT  ?r0 ?x0  ?r1
WHERE {
<http://semanticweb.org/dumps/people/teddypolar> ?r0 ?x0
OPTIONAL {
  ?x0 ?r1 
<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
}
}

... but I just get the same exception.

This very same query (with OPTIONAL) on other SPARQL engines, such as 
the TopBraid Composer one, terminates and delivers the expected results.

Is there a clue as to how this query can be executed "safely", without 
forcing conversion of literals?

Thanks!

Alessandro


------- EXCEPTION TRACE FOLLOWS --------

java.lang.RuntimeException: cannot convert 
"dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" to NonLiteral
         at 
org.apache.clerezza.rdf.jena.commons.Jena2TriaUtil.convertNonLiteral(Jena2TriaUtil.java:127)
         at 
org.apache.clerezza.rdf.jena.facade.JenaGraph.filter(JenaGraph.java:123)
         at 
org.apache.clerezza.rdf.jena.facade.JenaGraph.graphBaseFind(JenaGraph.java:151)
         at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:240)
         at 
com.hp.hpl.jena.graph.impl.GraphBase.graphBaseFind(GraphBase.java:260)
         at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:257)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern$TripleMapper.<init>(QueryIterTriplePattern.java:67)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern.nextStage(QueryIterTriplePattern.java:41)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:91)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:52)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterBlockTriples.hasNextBinding(QueryIterBlockTriples.java:53)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterDefaulting.hasNextBinding(QueryIterDefaulting.java:43)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:57)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:49)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:28)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:28)
         at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
         at 
com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:57)
         at 
org.apache.clerezza.rdf.jena.sparql.ResultSetWrapper.<init>(ResultSetWrapper.java:39)
         at 
org.apache.clerezza.rdf.jena.sparql.JenaSparqlEngine.execute(JenaSparqlEngine.java:68)
         at 
org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcManager.java:272)



-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their 
timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)

Not sent from my iSnobTechDevice


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)

Not sent from my iSnobTechDevice


Re: SPARQL path query with JenaSparqlEngine

Posted by Alessandro Adamou <ad...@cs.unibo.it>.
Dear Hasan,

On 2/6/12 1:51 PM, Hasan Hasan wrote:
> I think the problem is that the engine tries to find triples where the
> subject is a Literal and it cannot convert the literal matched in the first
> pattern to a NonLiteral. According to RDF specification [1], a subject can
> only be a NonLiteral.

I know that. The problem is that I would expect an engine to just 
discard that triple, stop trying to build results on top of that 
Resource and proceed with other triples, rather than just fail on the 
whole query.

But perhaps I made a wrong assumption where in fact SPARQL is not 
supposed to be fail-safe on this type of queries?

> Maybe exchanging the sequence of the pattern can help (not sure):
>
> SELECT  ?r0 ?x0  ?r1
> WHERE {
>    ?x0 ?r1<
> http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>  .
> <http://semanticweb.org/dumps/people/teddypolar>  ?r0 ?x0 .
> }

I will try out your suggestion, but the thing is: if my query works, I 
was planning to build a union query with backward paths too...

All the best,

Alessandro


> On Tue, Jan 31, 2012 at 12:12 PM, Alessandro Adamou<ad...@cs.unibo.it>wrote:
>
>> Hi, I tried to execute this query - path of length 2 - on a partial dump
>> of Revyu, using a JenaSparqlEngine registered with QueryParser:
>>
>> SELECT  ?r0 ?x0  ?r1
>> WHERE {
>> <http://semanticweb.org/dumps/**people/teddypolar<http://semanticweb.org/dumps/people/teddypolar>>
>> ?r0 ?x0 .
>>   ?x0 ?r1<http://semanticweb.org/dumps/**things/alcazar-food-fun-and-**
>> music-in-paris<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
>> }
>>
>> and got the RuntimeException whose partial trace is attached at the end of
>> this message:
>>
>> java.lang.RuntimeException: cannot convert "**
>> dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449" to NonLiteral
>>
>> Indeed it is because the value "**dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449"
>> (for ?x0) is an untyped literal, so no paths con be constructed there.
>> Still I hoped datatype and annotation assertions would be skipped instead
>> of throwing exceptions.
>>
>> So I thought I could just make the second step in the path OPTIONAL  -
>> after all I need shorter paths too - like this:
>>
>> SELECT  ?r0 ?x0  ?r1
>> WHERE {
>> <http://semanticweb.org/dumps/**people/teddypolar<http://semanticweb.org/dumps/people/teddypolar>>
>> ?r0 ?x0
>> OPTIONAL {
>>   ?x0 ?r1<http://semanticweb.org/dumps/**things/alcazar-food-fun-and-**
>> music-in-paris<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
>> }
>> }
>>
>> ... but I just get the same exception.
>>
>> This very same query (with OPTIONAL) on other SPARQL engines, such as the
>> TopBraid Composer one, terminates and delivers the expected results.
>>
>> Is there a clue as to how this query can be executed "safely", without
>> forcing conversion of literals?
>>
>> Thanks!
>>
>> Alessandro
>>
>>
>> ------- EXCEPTION TRACE FOLLOWS --------
>>
>> java.lang.RuntimeException: cannot convert "**
>> dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449" to NonLiteral
>>         at org.apache.clerezza.rdf.jena.**commons.Jena2TriaUtil.**
>> convertNonLiteral(**Jena2TriaUtil.java:127)
>>         at org.apache.clerezza.rdf.jena.**facade.JenaGraph.filter(**
>> JenaGraph.java:123)
>>         at org.apache.clerezza.rdf.jena.**facade.JenaGraph.**
>> graphBaseFind(JenaGraph.java:**151)
>>         at com.hp.hpl.jena.graph.impl.**GraphBase.find(GraphBase.java:**
>> 240)
>>         at com.hp.hpl.jena.graph.impl.**GraphBase.graphBaseFind(**
>> GraphBase.java:260)
>>         at com.hp.hpl.jena.graph.impl.**GraphBase.find(GraphBase.java:**
>> 257)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.**
>> QueryIterTriplePattern$**TripleMapper.<init>(**
>> QueryIterTriplePattern.java:**67)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.**
>> QueryIterTriplePattern.**nextStage(**QueryIterTriplePattern.java:**41)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
>> makeNextStage(**QueryIterRepeatApply.java:91)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
>> hasNextBinding(**QueryIterRepeatApply.java:52)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.**
>> QueryIterBlockTriples.**hasNextBinding(**QueryIterBlockTriples.java:53)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterDefaulting.**
>> hasNextBinding(**QueryIterDefaulting.java:43)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
>> hasNextBinding(**QueryIterRepeatApply.java:57)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterConvert.**
>> hasNextBinding(**QueryIterConvert.java:49)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorWrapper.**
>> hasNextBinding(**QueryIteratorWrapper.java:28)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorWrapper.**
>> hasNextBinding(**QueryIteratorWrapper.java:28)
>>         at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
>> hasNext(QueryIteratorBase.**java:66)
>>         at com.hp.hpl.jena.sparql.engine.**ResultSetStream.hasNext(**
>> ResultSetStream.java:57)
>>         at org.apache.clerezza.rdf.jena.**sparql.ResultSetWrapper.<init>**
>> (ResultSetWrapper.java:39)
>>         at org.apache.clerezza.rdf.jena.**sparql.JenaSparqlEngine.**
>> execute(JenaSparqlEngine.java:**68)
>>         at org.apache.clerezza.rdf.core.**access.TcManager.**
>> executeSparqlQuery(TcManager.**java:272)
>>
>>
>>
>> --
>> M.Sc. Alessandro Adamou
>>
>> Alma Mater Studiorum - Università di Bologna
>> Department of Computer Science
>> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>>
>> Semantic Technology Laboratory (STLab)
>> Institute for Cognitive Science and Technology (ISTC)
>> National Research Council (CNR)
>> Via Nomentana 56, 00161 Rome - Italy
>>
>>
>> "As for the charges against me, I am unconcerned. I am beyond their timid,
>> lying morality, and so I am beyond caring."
>> (Col. Walter E. Kurtz)
>>
>> Not sent from my iSnobTechDevice
>>
>>
>> --
>> M.Sc. Alessandro Adamou
>>
>> Alma Mater Studiorum - Università di Bologna
>> Department of Computer Science
>> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>>
>> Semantic Technology Laboratory (STLab)
>> Institute for Cognitive Science and Technology (ISTC)
>> National Research Council (CNR)
>> Via Nomentana 56, 00161 Rome - Italy
>>
>>
>> "As for the charges against me, I am unconcerned. I am beyond their timid,
>> lying morality, and so I am beyond caring."
>> (Col. Walter E. Kurtz)
>>
>> Not sent from my iSnobTechDevice
>>
>>


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)

Not sent from my iSnobTechDevice


Re: SPARQL path query with JenaSparqlEngine

Posted by Hasan Hasan <ha...@trialox.org>.
Dear Alessandro

I think the problem is that the engine tries to find triples where the
subject is a Literal and it cannot convert the literal matched in the first
pattern to a NonLiteral. According to RDF specification [1], a subject can
only be a NonLiteral.
Maybe exchanging the sequence of the pattern can help (not sure):

SELECT  ?r0 ?x0  ?r1
WHERE {
  ?x0 ?r1 <
http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris> .
<http://semanticweb.org/dumps/people/teddypolar> ?r0 ?x0 .
}

Regards
Hasan

[1] http://www.w3.org/TR/rdf-concepts/#dfn-subject

On Tue, Jan 31, 2012 at 12:12 PM, Alessandro Adamou <ad...@cs.unibo.it>wrote:

> Hi, I tried to execute this query - path of length 2 - on a partial dump
> of Revyu, using a JenaSparqlEngine registered with QueryParser:
>
> SELECT  ?r0 ?x0  ?r1
> WHERE {
> <http://semanticweb.org/dumps/**people/teddypolar<http://semanticweb.org/dumps/people/teddypolar>>
> ?r0 ?x0 .
>  ?x0 ?r1 <http://semanticweb.org/dumps/**things/alcazar-food-fun-and-**
> music-in-paris<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
> >
> }
>
> and got the RuntimeException whose partial trace is attached at the end of
> this message:
>
> java.lang.RuntimeException: cannot convert "**
> dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449" to NonLiteral
>
> Indeed it is because the value "**dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449"
> (for ?x0) is an untyped literal, so no paths con be constructed there.
> Still I hoped datatype and annotation assertions would be skipped instead
> of throwing exceptions.
>
> So I thought I could just make the second step in the path OPTIONAL  -
> after all I need shorter paths too - like this:
>
> SELECT  ?r0 ?x0  ?r1
> WHERE {
> <http://semanticweb.org/dumps/**people/teddypolar<http://semanticweb.org/dumps/people/teddypolar>>
> ?r0 ?x0
> OPTIONAL {
>  ?x0 ?r1 <http://semanticweb.org/dumps/**things/alcazar-food-fun-and-**
> music-in-paris<http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
> >
> }
> }
>
> ... but I just get the same exception.
>
> This very same query (with OPTIONAL) on other SPARQL engines, such as the
> TopBraid Composer one, terminates and delivers the expected results.
>
> Is there a clue as to how this query can be executed "safely", without
> forcing conversion of literals?
>
> Thanks!
>
> Alessandro
>
>
> ------- EXCEPTION TRACE FOLLOWS --------
>
> java.lang.RuntimeException: cannot convert "**
> dcc31c09026e5a3aee0b63cb44a07f**f8a76d1449" to NonLiteral
>        at org.apache.clerezza.rdf.jena.**commons.Jena2TriaUtil.**
> convertNonLiteral(**Jena2TriaUtil.java:127)
>        at org.apache.clerezza.rdf.jena.**facade.JenaGraph.filter(**
> JenaGraph.java:123)
>        at org.apache.clerezza.rdf.jena.**facade.JenaGraph.**
> graphBaseFind(JenaGraph.java:**151)
>        at com.hp.hpl.jena.graph.impl.**GraphBase.find(GraphBase.java:**
> 240)
>        at com.hp.hpl.jena.graph.impl.**GraphBase.graphBaseFind(**
> GraphBase.java:260)
>        at com.hp.hpl.jena.graph.impl.**GraphBase.find(GraphBase.java:**
> 257)
>        at com.hp.hpl.jena.sparql.engine.**iterator.**
> QueryIterTriplePattern$**TripleMapper.<init>(**
> QueryIterTriplePattern.java:**67)
>        at com.hp.hpl.jena.sparql.engine.**iterator.**
> QueryIterTriplePattern.**nextStage(**QueryIterTriplePattern.java:**41)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
> makeNextStage(**QueryIterRepeatApply.java:91)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
> hasNextBinding(**QueryIterRepeatApply.java:52)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.**
> QueryIterBlockTriples.**hasNextBinding(**QueryIterBlockTriples.java:53)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterDefaulting.**
> hasNextBinding(**QueryIterDefaulting.java:43)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterRepeatApply.**
> hasNextBinding(**QueryIterRepeatApply.java:57)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIterConvert.**
> hasNextBinding(**QueryIterConvert.java:49)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorWrapper.**
> hasNextBinding(**QueryIteratorWrapper.java:28)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorWrapper.**
> hasNextBinding(**QueryIteratorWrapper.java:28)
>        at com.hp.hpl.jena.sparql.engine.**iterator.QueryIteratorBase.**
> hasNext(QueryIteratorBase.**java:66)
>        at com.hp.hpl.jena.sparql.engine.**ResultSetStream.hasNext(**
> ResultSetStream.java:57)
>        at org.apache.clerezza.rdf.jena.**sparql.ResultSetWrapper.<init>**
> (ResultSetWrapper.java:39)
>        at org.apache.clerezza.rdf.jena.**sparql.JenaSparqlEngine.**
> execute(JenaSparqlEngine.java:**68)
>        at org.apache.clerezza.rdf.core.**access.TcManager.**
> executeSparqlQuery(TcManager.**java:272)
>
>
>
> --
> M.Sc. Alessandro Adamou
>
> Alma Mater Studiorum - Università di Bologna
> Department of Computer Science
> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, 00161 Rome - Italy
>
>
> "As for the charges against me, I am unconcerned. I am beyond their timid,
> lying morality, and so I am beyond caring."
> (Col. Walter E. Kurtz)
>
> Not sent from my iSnobTechDevice
>
>
> --
> M.Sc. Alessandro Adamou
>
> Alma Mater Studiorum - Università di Bologna
> Department of Computer Science
> Mura Anteo Zamboni 7, 40127 Bologna - Italy
>
> Semantic Technology Laboratory (STLab)
> Institute for Cognitive Science and Technology (ISTC)
> National Research Council (CNR)
> Via Nomentana 56, 00161 Rome - Italy
>
>
> "As for the charges against me, I am unconcerned. I am beyond their timid,
> lying morality, and so I am beyond caring."
> (Col. Walter E. Kurtz)
>
> Not sent from my iSnobTechDevice
>
>

Re: SPARQL path query with JenaSparqlEngine

Posted by Alessandro Adamou <ad...@cs.unibo.it>.
Hi,

perhaps some more information is needed in order to understand why I'm 
getting this?

I don't know if it can be useful to check the actual dataset: it's a 
partial dataset obtained by querying the Revyu SPARQL endpoint

Best,
Alessandro


On 1/31/12 12:12 PM, Alessandro Adamou wrote:
> Hi, I tried to execute this query - path of length 2 - on a partial 
> dump of Revyu, using a JenaSparqlEngine registered with QueryParser:
>
> SELECT  ?r0 ?x0  ?r1
> WHERE {
> <http://semanticweb.org/dumps/people/teddypolar> ?r0 ?x0 .
>  ?x0 ?r1 
> <http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
> }
>
> and got the RuntimeException whose partial trace is attached at the 
> end of this message:
>
> java.lang.RuntimeException: cannot convert 
> "dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" to NonLiteral
>
> Indeed it is because the value 
> "dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" (for ?x0) is an untyped 
> literal, so no paths con be constructed there. Still I hoped datatype 
> and annotation assertions would be skipped instead of throwing 
> exceptions.
>
> So I thought I could just make the second step in the path OPTIONAL  - 
> after all I need shorter paths too - like this:
>
> SELECT  ?r0 ?x0  ?r1
> WHERE {
> <http://semanticweb.org/dumps/people/teddypolar> ?r0 ?x0
> OPTIONAL {
>  ?x0 ?r1 
> <http://semanticweb.org/dumps/things/alcazar-food-fun-and-music-in-paris>
> }
> }
>
> ... but I just get the same exception.
>
> This very same query (with OPTIONAL) on other SPARQL engines, such as 
> the TopBraid Composer one, terminates and delivers the expected results.
>
> Is there a clue as to how this query can be executed "safely", without 
> forcing conversion of literals?
>
> Thanks!
>
> Alessandro
>
>
> ------- EXCEPTION TRACE FOLLOWS --------
>
> java.lang.RuntimeException: cannot convert 
> "dcc31c09026e5a3aee0b63cb44a07ff8a76d1449" to NonLiteral
>         at 
> org.apache.clerezza.rdf.jena.commons.Jena2TriaUtil.convertNonLiteral(Jena2TriaUtil.java:127)
>         at 
> org.apache.clerezza.rdf.jena.facade.JenaGraph.filter(JenaGraph.java:123)
>         at 
> org.apache.clerezza.rdf.jena.facade.JenaGraph.graphBaseFind(JenaGraph.java:151)
>         at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:240)
>         at 
> com.hp.hpl.jena.graph.impl.GraphBase.graphBaseFind(GraphBase.java:260)
>         at com.hp.hpl.jena.graph.impl.GraphBase.find(GraphBase.java:257)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern$TripleMapper.<init>(QueryIterTriplePattern.java:67)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterTriplePattern.nextStage(QueryIterTriplePattern.java:41)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:91)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:52)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterBlockTriples.hasNextBinding(QueryIterBlockTriples.java:53)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterDefaulting.hasNextBinding(QueryIterDefaulting.java:43)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:57)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:49)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:28)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:28)
>         at 
> com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:66)
>         at 
> com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:57)
>         at 
> org.apache.clerezza.rdf.jena.sparql.ResultSetWrapper.<init>(ResultSetWrapper.java:39)
>         at 
> org.apache.clerezza.rdf.jena.sparql.JenaSparqlEngine.execute(JenaSparqlEngine.java:68)
>         at 
> org.apache.clerezza.rdf.core.access.TcManager.executeSparqlQuery(TcManager.java:272)
>
>
>


-- 
M.Sc. Alessandro Adamou

Alma Mater Studiorum - Università di Bologna
Department of Computer Science
Mura Anteo Zamboni 7, 40127 Bologna - Italy

Semantic Technology Laboratory (STLab)
Institute for Cognitive Science and Technology (ISTC)
National Research Council (CNR)
Via Nomentana 56, 00161 Rome - Italy


"As for the charges against me, I am unconcerned. I am beyond their timid, lying morality, and so I am beyond caring."
(Col. Walter E. Kurtz)

Not sent from my iSnobTechDevice