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...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

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
Re: Howto extract root nodes   Message List  
Reply | Forward Message #30654 of 42510 |
Re: [jena-dev] Howto extract root nodes

I am really tired of working around with these methods. I could only get the immediate super class of the given search string input. even listHierarchyRootClasses() method returns all blank nodes, it is not returning any named classes that I see in protege editor. Like I said, this ontology is an external one, i have no control over this owl file. but it's is very important that my search technique works for external ontologies also (as a test condition). for example the "Neuron" class is up in the hierarchy. my search term "Gamma_motor_neuron" is mapped exactly to the "Gamma_motor_neuron" ( a trivial case where search string is an exact match with the ontology term). But my validation routine wants to make sure that the mapped ontology class "Gamma_motor_neuron" is indeed a subclass of "Neuron". But I could only retrieve Superclasses only upto the immediate parent node "spinal_motor_neuron". But in the actual scenario the list should go in this fashion: "Gamma_motor_neuron" is_a "spinal_motor_neuron" is_a "motor_neuron" is_a "neuron".

However, the same routine works for my own ontology. I could retrieve the top level nodes and satisfy my validation criteria.

OntClass tmpcls = cls; while(!suprcls.equalsIgnoreCase("Axonal_terminal")&&!suprcls.equalsIgnoreCase("Interneuron")&&!suprcls.equalsIgnoreCase("Principal_cell")&&!suprcls.equalsIgnoreCase("Neuron")){
            tmpcls=tmpcls.getSuperClass();
            out.println(tmpcls);
            suprcls=tmpcls.getLocalName();
            out.println(suprcls);
}

so this is a clear example of problems for trying to create a integrative approach. Ironically, the gist of ontologies is to share the domains. I want to achieve this by hook or crook

On a different note. On my other post, the stupidity that I am talking about is, the way i am trying to map with the ontology terms with a string matching like below. this obviously is not going to be a solution. there are definitely more valid terms than these four.

while(!suprcls.equalsIgnoreCase("Axonal_terminal")&&!suprcls.equalsIgnoreCase("Interneuron")&&!suprcls.equalsIgnoreCase("Principal_cell")&&!suprcls.equalsIgnoreCase("Neuron")){

-Thanks
Sri




On 8/21/07, Chris Dollin <kers@...> wrote:

On Monday 20 August 2007 22:38, sridevi polavaram wrote:
> On 8/17/07, Dave Reynolds <der@...> wrote:
> >
> > sridevi polavaram wrote:
> > > Thanks Dave, for now, the model.getNsPrefixURI("")
> > > is working for me. I guess the models that don't have a base URI are not
> >
> > > upto the standards? what say?
> >
> > I wouldn't go that far. Though it is true that most models will define
> > both an xml:base and a default namespace and relate the two in an
> > obvious way.
> >
> > > I have another question, How can I extract the root node (root class) of
> >
> > > the ontology hierarchy?
> > > is there a direct method that i can use.
> >
> > The builtin method is listHierarchyRootClasses().
>
> For some reason, the OntModel is returning values like this:
>
> 3ac1780f:1148518ebff:-7fd4

Those are blank nodes - the gibberish is the blank node's internal ID.

> for the listHierarchyRootClasses() and when I tried to use getLocalName()
> method, it is giving a NullPointerException at Runtime.

They have no local name. (Insert DON'T USE getLocalName RANT here.)

> How can I skip these kind of class references?

Ignore the classes that are isAnon. (Anon -- anonymous -- blank.)

--
Chris "danger, http://lost.in.space/characters/Will#Robinson !" Dollin

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England




Tue Aug 21, 2007 2:12 pm

sridevi_mami
Offline Offline
Send Email Send Email

Forward
Message #30654 of 42510 |
Expand Messages Author Sort by Date

Thanks Dave, for now, the model.getNsPrefixURI("") is working for me. I guess the models that don't have a base URI are not upto the standards? what say? I...
sridevi polavaram
sridevi_mami
Offline Send Email
Aug 17, 2007
2:33 pm

... I wouldn't go that far. Though it is true that most models will define both an xml:base and a default namespace and relate the two in an obvious way. ... ...
Dave Reynolds
derihy
Offline Send Email
Aug 17, 2007
3:26 pm

... For some reason, the OntModel is returning values like this: 3ac1780f:1148518ebff:-7fd4 for the listHierarchyRootClasses() and when I tried to use...
sridevi polavaram
sridevi_mami
Offline Send Email
Aug 20, 2007
9:49 pm

... Those are blank nodes - the gibberish is the blank node's internal ID. ... They have no local name. (Insert DON'T USE getLocalName RANT here.) ... Ignore...
Chris Dollin
kers_ihy
Offline Send Email
Aug 21, 2007
8:21 am

I am really tired of working around with these methods. I could only get the immediate super class of the given search string input. even ...
sridevi polavaram
sridevi_mami
Offline Send Email
Aug 21, 2007
2:24 pm

... There are different ways of defining root classes. A solution that others have found useful is to take the actual root classes from the OntModel and...
Dave Reynolds
derihy
Offline Send Email
Aug 21, 2007
2:53 pm

... Protege and Jena have different rules for what counts as a root class. Jena allows all the blank nodes -- which are typically restrictions -- as answers,...
Chris Dollin
kers_ihy
Offline Send Email
Aug 21, 2007
3:07 pm

... I tried implementing above, something like Dave posted in last reply. But Still I cannot get the root classes. I guess they are just not defined in the owl...
sridevi polavaram
sridevi_mami
Offline Send Email
Aug 23, 2007
5:10 pm

On Thursday 23 August 2007 16:08, sridevi polavaram wrote: (fx:out-of-order-reply) ... That's likely part of your problem: that spec is for an OntModel that...
Chris Dollin
kers_ihy
Offline Send Email
Aug 24, 2007
8:58 am

... Could it be that owl:Thing is making you skip all the named classes in your ontology? Try adding a check on the namespace, like: //untested if(!r.isAnon()...
Ignazio Palmisano
ignazio_io
Offline Send Email
Aug 24, 2007
9:31 am

... Those look like roots of imported files. Try again with import processing switched off. By the way it looks like you are importing Protege specific...
Dave Reynolds
derihy
Offline Send Email
Aug 24, 2007
9:32 am
Advanced

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