I'm thinking a design in which Union and Multiunion and UnionDatasetGraph actually try to handle read transactions fully would be possible, but it would be a bit of finicking to get it right. Perhaps we could keep a lock in the type to hold while transactions are opened on all the underlying graphs or datasetgraphs, a little bit like the way TIM keeps a lock in a DatasetGraph to hold while opening transactions against its underlying indexes.
Is this worth a ticket? (Recording a desire to have unions that respond fully to read transactions.) ajs6f > On Jul 18, 2019, at 6:53 AM, Andy Seaborne <a...@apache.org> wrote: > > Having them in the same storage or one in memory would help. > > This is the crux difficult in JENA-1667. How to know if a transaction has > already been started on a dataset when there are several levels of models > over the top. > > At the moment, a union graph starts a transaction on its base graph, and does > nothing special about the others (that makes common cases work like the Ont > API and inference where other graph are either memory or same storage). > > Andy > > On 12/07/2019 14:23, Nouwt, B. (Barry) wrote: >> Hi Andy, thanks for the update! >> Maybe there is another way to get the setup that I want without having >> JENA-1667 arise. This is the setup I want: >> - a single dataset with two named graphs (that I can access and update >> separately, but having separate storage locations is not a requirement. It >> could also be in memory) >> - the default graph of the dataset is a Secured Model that uses our custom >> permissions Evaluator >> - the Secured Model contains the union of the two named graphs. >> - configurable via an fuseki assembler .TTL file >> Any idea how to achieve this without bumping into JENA-1667? >> Regards, Barry >> -----Original Message----- >> From: Andy Seaborne <a...@apache.org> >> Sent: donderdag 11 juli 2019 18:34 >> To: users@jena.apache.org >> Subject: Re: TDBTransactionException: Not in a transaction >> Barry, >> Quick update - it's the mixed database sources in the union graph causing >> the problems (so it is JENA-1667). There is a partial fix possible (would >> work in your case) but there are related more complicated cases that won't >> work so simply to be looked at. >> Andy >> On 10/07/2019 10:26, Andy Seaborne wrote: >>> Barry - excellent. I've got it reproduced on my system now. >>> >>> Thanks >>> >>> Andy >>> >>> >>> On 09/07/2019 09:57, Nouwt, B. (Barry) wrote: >>>> Hi Andy/rest, >>>> >>>> I've created an Java example in which the Exception occurs in Jena >>>> version 3.12.0. It uses Maven for dependency resolution and the >>>> Exception happens when you run the Java class JenaExample. >>>> >>>> See: https://github.com/barrynl/jena-example >>>> >>>> Regards, Barry >>>> >>>> -----Original Message----- >>>> From: Andy Seaborne <a...@apache.org> >>>> Sent: maandag 8 juli 2019 16:53 >>>> To: users@jena.apache.org >>>> Subject: Re: TDBTransactionException: Not in a transaction >>>> >>>> Some things have improved since 3.9.0. >>>> >>>> Barry - can you turn this into a minimal, free standing example? It's >>>> not manifesting in the same way as JENA-1667. >>>> >>>> Thanks >>>> Andy >>>> >>>> On 08/07/2019 15:20, Nouwt, B. (Barry) wrote: >>>>> Hi, thanks for the replies! >>>>> >>>>> @Lorenz: It would indeed be better to migrate to the latest version. >>>>> Unfortunately, this would make the process a bit more >>>>> complex...because the functionality I'm trying to add to Fuseki >>>>> definitely works with version 3.9.0. Although you are right that the >>>>> problem could be solved in a newer version... >>>>> >>>>> @Rob: thanks for the pointer to that bug. At least I can keep my eye >>>>> on that one, to see when it gets fixed. >>>>> >>>>> Regards, Barry >>>>> >>>>> -----Original Message----- >>>>> From: Rob Vesse <rve...@dotnetrdf.org> >>>>> Sent: maandag 8 juli 2019 14:55 >>>>> To: users@jena.apache.org >>>>> Subject: Re: TDBTransactionException: Not in a transaction >>>>> >>>>> This looks like a simpler variation upon JENA-1667 [1] which is a >>>>> Known Bug that is not currently resolved in any version of Jena >>>>> >>>>> Although not sure why this worked in past versions of Fuseki, may be >>>>> a side effect of other Fuseki refactoring that has happened >>>>> >>>>> Rob >>>>> >>>>> [1] https://issues.apache.org/jira/browse/JENA-1667 >>>>> >>>>> On 08/07/2019, 13:23, "Lorenz B." >>>>> <buehm...@informatik.uni-leipzig.de> wrote: >>>>> >>>>> Not that I could help here that much, but is there a reason >>>>> for >>>>> migrating from a and old version (2017-12) to a less old >>>>> version >>>>> (2018-09)? I mean, latest release is 3.12.0. >>>>> Maybe this might already fix your problem? >>>>> > Hi all, >>>>> > >>>>> > I am migrating my Apache Jena Fuseki from version 3.6.0 to >>>>> version 3.9.0. However, the following configuration file gives a >>>>> "TDBTransactionException: Not in a transaction" error when I send a >>>>> SELECT query to its SPARQL endpoint. It worked as expected with >>>>> Apache Jena Fuseki version 3.6.0. >>>>> > >>>>> > I've tried the following, but these things did not solve it: >>>>> > >>>>> > * Adding a tdb:DatasetTDB >>>>> > * Use the same tdb:location for both GraphTDB's >>>>> > >>>>> > ----------------------------------------------- begin of >>>>> config --------------------------------------------- >>>>> > >>>>> > # Licensed under the terms of >>>>> http://www.apache.org/licenses/LICENSE-2.0 >>>>> > >>>>> > @prefix : <#> . >>>>> > @prefix fuseki: <http://jena.apache.org/fuseki#> . >>>>> > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >>>>> > @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . >>>>> > @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . >>>>> > @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . >>>>> > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . >>>>> > >>>>> > [] rdf:type fuseki:Server ; >>>>> > fuseki:services ( >>>>> > <#service1> >>>>> > ) . >>>>> > >>>>> > # Custom code. >>>>> > [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . >>>>> > >>>>> > # TDB >>>>> > tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . >>>>> > tdb:GraphTDB rdfs:subClassOf ja:Model . >>>>> > >>>>> > ## >>>>> --------------------------------------------------------------- >>>>> > ## Service with only SPARQL query on an inference model. >>>>> > ## Inference model base data in TDB. >>>>> > >>>>> > <#service1> rdf:type fuseki:Service ; >>>>> > fuseki:name "knowledge" ; >>>>> > fuseki:serviceQuery "query" ; # SPARQL query >>>>> service >>>>> > fuseki:serviceUpdate "update" ; >>>>> > fuseki:serviceUpload "upload" ; # Non-SPARQL >>>>> upload service >>>>> > fuseki:serviceReadWriteGraphStore "data" ; # >>>>> SPARQL Graph store protocol (read and write) >>>>> > # A separate read-only graph store endpoint: >>>>> > fuseki:serviceReadGraphStore "get" ; # >>>>> SPARQL Graph store protocol (read only) >>>>> > fuseki:dataset <#dataset> . >>>>> > >>>>> > <#dataset> rdf:type ja:RDFDataset ; >>>>> > ja:defaultGraph <#unionModel> ; >>>>> > #set the timeout for a SPARQL query in milliseconds. 0 >>>>> means no timeout and the query never times out. >>>>> > ja:context [ ja:cxtName "arq:queryTimeout" ; >>>>> ja:cxtValue "120000,240000" ] ; >>>>> > ja:namedGraph [ >>>>> > ja:graphName >>>>> <https://www.tno.nl/agrifood/graph/pizza/onto> ; >>>>> > ja:graph <#ontoGraph> ; >>>>> > ]; >>>>> > ja:namedGraph [ >>>>> > ja:graphName >>>>> <https://www.tno.nl/agrifood/graph/pizza/data> ; >>>>> > ja:graph <#itemGraph> ; >>>>> > ]. >>>>> > >>>>> > <#unionModel> rdf:type ja:UnionModel ; >>>>> > ja:rootModel <#itemGraph> ; >>>>> > ja:subModel <#ontoGraph> . >>>>> > >>>>> > <#ontoGraph> rdf:type tdb:GraphTDB ; >>>>> > tdb:location "ontoDB" ; >>>>> > tdb:graphName >>>>> <https://www.tno.nl/agrifood/graph/pizza/onto> . >>>>> > >>>>> > <#itemGraph> rdf:type tdb:GraphTDB ; >>>>> > tdb:location "itemDB" ; >>>>> > tdb:graphName >>>>> <https://www.tno.nl/agrifood/graph/pizza/data> . >>>>> > >>>>> > ------------------------------------------------------- end >>>>> of config ------------------------------------------------- >>>>> > >>>>> > Any ideas how to fix the TDBTransactionException? (full >>>>> trace >>>>> below) >>>>> > >>>>> > Regards, Barry >>>>> > >>>>> > >>>>> > org.apache.jena.tdb.transaction.TDBTransactionException: Not >>>>> in a transaction >>>>> > at >>>>> org.apache.jena.tdb.transaction.DatasetGraphTransaction.get(DatasetG >>>>> raphTransaction.java:140) >>>>> >>>>> > at >>>>> org.apache.jena.tdb.transaction.DatasetGraphTransaction.get(DatasetG >>>>> raphTransaction.java:52) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.core.DatasetGraphWrapper.getR(DatasetGraphWra >>>>> pper.java:78) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.core.DatasetGraphWrapper.find(DatasetGraphWra >>>>> pper.java:167) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:1 >>>>> 24) >>>>> > at >>>>> org.apache.jena.sparql.core.GraphView.graphBaseFind(GraphView.java:1 >>>>> 16) >>>>> > at >>>>> org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:241) >>>>> > at >>>>> org.apache.jena.graph.compose.MultiUnion.multiGraphFind(MultiUnion.j >>>>> ava:170) >>>>> >>>>> > at >>>>> org.apache.jena.graph.compose.MultiUnion.graphBaseFind(MultiUnion.ja >>>>> va:147) >>>>> >>>>> > at >>>>> org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:241) >>>>> > at >>>>> org.apache.jena.graph.impl.GraphBase.graphBaseFind(GraphBase.java:25 >>>>> 8) >>>>> > at >>>>> org.apache.jena.graph.impl.GraphBase.find(GraphBase.java:255) >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterTriplePattern$Triple >>>>> Mapper.<init>(QueryIterTriplePattern.java:75) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterTriplePattern.nextSt >>>>> age(QueryIterTriplePattern.java:49) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNext >>>>> Stage(QueryIterRepeatApply.java:108) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextB >>>>> inding(QueryIterRepeatApply.java:65) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterBlockTriples.hasNext >>>>> Binding(QueryIterBlockTriples.java:63) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIterConvert.hasNextBindi >>>>> ng(QueryIterConvert.java:58) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextB >>>>> inding(QueryIteratorWrapper.java:39) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextB >>>>> inding(QueryIteratorWrapper.java:39) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextB >>>>> inding(QueryIteratorWrapper.java:39) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(Que >>>>> ryIteratorBase.java:114) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStrea >>>>> m.java:74) >>>>> >>>>> > at >>>>> org.apache.jena.sparql.engine.ResultSetCheckCondition.hasNext(Result >>>>> SetCheckCondition.java:55) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.SPARQL_Query.executeQuery(SPARQL_Que >>>>> ry.java:350) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.SPARQL_Query.execute(SPARQL_Query.ja >>>>> va:288) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.SPARQL_Query.executeWithParameter(SP >>>>> ARQL_Query.java:242) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.SPARQL_Query.perform(SPARQL_Query.ja >>>>> va:227) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.ActionService.executeLifecycle(Actio >>>>> nService.java:183) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.ActionService.execCommonWorker(Actio >>>>> nService.java:98) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.ActionBase.doCommon(ActionBase.java: >>>>> 74) >>>>> > at >>>>> org.apache.jena.fuseki.servlets.FusekiFilter.doFilter(FusekiFilter.j >>>>> ava:73) >>>>> >>>>> > at >>>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servle >>>>> tHandler.java:1642) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilt >>>>> erChain.java:61) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter. >>>>> java:108) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFil >>>>> ter.java:137) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRe >>>>> questFilter.java:125) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilt >>>>> erChain.java:66) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter. >>>>> java:108) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFil >>>>> ter.java:137) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRe >>>>> questFilter.java:125) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilt >>>>> erChain.java:66) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(Abstra >>>>> ctShiroFilter.java:449) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShir >>>>> oFilter.java:365) >>>>> >>>>> > at >>>>> org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCalla >>>>> ble.java:90) >>>>> >>>>> > at >>>>> org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallabl >>>>> e.java:83) >>>>> >>>>> > at >>>>> org.apache.shiro.subject.support.DelegatingSubject.execute(Delegatin >>>>> gSubject.java:383) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(Ab >>>>> stractShiroFilter.java:362) >>>>> >>>>> > at >>>>> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRe >>>>> questFilter.java:125) >>>>> >>>>> > at >>>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servle >>>>> tHandler.java:1642) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.CrossOriginFilter.handle(CrossOrigin >>>>> Filter.java:285) >>>>> >>>>> > at >>>>> org.apache.jena.fuseki.servlets.CrossOriginFilter.doFilter(CrossOrig >>>>> inFilter.java:248) >>>>> >>>>> > at >>>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(Servle >>>>> tHandler.java:1634) >>>>> >>>>> > at >>>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.jav >>>>> a:533) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler. >>>>> java:146) >>>>> >>>>> > at >>>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.ja >>>>> va:548) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrappe >>>>> r.java:132) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHand >>>>> ler.java:257) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHand >>>>> ler.java:1595) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHand >>>>> ler.java:255) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHand >>>>> ler.java:1340) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandl >>>>> er.java:203) >>>>> >>>>> > at >>>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java >>>>> :473) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandl >>>>> er.java:1564) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandl >>>>> er.java:201) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandl >>>>> er.java:1242) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler. >>>>> java:144) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler >>>>> .java:690) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrappe >>>>> r.java:132) >>>>> >>>>> > at >>>>> org.eclipse.jetty.server.Server.handle(Server.java:503) >>>>> > at >>>>> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) >>>>> > at >>>>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.ja >>>>> va:260) >>>>> >>>>> > at >>>>> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(Abstr >>>>> actConnection.java:305) >>>>> >>>>> > at >>>>> org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) >>>>> > at >>>>> org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) >>>>> > at >>>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPo >>>>> ol.java:765) >>>>> >>>>> > at >>>>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPoo >>>>> l.java:683) >>>>> >>>>> > at java.lang.Thread.run(Thread.java:745) >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > This message may contain information that is not intended >>>>> for you. If you are not the addressee or if this message was sent to >>>>> you by mistake, you are requested to inform the sender and delete >>>>> the message. TNO accepts no liability for the content of this >>>>> e-mail, for the manner in which you use it and for damage of any >>>>> kind resulting from the risks inherent to the electronic transmission of >>>>> messages. >>>>> > >>>>> -- >>>>> Lorenz Bühmann >>>>> AKSW group, University of Leipzig >>>>> Group: http://aksw.org - semantic web research center >>>>> >>>>> >>>>> >>>>> >> This message may contain information that is not intended for you. If you >> are not the addressee or if this message was sent to you by mistake, you are >> requested to inform the sender and delete the message. TNO accepts no >> liability for the content of this e-mail, for the manner in which you use it >> and for damage of any kind resulting from the risks inherent to the >> electronic transmission of messages.