Thanks Dave for the wonderful explanation. :) Much appreciated.
Thanks, Ashish On Tue, Nov 27, 2012 at 11:28 PM, Dave Reynolds <[email protected]>wrote: > The explanation of imports processing and the resulting trees of models is > well-described in the Ontology documentation. > > As I said to Ashish the sub-model system (which under the hood is > MultiUnion) is general purpose. You are free to change sub-models and those > changes are immediate reflected in the dynamic union. You are free to use > this mechanism how you wish. > > There is a distinguished member of the union where updates to the union > get sent. So *if* you had a single mutable model and a collection of > imported models then it would be sensible to make the mutable model the > base model. Hence my original comment to Ashish. That's not the same as > saying that you are constrained to *only* use sub-models that way. > > Dave > > > On 27/11/12 14:23, David Jordan wrote: > >> I had the same reaction. Is this described in the documentation? I have >> been away from Jena for about a year, but luckily it looks like I have >> finally gotten commitment to do some work with it again. I was not aware of >> this characteristic of sub models when I started playing around with them a >> year ago. I'll be doing another technical/performance evaluation, and >> things like this are very important to know. >> >> -----Original Message----- >> From: ashish nijhara >> [mailto:nijhara.ashish@gmail.**com<[email protected]> >> ] >> Sent: Tuesday, November 27, 2012 9:16 AM >> To: [email protected] >> Subject: Re: Storing to the correct sub model >> >> Thanks Dave. you gave me a really interesting information. >> >> Is that the purpose of designing sub models really? that sub models will >> typically represent static things? >> >> ------------------------------**------------------------------** >> ------------------------------**------------------------------** >> ------------------------------**------------------------------** >> ------------ >> So, my ontology set up is like the following: >> >> parent ontology -> A.owl->only concepts >> child ontology 1-> B.owl-> some new concepts+ some Named Individuals, >> this imports A.owl child ontology 2-> c.owl-> some new concepts+ some Named >> Individuals [different than B.owl], this also imports A.owl >> >> data.rdf -> only individuals created during runtime [this data.rdf needs >> to be divided into further sub models based on what data is required]. So >> it is a Tree of Graphs essentially. >> >> I attached the reasoner on the Ontmodel of child ontology 1 and added >> data.rdf as a subModel to the OntModel. This data.rdf can have further sub >> models (models directly mapped to graphs in a database using SDB), so I >> would need correct keys (uris) of these of the submodels (graphs). >> >> ------------------------------**------------------------------** >> ------------------------------**------------------------------** >> ------------------------------**------------------------------** >> ------------ >> >> If Jena is primarily designed to work the other way, then my approach may >> end up using more memory or? >> >> Thanks, >> Ashish >> >> >> >> On Tue, Nov 27, 2012 at 1:21 AM, Dave Reynolds <[email protected] >> >**wrote: >> >> On 23/11/12 08:10, ashish nijhara wrote: >>> >>> Hi All, >>>> >>>> I have a problem statement as the following: >>>> >>>> I have an OntModel which has only stored concepts with pre-defined >>>> individuals or named individuals. There is a reasoner attached to it. >>>> >>>> I have a sub model which needs to contain only the working data. No >>>> new concepts can be added here. >>>> >>>> final OntModelSpec spec = OntModelSpec.OWL_DL_MEM; >>>> final OntModel ontModel = ModelFactory.**** >>>> createOntologyModel(spec); >>>> ontModel.read(<url>); >>>> >>>> final Reasoner reasoner = PelletReasonerFactory.** >>>> theInstance().create(); >>>> reasoner.bindSchema(ontModel); >>>> >>>> final OntModel dataModel = ModelFactory.****createOntologyModel(); >>>> ontModel.addSubModel(****dataModel); >>>> >>>> ontModel.prepare(); >>>> >>>> ........... >>>> ........... >>>> ........... >>>> >>>> Now when I create an individual, I would like to add this to the >>>> subModel. >>>> To do this, I need to find correct Sub Model. >>>> >>>> ontModel.listSubModels() will return all the submodels (there are >>>> more than one sub models to the ontModel). >>>> >>>> How do I fetch my correct subModel that is the dataModel above? There >>>> is no method in Jena to get me a particular subModel or it there >>>> something I need to do more to achieve this.? >>>> >>>> >>> Seems like an odd arrangement. When you add statements to an OntModel >>> the additions go into the base model. So normal practice is to make >>> the things you don't want to change (like the ontology) the sub-models. >>> >>> If you go round finding particular sub-models and adding directly to >>> them you will probably need to call rebind() on the OntModel to >>> restart the reasoner over the changed data. >>> >>> If you really do want to use this sub-model arrangement they you will >>> need to keep an index of sub-models somewhere else. Jena itself is >>> just treating an OntModel as set of graphs, there's no associated >>> label or annotation on the graphs. >>> >>> Dave >>> >>> >>> >> >
