Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARQInternalErrorException during query execution in Jena 4.10.0 #2153

Closed
afs opened this issue Jan 5, 2024 Discussed in #2150 · 2 comments
Closed

ARQInternalErrorException during query execution in Jena 4.10.0 #2153

afs opened this issue Jan 5, 2024 Discussed in #2150 · 2 comments
Labels

Comments

@afs
Copy link
Member

afs commented Jan 5, 2024

Discussed in #2150

Originally posted by kishand261194 January 4, 2024
Hi all,

We are attempting to upgrade from Jena 3.5 to Jena 4.10.0.
We are using “RDFConnection.connect(TDBFactory.createDataset());” for unit tests.
The below query works totally fine in Jena 3.5 but fails with the following exception in Jena 4.10.0.
I have confirmed that the query is correct and works totally fine in Neptune RDF as well. Can someone please help us on how to go about this ? or please suggest if the query needs to updated to something else for jena 4.10.0.
I have also attached the code sample to reproduce the issue.

Query :

INSERT {
      GRAPH <http://knowledge-store-test.com/b4a77401-9233-4115-b9db-dcbed33d73e2> {
        <rdf:s1> <rdf:p1> "o1" .
      }
    }
    WHERE
      { GRAPH <http://knowledge-store-test.com/b4a77401-9233-4115-b9db-dcbed33d73e2>
          { <rdf:s2>  <rdf:p2>  <rdf:o2>}
        GRAPH <http://knowledge-store-test.com/8bfa2a32-f95e-476f-99e9-84b355bed6a2>
          { FILTER NOT EXISTS { <rdf:s3>  <rdf:p3>  "o3" }}
      }

Error :

org.apache.jena.sparql.ARQInternalErrorException: compile(Element)/Not a structural element: ElementFilter
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.broken(AlgebraGenerator.java:577)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileUnknownElement(AlgebraGenerator.java:170)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileElement(AlgebraGenerator.java:156)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileElementGraph(AlgebraGenerator.java:426)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileElement(AlgebraGenerator.java:133)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileOneInGroup(AlgebraGenerator.java:319)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileElementGroup(AlgebraGenerator.java:202)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compileElement(AlgebraGenerator.java:127)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compile(AlgebraGenerator.java:113)
    at app//org.apache.jena.sparql.algebra.AlgebraGenerator.compile(AlgebraGenerator.java:100)
    at app//org.apache.jena.sparql.algebra.Algebra.compile(Algebra.java:73)
    at app//org.apache.jena.sparql.engine.QueryEngineBase.createOp(QueryEngineBase.java:140)
    at app//org.apache.jena.sparql.engine.QueryEngineBase.<init>(QueryEngineBase.java:57)
    at app//org.apache.jena.sparql.engine.main.QueryEngineMain.<init>(QueryEngineMain.java:45)
    at app//org.apache.jena.tdb.solver.QueryEngineTDB.<init>(QueryEngineTDB.java:63)
    at app//org.apache.jena.tdb.solver.QueryEngineTDB$QueryEngineFactoryTDB.create(QueryEngineTDB.java:135)
    at app//org.apache.jena.query.QueryExecutionFactory.makePlan(QueryExecutionFactory.java:442)
    at app//org.apache.jena.query.QueryExecutionFactory.createPlan(QueryExecutionFactory.java:418)
    at app//org.apache.jena.sparql.modify.UpdateEngineWorker.evalBindings(UpdateEngineWorker.java:532)
    at app//org.apache.jena.sparql.modify.UpdateEngineWorker.visit(UpdateEngineWorker.java:371)
    at app//org.apache.jena.sparql.modify.request.UpdateModify.visit(UpdateModify.java:100)
    at app//org.apache.jena.sparql.modify.UpdateVisitorSink.send(UpdateVisitorSink.java:45)
    at app//org.apache.jena.sparql.modify.UpdateVisitorSink.send(UpdateVisitorSink.java:31)
    at [java.base@17.0.9](mailto:java.base@17.0.9)/java.util.ArrayList$Itr.forEachRemaining(ArrayList.java:1003)
    at [java.base@17.0.9](mailto:java.base@17.0.9)/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1061)
    at app//org.apache.jena.atlas.iterator.Iter.sendToSink(Iter.java:776)
    at app//org.apache.jena.sparql.modify.UpdateProcessorBase.execute(UpdateProcessorBase.java:60)
    at app//org.apache.jena.sparql.exec.UpdateExecDataset.execute(UpdateExecDataset.java:37)
    at app//org.apache.jena.sparql.exec.UpdateExecDatasetBuilder.execute(UpdateExecDatasetBuilder.java:164)
    at app//org.apache.jena.sparql.exec.UpdateExecDatasetBuilder.execute(UpdateExecDatasetBuilder.java:169)
    at app//org.apache.jena.rdflink.RDFLinkDataset.lambda$update$1(RDFLinkDataset.java:107)
    at app//org.apache.jena.system.Txn.exec(Txn.java:77)
    at app//org.apache.jena.system.Txn.executeWrite(Txn.java:125)
    at app//org.apache.jena.rdflink.RDFLinkDataset.update(RDFLinkDataset.java:107)
    at app//org.apache.jena.rdflink.RDFConnectionAdapter.update(RDFConnectionAdapter.java:131)
    at org.apache.jena.rdfconnection.RDFConnection$update$0.call(Unknown Source)
    at app//org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at app//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at app//org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
    at app//com.pk.knowledgestore.rdf.graph.store.RdfQuadStoreSparqlTest.update(RdfQuadStoreSparqlTest.groovy:115)
    at com.pk.knowledgestore.rdf.graph.store.RdfQuadStoreSparqlTest$update.callCurrent(Unknown Source)
    at app//org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
    at app//org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
    at app//org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
    at app//com.amazon.pk.knowledgestore.rdf.graph.store.RdfQuadStoreSparqlTest.testQueryFailure(RdfQuadStoreSparqlTest.groovy:108)

