Search the web
Sign In
New User? Sign Up
jena-dev · Jena Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Problem with adding a Symmetric Property on base model   Message List  
Reply | Forward Message #40798 of 42052 |
Re: Problem with adding a Symmetric Property on base model

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
>





Fri Jul 10, 2009 6:23 am

paul.maire
Offline Offline
Send Email Send Email

Forward
Message #40798 of 42052 |
Expand Messages Author Sort by Date

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,...
paul.maire
Offline Send Email
Jul 9, 2009
1:35 pm

... 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...
Dave Reynolds
derihy
Offline Send Email
Jul 9, 2009
3:36 pm

Thank you Dave, I will try it out!...
paul.maire
Offline Send Email
Jul 10, 2009
6:23 am

... Hello again Dave, I'm really sorry if the question seems stupid. I have the non inferenced model(BasicModel) which is an OntModel and one with...
paul.maire
Offline Send Email
Jul 13, 2009
7:23 am

... While this works, as I've already said it is more normal to just add the data to the FullModel the changes will be recorded in the underlying model...
Dave Reynolds
derihy
Offline Send Email
Jul 13, 2009
8:04 am

Thank you so much for you help! Got it to work!...
paul.maire
Offline Send Email
Jul 14, 2009
12:26 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help