To create a reason with just a few rules of your choice then use the GenericRuleReasoner. See https://jena.apache.org/documentation/inference/index.html#rules

You can write your own rules or pick and choose from those in the source code you've found.

To only compute the inverse relationships, and do so on demand, you probably just need:

[inverseOf2: (?P owl:inverseOf ?Q) -> table(?P), table(?Q), [inverseOf2b: (?X ?P ?Y) <- (?Y ?Q ?X)] ]

That is a "hyrid" rule (mix of forward and backward) see the docs, but that's the default for GenericRuleReasoner anyway.

Dave

On 20/08/2021 14:01, Simon Gray wrote:
Hi everyone,

I'm on Jena 3.14 experimenting with the built-in OntologySpecs.

My main requirement is inferring reverse relations (when applicable). Only the 
OWL reasoners do this, but they also infer so many more triples which balloons 
the size of the InfModel so much that it is impossible for me to infer every 
single triple within the memory constraints of my laptop. I have 16GB 
available, with 12GB set aside for the JVM heap, but every attempt at copying 
all inferred triples to a TDB2 model eventually fails with an OutOfMemoryError. 
The dataset is a modest-sized WordNet.

I wonder if it's possible for me to create an OntologySpec with a Reasoner that 
is a bit more basic, possibly only inferring reverse relation triples. Looking 
into this, it seems like one needs knowledge of the Logic DSL used to define 
the various built-in reasoners...? Or at least I never found an easy way to 
create a Reasoner that just does this.

Maybe it's possible to use one of the built-in OWL reasoners and simply disable 
some functionality? I'm not sure how, though. The only way I've found looking 
at the source code and the documentation seems to be editing a .rules file 
which contains the aforementioned logic DSL.

Kind regards
Simon


Reply via email to