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
