I think I found the reason subModel objects are not the importedModel objects.  listSubModels does say "Each model returned by this method will have been wrapped as an ontology model using the same OntModelSpec as this model," meaning (from the code) the graph of the given model is used to create a new Model that is used as the base model in a newly created OntModelImpl.  That implies each returned subModel comes fully equipped with its own reasoner.  The OntModelImpl addSubModel method only saves the graph of the provided model (in the MultiUnion that feeds the reasoner), it doesn't save the model, but getSubGraph will return that original graph.   It appears getImportModel will also sometimes create a new OntModel object/wrapper.  I'm starting to get the feeling wrapping models and graphs is not uncommon inside compound document structures.

On 7/12/2022 3:25 PM, Steve Vestal wrote:
I have a few questions about how to assemble a compound document structure.  I will use as a notional example

    OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);

The reasoner package javadoc shows

    ReasonerFactory rf = RDFSReasonerFactory.theInstance();
    Reasoner reasoner  = rf.create(null);
    InfGraph graph     = reasoner.bind(data);
    Model model        = new ModelMem(graph);

When creating the above ontModel, is that final model what will be created using the reasoner's provided InfGraph, e.g., the final line above would be something like new OntModelImpl(spec, baseModel) where the baseModel is created using the provided InfGraph as its source of data?  (In a test, the graph provided by the baseModel (a ModelComp object) is the graph provided by the ontModel object.)

When I read a simple test case into ontModel that has two imports and then look at the results of

        ExtendedIterator<OntModel> subModels = ontModel.listSubModels();

and

        ExtendedIterator<String> ontModels = ontModel.getImportModelMaker().listModels();
        while (ontModels.hasNext()) {
            String m = ontModels.next();
            OntModel imp = ontModel.getImportedModel(m);}

I get different OntModelImpl subModel objects versus importedModel objects.  What is the difference between subModels and importedModels?  My impression is that the argument to Reasoner#bind is often a MultiUnion graph. Which of these (submodels or imports) are children of (providers to) the reasoner's MultiUnion graph?  What is the parent (consuming) model for the other?  Which models provide the OntModelImpl#getSubGraph graphs?

What does OntModel#getDeductionsModel return?  This is the model where a reasoner puts its entailments, correct?  It doesn't seem to be any of the above model objects.


Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to