incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hasan Hasan <ha...@trialox.org>
Subject Re: SPARQL path query with JenaSparqlEngine
Date Mon, 06 Feb 2012 12:51:54 GMT
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 <adamou@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
>
>

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