Thank you Dave, I will try it out!
--- In jena-dev@yahoogroups.com, Dave Reynolds <der@...> wrote:
>
> paul.maire wrote:
> > Hello,
> >
> > I am pretty new with OWL and ontologies so don't hesitate to correct me if I
use the wrong key words.
> >
> > I have 2 OntModels. One loaded with a reasoner, the other not.
> > <
> > //Loading the owl ontology with a reasoner
> > OntModel FullModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
> > ...
> > reader.read(FullModel, bReader, "RDF/XML-ABBREV");
> >
> > //Loading the baseModel underlaying the reasoner
> > OntModel BasicModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,
FullModel.getRawModel());
> >
> > For performance I decided to apply my modifications to the BasicModel. And
to call the rebind() method on the Reasoner Model to apply changes! (So far so
good I think, that's what I got from several posts)
> > Example here, creating a statement
> > <
> > ...
> > Statement st = BasicModel.createStatement(src, property, target);
> > BasicModel.add(st);
> > FullModel.rebind();
> > ...
>
> This will have no effect on performance. Even if you are making several
> changes and then calling rebind then, unless you are querying in the
> meantime, it will still have no effect on performance.
>
> Just update the OntModel and the updates will go into your base model.
>
> > My issue :
> > Querying the BasicModel is faster then querying the FullModel. The result of
listProperties() on a Individual from the BasicModel sends back only the
"annotation" properties which is exactly what I want. With the Fullmodel I get
the classes, types...etc which I don't want.
> > That is why I use listProperties() on the BasicModel.
> >
> > Situation:
> > I have 2 objects, "person_1" and "person_2".
> > I have a symmetric property "is_married_to".
> >
> > I create a statement which says "person_1->is_married_to->person_2". I do
this on the BasicModel. Of course, since it has no reasoner, it doesn't take in
account that the property is symmetric.
> > That is why I call rebind() on the Fullmodel().
> >
> > If I query the FullModel for objects which have the property
"is_married_to", the results are :
> > "person_1->is_married_to->person_2"
> > "person_2->is_married_to->person_1".
> > This is exactly what I want except that this only exists in the FullModel.
> >
> > My problem is that I use listProperties() on the BasicModel and I'dd realy
like to keep it that way. But the BasicModel only returns
"person_1->is_married_to->person_2" even after the rebind().
>
> Yes. Your raw/base model is your data, no inferences. The InfModel (and
> in your case the OntModel is an InfModel) makes the inferences available.
>
> > Also, when I save my ontology, I save the BasicModel (faster and lighter).
> >
> > I'm looking for a way to apply the changes done by the reasoner to the base
model. In my example i'dd like to have the "person_2->is_married_to->person_1"
also added to the base model.
> >
> > I'm open to any suggestions, I'm maybe doing things wrong, I appreciate any
help...
>
> It sounds like what you want to do is to materialize some selected
> inferences into a plain model so you get predicable query times.
> Perfectly reasonable. Unless you have space problems then I would keep
> that model separate from your original model. So create a plain model
> and use Model.add to load a copy of your base data and then load copies
> of whatever specific inferences you want into it. Note that Model.add
> can take a StmtIterator so adding all inferred is_married_to relations
> to the materialized model is easy.
>
> Dave
> --
> Hewlett-Packard Limited
> Registered Office: Cain Road, Bracknell, Berks RG12 1HN
> Registered No: 690597 England
>