Project

General

Profile

Bug #152

Exception on not-well-formed OPTIONAL queries

Added by Paula Gearon over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Mulgara
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed

Description

The W3C test include the following:

Nested-optionals with a shared variable that does not appear in
the middle pattern (a not well-formed query pattern as per
"Semantics and Complexity" of SPARQL

The query is:

PREFIX : <http://example/>

SELECT *
{
 ?X  :name "paul" 
 {?Y :name "george" . OPTIONAL { ?X :email ?Z } }
}

There data is on the W3C site

On running this query we get:

org.mulgara.query.QueryException: Query failed
       at org.mulgara.resolver.DatabaseSession.execute(DatabaseSession.java:754)
       at org.mulgara.resolver.DatabaseSession.query(DatabaseSession.java:464)
       at org.openrdf.sail.mulgara.MulgaraTripleSource.evaluate(MulgaraTripleSource.java:111)
       at org.openrdf.sail.mulgara.MulgaraEvaluationStrategy.evaluate(MulgaraEvaluationStrategy.java:50)
       ... 27 more
Caused by: org.mulgara.query.MulgaraTransactionException: Transaction rollback triggered
       at org.mulgara.resolver.MulgaraInternalTransaction.implicitRollback(MulgaraInternalTransaction.java:516)
       at org.mulgara.resolver.MulgaraInternalTransaction.execute(MulgaraInternalTransaction.java:627)
       at org.mulgara.resolver.DatabaseSession.execute(DatabaseSession.java:751)
       ... 30 more
Caused by: org.mulgara.query.QueryException: Failed to resolve constraintExpression
       at org.mulgara.resolver.ConstraintOperations.resolveConstraintExpression(ConstraintOperations.java:197)
       at org.mulgara.resolver.LocalQueryResolver.resolveE(LocalQueryResolver.java:269)
       at org.mulgara.resolver.DatabaseOperationContext.doQuery(DatabaseOperationContext.java:786)
       at org.mulgara.resolver.QueryOperation.execute(QueryOperation.java:139)
       at org.mulgara.resolver.MulgaraInternalTransaction.execute(MulgaraInternalTransaction.java:623)
       ... 31 more
Caused by: org.mulgara.query.TuplesException: Bad [[LocalNode]] in constraint.  constraint.getElement(0) returned a [[LocalNode]] with value: 0 constraint=[gn0 gn1449 gn1481 gn1369]
       at org.mulgara.resolver.store.StatementStoreResolution.defineIndex(StatementStoreResolution.java:308)
       at org.mulgara.resolver.store.StatementStoreResolution.<init>(StatementStoreResolution.java:156)
       at org.mulgara.resolver.store.StatementStoreResolution.reresolve(StatementStoreResolution.java:371)
       at org.mulgara.store.tuples.TuplesOperations.resolveNewlyBoundFreeNames(TuplesOperations.java:563)
       at org.mulgara.store.tuples.TuplesOperations.unifyOperands(TuplesOperations.java:464)
       at org.mulgara.store.tuples.TuplesOperations.join(TuplesOperations.java:244)
       at org.mulgara.resolver.DefaultConstraintHandlers$5.resolve(DefaultConstraintHandlers.java:165)
       at org.mulgara.resolver.ConstraintOperations.resolveConstraintExpression(ConstraintOperations.java:187)
       ... 35 more

#1

Updated by Paula Gearon over 13 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

(In r1323) Found and fixed a pair of bugs when all variables are shared between two sides of an
optional join. Also updated optionalJoin to handle left and right sides not sharing
variables (a cartesian product), and now handling projection to extra variables when
the optional part of a join is empty.
Fixes #152
Fixes #150

Also available in: Atom PDF