Apologies for what feels like a near-dupe question from the past. I've seen
so many related questions, but can't quite get the assembler config nailed
down right.  I have:

1. A TDB2 dataset, with data spread between a few named graphs and the
default graph.
2. An external OWL ontology which I would like to use to infer additional
info about the data in (1).  For now, I'm only trying to infer class
hierarchy info based on RDFS subclassOf statements.

Snipping what I think are the relevant portions of the config file, I have:

-----------
<#service> rdf:type fuseki:Service ;
     fuseki:dataset           <#inf_dataset> .

<#inf_dataset> rdf:type ja:RDFDataset ;
    ja:defaultGraph <#model> .

<#model> rdf:type ja:InfModel ;
    ja:reasoner [ ja:reasonerURL <
http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> ] ;
    ja:baseModel <#baseModel> .

<#baseModel> rdf:type ja:UnionModel ;
    ja:subModel <#ontology> ;
    ja:rootModel <#tdb_graph> .

<#ontology> rdf:type ja:MemoryModel ;
    ja:content [ ja:externalContent <file:////path/to/ontology.owl> ] .

<#tdb_graph> rdf:type tdb2:GraphTDB ;
    tdb2:dataset <#tdb2_dataset> .

<#tdb2_dataset> rdf:type tdb2:DatasetTDB2 ;
    tdb2:location "/path/to/graph" .
-----------

This configuration works for queries, including inference, on a small toy
dataset.  When pointed to the much larger "real" dataset, however, even a
simple query fails:

SELECT ?t
WHERE
{ ns:someId a ?t }

Throws this exception:

2019-06-05 22:19:17 [qtp322836221-75] WARN  org.apache.jena.fuseki.Fuseki -
[28] RC = 500 : Iterator used inside a different transaction
org.apache.jena.dboe.transaction.txn.TransactionException: Iterator used
inside a different transaction
        at
org.apache.jena.tdb2.store.IteratorTxnTracker.check(IteratorTxnTracker.java:53)
        at
org.apache.jena.tdb2.store.IteratorTxnTracker.hasNext(IteratorTxnTracker.java:41)
        at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
        at org.apache.jena.atlas.iterator.Iter.hasNext(Iter.java:903)
        at
org.apache.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
        at
org.apache.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
        at
org.apache.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:55)
        at
org.apache.jena.graph.compose.CompositionBase$1.hasNext(CompositionBase.java:94)
        at
org.apache.jena.util.iterator.NiceIterator$1.hasNext(NiceIterator.java:105)
        at
org.apache.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
        at
org.apache.jena.util.iterator.NiceIterator$1.hasNext(NiceIterator.java:105)
        at
org.apache.jena.util.iterator.NiceIterator$1.hasNext(NiceIterator.java:105)
        at
org.apache.jena.reasoner.rulesys.impl.TopLevelTripleMatchFrame.nextMatch(TopLevelTripleMatchFrame.java:55)
        at
org.apache.jena.reasoner.rulesys.impl.LPInterpreter.run(LPInterpreter.java:328)
        at
org.apache.jena.reasoner.rulesys.impl.LPInterpreter.next(LPInterpreter.java:190)
        at
org.apache.jena.reasoner.rulesys.impl.Generator.pump(Generator.java:252)
        at
org.apache.jena.reasoner.rulesys.impl.Generator.pump(Generator.java:239)
        at
org.apache.jena.reasoner.rulesys.impl.LPBRuleEngine.pump(LPBRuleEngine.java:359)
        at
org.apache.jena.reasoner.rulesys.impl.LPTopGoalIterator.moveForward(LPTopGoalIterator.java:107)
        at
org.apache.jena.reasoner.rulesys.impl.LPTopGoalIterator.hasNext(LPTopGoalIterator.java:223)
        at
org.apache.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)

If I instead load the ontology.owl contents into the TDB2 dataset's default
graph and wire it up with baseModel pointing to that TDB2 graph, queries
succeed with inference even on the real dataset ==> but I would like to
keep the ontology definition separate from the data.

Any pointers would be much appreciated.

Thanks,
- Mike

Reply via email to