[protege-owl] problem with ontmodel got from JenaOWLModel

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[protege-owl] problem with ontmodel got from JenaOWLModel

starred
Hi,

I've the following problem:

here is a portion of jena code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Iterator it;
OntClass cls;
cls = m.getOntClass("http://www.owl-ontologies.com/unnamed.owl#Event");
it = cls.listSubClasses();
while (it.hasNext()) System.out.println(it.next());
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If I load my ontology directly with jena, I get ALL sublclasses of Event

If I use exactly the same code over an ontModel which has been taken, through Protégé OWL API, with:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
File file = new File(ontologyFilePath);
URI uri=null;
try {
      uri = new URI("file:///" + file.getAbsolutePath().replace('\\', '/'));
}
catch (URISyntaxException e) {e.printStackTrace();}
try {
     jenaOWLModel = ProtegeOWL.createJenaOWLModelFromURI(uri.toString());
}
catch (Exception e) {e.printStackTrace();}
OntModel m= jenaOWLModel.getOntModel();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I only get the direct subclasses of Event. I have also tried using:

getSubClasses(false)

but it's always the same: only direct classes are returned :-(


Any help on that?

Thanks in advance,

Armando


--------------------------------------------------

Ing. Armando Stellato
AI Research Group,
Dept. of Computer Science, Systems and Production
University of Roma, Tor Vergata
Via del Politecnico 1 00133 ROMA (ITALY)
tel: +39 06 7259 7718/7334 (office);
     +39 06 7259 7332 (lab)
fax: +39 06 7259 7460
e_mail: [hidden email]

--------------------------------------------------  


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: problem with ontmodel got from JenaOWLModel

Holger Knublauch
That's because the Jena OntModel returned by Protege may not have
reasoning switched on, while if you're just inside the Jena API then you
may have a different OntModelSpec.  Without reasoning you will not get
transitive superclasses etc.

Holger


Armando Stellato wrote:

> Hi,
>
> I've the following problem:
>
> here is a portion of jena code:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Iterator it;
> OntClass cls;
> cls = m.getOntClass("http://www.owl-ontologies.com/unnamed.owl#Event");
> it = cls.listSubClasses();
> while (it.hasNext()) System.out.println(it.next());
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> If I load my ontology directly with jena, I get ALL sublclasses of Event
>
> If I use exactly the same code over an ontModel which has been taken, through Protégé OWL API, with:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> File file = new File(ontologyFilePath);
> URI uri=null;
> try {
>       uri = new URI("file:///" + file.getAbsolutePath().replace('\\', '/'));
> }
> catch (URISyntaxException e) {e.printStackTrace();}
> try {
>      jenaOWLModel = ProtegeOWL.createJenaOWLModelFromURI(uri.toString());
> }
> catch (Exception e) {e.printStackTrace();}
> OntModel m= jenaOWLModel.getOntModel();
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> I only get the direct subclasses of Event. I have also tried using:
>
> getSubClasses(false)
>
> but it's always the same: only direct classes are returned :-(
>
>
> Any help on that?
>
> Thanks in advance,
>
> Armando
>
>
> --------------------------------------------------
>
> Ing. Armando Stellato
> AI Research Group,
> Dept. of Computer Science, Systems and Production
> University of Roma, Tor Vergata
> Via del Politecnico 1 00133 ROMA (ITALY)
> tel: +39 06 7259 7718/7334 (office);
>      +39 06 7259 7332 (lab)
> fax: +39 06 7259 7460
> e_mail: [hidden email]
>
> --------------------------------------------------  
>
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] Re: problem with ontmodel got from JenaOWLModel

starred
Thanks Holger,

I changed it and worked now.

Another question: Is the following one the proper way to do it? (it works, but maybe there is a more elegant/efficient way).

jenaOWLModel = ProtegeOWL.createJenaOWLModelFromURI(uri.toString());
OntModelSpec spec = new OntModelSpec( OntModelSpec.OWL_DL_MEM );
spec.setReasoner(ReasonerRegistry.getTransitiveReasoner());
m = ModelFactory.createOntologyModel(spec, jenaOWLModel.getOntModel());

I created a new model over the existing one because I did not find any way to change the specification for an existing OntModel.

Cheers,

Armando

--------------------------------------------------

Ing. Armando Stellato
AI Research Group,
Dept. of Computer Science, Systems and Production
University of Roma, Tor Vergata
Via del Politecnico 1 00133 ROMA (ITALY)
tel: +39 06 7259 7718/7334 (office);
     +39 06 7259 7332 (lab)
