To: | "ontolog-forum-owner@xxxxxxxxxxxxxxxx" <ontolog-forum-owner@xxxxxxxxxxxxxxxx>, "ontolog-forum@xxxxxxxxxxxxxxxx" <ontolog-forum@xxxxxxxxxxxxxxxx>, "ontolog-forum-request@xxxxxxxxxxxxxxxx" <ontolog-forum-request@xxxxxxxxxxxxxxxx> |
---|---|
From: | fatemeh hosseini <fa.hosseinim@xxxxxxxxx> |
Date: | Sun, 26 Sep 2010 09:28:01 +0430 |
Message-id: | <AANLkTi=yextdPM6V9u-rvA_9fO0ScaOkuQ78O73e04K3@xxxxxxxxxxxxxx> |
dear all i use jena and java for ontology programming.I'm new to Java, and jena. I use Eclipse IDE. I have some problem (please help me)? 1-- how can i calculate distance between two classes in an ontology(number of links between two classes)?? 2-- how can i get mincardinality of a property for a given Class?
i tried to do it. i add these : import com.hp.hpl.jena.ontology.MinCardinalityQRestriction; import com.hp.hpl.jena.ontology.*; import com.hp.hpl.jena.ontology.Restriction; i write this code but it doesn't work correctly.(it gives all properties !!)
for (Iterator i = c.listDeclaredProperties(true); i.hasNext(); ) { //begin OntProperty op = (OntProperty) i.next(); System.out.println("op: " + op+" **class** "+c.getLocalName()); // restriction with a given URI Restriction r = m.getRestriction( c.getURI() ); // anonymous restriction on property op Restriction anonr = m.createRestriction( op ); //to convert the anonymous restriction MinCardinalityRestriction avf = anonr.convertToMinCardinalityRestriction(1); System.out.println("cardin*** " +avf.getOnProperty().getLocalName()); } //end output is this(+error): op: http://www.atl.lmco.com/projects/ontology/ontologies/animals/animalsA.owl#hasFemaleParent **class** Animal cardin+**+ hasFemaleParent op: http://www.atl.lmco.com/projects/ontology/ontologies/animals/animalsA.owl#hasFather **class** Animal cardin+**+ hasFather Exception in thread "main" java.lang.NullPointerException at pak2.ontology1.main(ontology1.java:445) 3- how can i get level of a resource in an ontology? thanks advance. fatemeh hosseini _________________________________________________________________ Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/ Config Subscr: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/ Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx Shared Files: http://ontolog.cim3.net/file/ Community Wiki: http://ontolog.cim3.net/wiki/ To join: http://ontolog.cim3.net/cgi-bin/wiki.pl?WikiHomePage#nid1J To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx (01) |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | Re: [ontolog-forum] OntoNotes and the Omega ontology, John F. Sowa |
---|---|
Next by Date: | Re: [ontolog-forum] semantic analysis was do not trust quantifiers, FERENC KOVACS |
Previous by Thread: | [ontolog-forum] OntoNotes was announced as a big project with large resources, FERENC KOVACS |
Next by Thread: | Re: [ontolog-forum] ontology programming (jena+java), Jack Park |
Indexes: | [Date] [Thread] [Top] [All Lists] |