Search Mailing List Archives
[protege-discussion] (no subject)
Vivek Anandan
rvivekanandan at gmail.com
Mon Sep 15 05:43:24 PDT 2008
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.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20080915/0e140d53/attachment.html>
More information about the protege-discussion
mailing list