Code to repro the issue :

private final Triple triple1 = new Triple(
       createURI("rdf:s1"),
       createURI("rdf:p1"),
       createLiteral("o1"))
private final Triple triple2 = new Triple(
       createURI("rdf:s2"),
       createURI("rdf:p2"),
       createURI("rdf:o2"))
private final Triple triple3 = new Triple(
       createURI("rdf:s3"),
       createURI("rdf:p3"),
       createLiteral("o3"))

private final graph1 = getNamedGraph()
private final graph2 = getNamedGraph()

@Test
void testQueryFailure() {

   RDFConnection conn = RDFConnection.connect(TDBFactory.createDataset());

   UpdateBuilder updateBuilder = new UpdateBuilder();
   updateBuilder.addInsert(graph1, triple1);

   SelectBuilder where = new SelectBuilder();
   where.addWhere(triple2);
   updateBuilder.addGraph(graph1, where);


   SelectBuilder notExists = new SelectBuilder();
   notExists.addWhere(triple3);
   SelectBuilder where2 = new SelectBuilder();
   where2.addFilter(where2.getExprFactory().notexists(notExists));
   updateBuilder.addGraph(graph2, where2);

   UpdateRequest updateRequest = updateBuilder.buildRequest();

   System.out.println("From the tests : " + updateRequest.toString())

   update(conn, updateRequest);
}

public void update(final RDFConnection conn, final UpdateRequest request) {
   conn.begin(ReadWrite.WRITE);
   try {
       conn.update(request);
       conn.commit();
   } finally {
       conn.end();
   }
}
@afs
Copy link
Member Author

afs commented Jan 5, 2024

There are two sub-issues here:

@afs afs changed the title ARQInternalErrorException during query execution in Jena 4.10.0 while using TDB ARQInternalErrorException during query execution in Jena 4.10.0 Jan 5, 2024
afs added a commit to afs/jena that referenced this issue Jan 5, 2024
afs added a commit to afs/jena that referenced this issue Jan 5, 2024
afs added a commit to afs/jena that referenced this issue Jan 6, 2024
afs added a commit to afs/jena that referenced this issue Jan 8, 2024
afs added a commit to afs/jena that referenced this issue Jan 8, 2024
@afs afs closed this as completed Jan 14, 2024
cnanjo pushed a commit to fhircat/jena that referenced this issue Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant