Query execution fails in Jena

3 views
Skip to first unread message

timmy....@gmail.com

unread,
Jun 15, 2015, 9:52:38 AM6/15/15
to sta...@clarkparsia.com
Hi,

I'm trying to execute the following (simplified) query via Jena, but it fails. It works fine in the admin console though, so the problem seems to be in the Jena layer.

PREFIX : <http://www.semanticweb.org/dummy#>
SELECT
(<_:bnode__...> as ?s) ?a ?b ?c
FROM
<http://a.named.gaph>
WHERE
{  
   
<_:bnode__...> a :Something; :pred_a ?a ; :pred_b ?b .
 OPTIONAL
{ <_:bnode__...> :pred_c ?c }    
}

The exception:

com.hp.hpl.jena.sparql.ARQException: com.complexible.stardog.StardogException: Encountered " <BLANK_NODE_LABEL> "_:b0 "" at line 3, column 10.

When I leave the subject section out of the SELECT clause, it fails with a different exception.

So

PREFIX : <http://www.semanticweb.org/dummy#>
SELECT
?a ?b ?c
FROM
<http://a.named.graph>
WHERE
{  
   
<_:bnode__...> a :Something; :pred_a ?a ; :pred_b ?b .
 OPTIONAL
{ <_:bnode__...> :pred_c ?c }    
}

returns

com.complexible.common.rdf.query.parser.sparql.ast.VisitorException: BNodeID already used in another scope: b0

I'd appreciate some feedback. Thanks.

Michael Grove

unread,
Jun 17, 2015, 7:18:13 AM6/17/15
to stardog
Can you provide the actual query that fails to parse?

Cheers,

Mike
 

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Evren Sirin

unread,
Jun 17, 2015, 10:45:02 PM6/17/15
to Stardog
The <_:bnode> syntax is non-standard and is not supported through the
Jena interface of Stardog. The main reason for this is when you call
`Query.create(String).toString()` in Jena, the special bnode in the
query string turns into a regular bnode in the output string. There
are various restrictions for regular bnodes in SPARQL which causes the
errors you see.

The workaround would be to use a variable in the query and then a
filter like this:

FILTER (STR(?s) = "bnode__...")

Note that, there is no preceding "_:" when STR is applied to a bnode in Stardog.

Best,
Evren
Reply all
Reply to author
Forward
0 new messages