Thanks Dave, that is great to know! Rght now I’m using one of the built-in OntModelSpec instances, calling `setBaseModelMaker` and `setImportModelMaker` on it with an instance created by `ModelFactory.createMemModelMaker` as the argument. It is my understanding that I will then also have to extend (or implement) both a Reasoner, e.g. org.apache.jena.reasoner.rulesys.OWLMicroReasoner, as well as a ReasonerFactory, e.g. OWLMicroReasonerFactory to make fresh OntModelSpec instance.
I wonder if this is the way to go? > Den 20. aug. 2021 kl. 17.24 skrev Dave Reynolds <[email protected]>: > > [You don't often get email from [email protected]. Learn why this is > important at http://aka.ms/LearnAboutSenderIdentification.] > > To create a reason with just a few rules of your choice then use the > GenericRuleReasoner. See > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fjena.apache.org%2Fdocumentation%2Finference%2Findex.html%23rules&data=04%7C01%7Csimongray%40hum.ku.dk%7C969da2c5af654732493b08d963eea058%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637650698810113318%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vGnLU75Hl1sq%2FKe6vmBLthD9TKEoLBYvGIT%2F469P6w%3D&reserved=0 > > 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 >> >>
