You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Steve Vestal <st...@adventiumlabs.com> on 2019/12/06 13:56:43 UTC

Re: Question about multiple OntModel reads

Thanks, Dave.  Here are a few more questions.

I'm looking at
https://jena.apache.org/documentation/ontology/#compound-ontology-documents-and-imports-processing. 
For possibly unnecessary reasons, I'm looking to manage who imports what
from where myself.

The Javadoc for OntDocumentManager#loadImport(OntModel model, String
uri) says "Any models imported by the given URI will also be imported." 
Is that true even if I have called setProcessImports(false) on the
document manager(s) for both the imported and imported-into OntModels?

Does OntDocumentManager#loadImport load an import into all OntModels
that have that same document manager?

What happens when an OntModel that does have a reasoner is imported into
another OntModel using loadImport(OntModel model, String uri)?  Do I
need to make sure the loaded OntModels do not have reasoners, e.g.,
imported OntModels were all created with OntModelSpec.OWL_DL_MEM?

Does import hierarchy matter for reasoning purposes?  If the root
OntModel does a loadImport of everything that was requested as an import
by any other import, is that good-to-go for the root OntModel reasoner?

Must imports be OntModels themselves and be loaded by
OntDocumentManager#loadImport(OntModel model, String uri)?     Or can
ordinary Model objects be added using  OntModel#addSubModel or
OntDocumentManager#addModel and work like an import?   Would it make any
significant difference in performance if they are Models rather than
OntModels without reasoners?  Or is this just asking for trouble?
(Calling them OntModels without reasoners captures the intent better.)


On 10/23/2019 2:42 AM, Dave Reynolds wrote:
> On 23/10/2019 03:16, Steve Vestal wrote:
>> The description at https://jena.apache.org/documentation/ontology/ talks
>> about reading an ontology in as the base graph.  Import closure puts
>> each imported ontology into its own graph to produce a "compound
>> document."  What happens if I read more than one ontology into the same
>> OntModel?  Are they merged into a single base graph?
>
> Yes. If you add a triple to an OntModel that triple goes into the base
> graph. Read is just adding a bunch of triples.
>
>> It says all updates change the base model, in the event a write is
>> done.  Am I correct in assuming "change" refers to things like calling
>> OntModel methods, and that while reasoners may affect results returned
>> by SPARQL queries or Graph contains methods, reasoning will not "change"
>> the base model in that sense.
>
> Correct. Reasoning is packaged as a wrapper model which makes
> additional inferred triples available but doesn't change the base model.
>
> Dave
>


Re: Question about multiple OntModel reads

Posted by Steve Vestal <st...@adventiumlabs.com>.
Never mind, I think using OntDocumentManager#addModel(docURI, model)
together with other import machinery does what I wanted.

On 12/6/2019 7:56 AM, Steve Vestal wrote:
> Thanks, Dave.  Here are a few more questions.
>
> I'm looking at
> https://jena.apache.org/documentation/ontology/#compound-ontology-documents-and-imports-processing. 
> For possibly unnecessary reasons, I'm looking to manage who imports what
> from where myself.
>
> The Javadoc for OntDocumentManager#loadImport(OntModel model, String
> uri) says "Any models imported by the given URI will also be imported." 
> Is that true even if I have called setProcessImports(false) on the
> document manager(s) for both the imported and imported-into OntModels?
>
> Does OntDocumentManager#loadImport load an import into all OntModels
> that have that same document manager?
>
> What happens when an OntModel that does have a reasoner is imported into
> another OntModel using loadImport(OntModel model, String uri)?  Do I
> need to make sure the loaded OntModels do not have reasoners, e.g.,
> imported OntModels were all created with OntModelSpec.OWL_DL_MEM?
>
> Does import hierarchy matter for reasoning purposes?  If the root
> OntModel does a loadImport of everything that was requested as an import
> by any other import, is that good-to-go for the root OntModel reasoner?
>
> Must imports be OntModels themselves and be loaded by
> OntDocumentManager#loadImport(OntModel model, String uri)?     Or can
> ordinary Model objects be added using  OntModel#addSubModel or
> OntDocumentManager#addModel and work like an import?   Would it make any
> significant difference in performance if they are Models rather than
> OntModels without reasoners?  Or is this just asking for trouble?
> (Calling them OntModels without reasoners captures the intent better.)
>
>
> On 10/23/2019 2:42 AM, Dave Reynolds wrote:
>> On 23/10/2019 03:16, Steve Vestal wrote:
>>> The description at https://jena.apache.org/documentation/ontology/ talks
>>> about reading an ontology in as the base graph.  Import closure puts
>>> each imported ontology into its own graph to produce a "compound
>>> document."  What happens if I read more than one ontology into the same
>>> OntModel?  Are they merged into a single base graph?
>> Yes. If you add a triple to an OntModel that triple goes into the base
>> graph. Read is just adding a bunch of triples.
>>
>>> It says all updates change the base model, in the event a write is
>>> done.  Am I correct in assuming "change" refers to things like calling
>>> OntModel methods, and that while reasoners may affect results returned
>>> by SPARQL queries or Graph contains methods, reasoning will not "change"
>>> the base model in that sense.
>> Correct. Reasoning is packaged as a wrapper model which makes
>> additional inferred triples available but doesn't change the base model.
>>
>> Dave
>>