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

TDB data source incompatible with new Jena #53

Open
smalyshev opened this issue Apr 9, 2019 · 5 comments
Open

TDB data source incompatible with new Jena #53

smalyshev opened this issue Apr 9, 2019 · 5 comments

Comments

@smalyshev
Copy link
Contributor

I tried to upgrade this package to Jena 3.10.0 (since 3.1.0 has dependencies which have some security issues) and I get Not in a transaction exceptions in tests, e.g.:

estEstimate(org.linkeddatafragments.test.datasource.JenaTDBDataSourceTest)  Time elapsed: 0.003 sec  <<< ERROR!
org.apache.jena.tdb.transaction.TDBTransactionException: Not in a transaction
	at org.apache.jena.tdb.transaction.DatasetGraphTransaction.get(DatasetGraphTransaction.java:140)
	at org.apache.jena.tdb.transaction.DatasetGraphTransaction.getDatasetGraphToQuery(DatasetGraphTransaction.java:86)
	at org.apache.jena.tdb.store.GraphTxnTDB.getDatasetGraphTDB(GraphTxnTDB.java:51)
	at org.apache.jena.tdb.store.GraphTDB.getNodeTupleTable(GraphTDB.java:89)
	at org.apache.jena.tdb.solver.SolverLib.execute(SolverLib.java:66)
	at org.apache.jena.tdb.solver.StageGeneratorDirectTDB.execute(StageGeneratorDirectTDB.java:56)
	at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:128)
	at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:58)
	at org.apache.jena.sparql.algebra.op.OpBGP.visit(OpBGP.java:49)
	at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
	at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:117)
	at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:376)
	at org.apache.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:323)
	at org.apache.jena.sparql.algebra.op.OpTopN.visit(OpTopN.java:50)
	at org.apache.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:46)
	at org.apache.jena.sparql.engine.main.OpExecutor.exec(OpExecutor.java:117)
	at org.apache.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:88)
	at org.apache.jena.sparql.engine.main.QC.execute(QC.java:52)
	at org.apache.jena.sparql.engine.main.QueryEngineMain.eval(QueryEngineMain.java:55)
	at org.apache.jena.sparql.engine.QueryEngineBase.evaluate(QueryEngineBase.java:175)
	at org.apache.jena.sparql.engine.QueryEngineBase.createPlan(QueryEngineBase.java:131)
	at org.apache.jena.sparql.engine.QueryEngineBase.getPlan(QueryEngineBase.java:112)
	at org.apache.jena.sparql.engine.main.QueryEngineMain$QueryEngineMainFactory.create(QueryEngineMain.java:90)
	at org.apache.jena.sparql.engine.QueryExecutionBase.getPlan(QueryExecutionBase.java:600)
	at org.apache.jena.sparql.engine.QueryExecutionBase.startQueryIterator(QueryExecutionBase.java:545)
	at org.apache.jena.sparql.engine.QueryExecutionBase.execConstructTriples(QueryExecutionBase.java:238)
	at org.apache.jena.sparql.engine.QueryExecutionBase.execConstruct(QueryExecutionBase.java:211)
	at org.linkeddatafragments.datasource.tdb.JenaTDBBasedRequestProcessorForTPFs$Worker.createFragment(JenaTDBBasedRequestProcessorForTPFs.java:116)
	at org.linkeddatafragments.datasource.AbstractRequestProcessorForTriplePatterns$Worker.createRequestedFragment(AbstractRequestProcessorForTriplePatterns.java:102)
	at org.linkeddatafragments.datasource.AbstractRequestProcessor.createRequestedFragment(AbstractRequestProcessor.java:29)
	at org.linkeddatafragments.test.datasource.DataSourceTest.testEstimate(DataSourceTest.java:151)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runners.Suite.runChild(Suite.java:127)
	at org.junit.runners.Suite.runChild(Suite.java:26)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Looks like something needs to be done to keep compatibility with latest Jena?

@smalyshev
Copy link
Contributor Author

@mielvds maybe you know what's wrong there?

@mielvds
Copy link
Contributor

mielvds commented Apr 10, 2019

Let me see. What did you change? Can you post the new pom.xml?

@smalyshev
Copy link
Contributor Author

I set all Jena versions to 3.10.0. Also, I added dataset.begin(ReadWrite.WRITE); to JenaTDBDataSourceTest.java on line 63, otherwise it threw "Not in a transaction" there. You can see our full pom.xml here: https://gist.github.com/smalyshev/b8045f8e15f0c926df003f67ecbaf492 - it's a bit different from master since we did other fixes but close enough. I think you'd be able to see it just replacing all Jena component versions to 3.10.0 and running mvn install.

@mielvds
Copy link
Contributor

mielvds commented Apr 10, 2019

No idea really, maybe @barthanssens can answer this?

@barthanssens
Copy link
Contributor

I'm mainly working with RDF4J, so I'm guessing here based on some quick googling :-)

It appears to be that there were changes in Jena, and things like qexec.execConstruct(triples); (line 116) seems to be valid only in a transaction...

If you prefer some syntactic sugar, there is also a convenience library ´Txn´ for handling transactions in a lambda expression: http://jena.apache.org/documentation/txn/txn.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants