incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Adamou <ada...@cs.unibo.it>
Subject SPARQL path query with JenaSparqlEngine
Date Tue, 31 Jan 2012 11:12:12 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message