fax: +39 06 7259 7460
e_mail: [hidden email]

--------------------------------------------------  

> -----Original Message-----
> From: [hidden email] [mailto:protege-owl-
> [hidden email]] On Behalf Of Holger Knublauch
> Sent: Wednesday, July 05, 2006 6:46 PM
> To: [hidden email]
> Subject: [protege-owl] Re: problem with ontmodel got from JenaOWLModel
>
> That's because the Jena OntModel returned by Protege may not have
> reasoning switched on, while if you're just inside the Jena API then you
> may have a different OntModelSpec.  Without reasoning you will not get
> transitive superclasses etc.
>
> Holger
>
>
> Armando Stellato wrote:
> > Hi,
> >
> > I've the following problem:
> >
> > here is a portion of jena code:
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > Iterator it;
> > OntClass cls;
> > cls = m.getOntClass("http://www.owl-ontologies.com/unnamed.owl#Event");
> > it = cls.listSubClasses();
> > while (it.hasNext()) System.out.println(it.next());
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> > If I load my ontology directly with jena, I get ALL sublclasses of Event
> >
> > If I use exactly the same code over an ontModel which has been taken,
> through Protégé OWL API, with:
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > File file = new File(ontologyFilePath);
> > URI uri=null;
> > try {
> >       uri = new URI("file:///" + file.getAbsolutePath().replace('\\',
> '/'));
> > }
> > catch (URISyntaxException e) {e.printStackTrace();}
> > try {
> >      jenaOWLModel =
> ProtegeOWL.createJenaOWLModelFromURI(uri.toString());
> > }
> > catch (Exception e) {e.printStackTrace();}
> > OntModel m= jenaOWLModel.getOntModel();
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> > I only get the direct subclasses of Event. I have also tried using:
> >
> > getSubClasses(false)
> >
> > but it's always the same: only direct classes are returned :-(
> >
> >
> > Any help on that?
> >
> > Thanks in advance,
> >
> > Armando
> >
> >
> > --------------------------------------------------
> >
> > Ing. Armando Stellato
> > AI Research Group,
> > Dept. of Computer Science, Systems and Production
> > University of Roma, Tor Vergata
> > Via del Politecnico 1 00133 ROMA (ITALY)
> > tel: +39 06 7259 7718/7334 (office);
> >      +39 06 7259 7332 (lab)
> > fax: +39 06 7259 7460
> > e_mail: [hidden email]
> >
> > --------------------------------------------------
> >
> >
> > ------------------------------------------------------------------------
> -
> > To unsubscribe go to
> http://protege.stanford.edu/community/subscribe.html
> >
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

[protege-owl] SWRL Activation Problem

sima soltani
In reply to this post by starred
Hello,
 
I have a problem with SWRLTab.
I import the swrl ontology into my project, when I open the SWRLTab it ask me to activate the SWRL! and when I press the Activate SWRL botton  it opens a message box and say "the system cannot find the ontology: htto://www.daml.org/rules/proposal/swrl.owl"
 
I connected to the internet.
 
What should I do?
 
 
Best regards
Sima Soltani 

Armando Stellato <[hidden email]> wrote:
Hi,

I've the following problem:

here is a portion of jena code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Iterator it;
OntClass cls;
cls = m.getOntClass("http://www.owl-ontologies.com/unnamed.owl#Event");
it = cls.listSubClasses();
while (it.hasNext()) System.out.println(it.next());
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If I load my ontology directly with jena, I get ALL sublclasses of Event

If I use exactly the same code over an ontModel which has been taken, through Protégé OWL API, with:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
File file = new File(ontologyFilePath);
URI uri=null;
try {
uri = new URI("file:///" + file.getAbsolutePath().replace('\\', '/'));
}
catch (URISyntaxException e) {e.printStackTrace();}
try {
jenaOWLModel = ProtegeOWL.createJenaOWLModelFromURI(uri.toString());
}
catch (Exception e) {e.printStackTrace();}
OntModel m= jenaOWLModel.getOntModel();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I only get the direct subclasses of Event. I have also tried using:

getSubClasses(false)

but it's always the same: only direct classes are returned :-(


Any help on that?

Thanks in advance,

Armando


--------------------------------------------------

Ing. Armando Stellato
AI Research Group,
Dept. of Computer Science, Systems and Production
University of Roma, Tor Vergata
Via del Politecnico 1 00133 ROMA (ITALY)
tel: +39 06 7259 7718/7334 (office);
+39 06 7259 7332 (lab)
fax: +39 06 7259 7460
e_mail: [hidden email]

--------------------------------------------------


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html



Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.