Search Mailing List Archives
[protege-discussion] Read Datatype property values
Thomas Russ
tar at ISI.EDU
Mon Sep 15 10:16:22 PDT 2008
On Sep 15, 2008, at 5:47 AM, Vivek Anandan wrote:
>
> Dear all,
> Consider the knowledge
>
> Men (class)
> hasLegs (DataType Property) datatype property value int
> hasHands(DataType Property) datatype property value int
>
> I create an Instanse Mr.X for Men and associate with the two data
> type properties for Men Now Mr.X and hasLegs 2 Mr.X hasHands 2
>
> I retieved till Mr.X and got two properties hasHands and hasLegs
> with the following code.
>
> How to get the value 2.
> Can any one suggest me an idea.
>
Take a look at the examples at:
http://protege.stanford.edu/plugins/owl/api/guide.html
and for reference, the javadoc at:
http://protege.stanford.edu/download/release-javadoc-owl/
The short answer to your specific question is:
RDFResource.getPropertyValue
>
> Thanks for the reply.
> try
>
> {
> FileReader owlFile = new FileReader("E:\\Test\\src\\test\
> \DataStructure.owl");
>
> JenaOWLModel owlModel =
> ProtegeOWL.createJenaOWLModelFromReader(owlFile);
>
> OWLNamedClass totalClass = owlModel.getOWLNamedClass("stack");
>
> Collection Instance = totalClass.getInstances(false);
>
> for (Iterator it = Instance.iterator(); it.hasNext();)
> {
> SimpleInstance simInstance = (SimpleInstance) it.next();
> String name = simInstance.getName();
>
> Collection prop = simInstance.getOwnSlots();
> for (Iterator its = prop.iterator(); its.hasNext();)
> {
> DefaultOWLDatatypeProperty propy = (DefaultOWLDatatypeProperty)
> its.next();
> System.out.println("\tDataTypeProperty : "+propy.getBrowserText());
> Collection subProperty = propy.getSubproperties(true);
> for (Iterator itsa = subProperty.iterator(); itsa.hasNext();)
> {
> DefaultOWLDatatypeProperty propSub = (DefaultOWLDatatypeProperty)
> itsa.next();
> System.out.println("\tDataTypeProperty :
> "+propSub.getBrowserText());
> }
> }
> }
>
> }
> catch(Exception ex)
> {
> System.out.println(ex.toString());
> }
>
> --
> Regards,
> Vivekanandan Ramachandran.
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
>
>
>
>
> --
> Regards,
> Vivekanandan Ramachandran.
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
More information about the protege-discussion
mailing list