tags:

views:

66

answers:

2

HI,

in my ontology i have the class called "festival" and it has property value called "CRISTMAS". it's a string type value.. son how can i get this value using JENA owl api..

CAN ANY ONE SHOW ME THE WAY ::::::

THANKS

A: 
  1. Load your ontology into an OntModel. I assume you did that already.

  2. Use the getProperty(String uri) method of the OntModel to retrieve the property.

  3. Use the getOntClass(String uri) method of the OntModel to retrieve the class. It returns an OntClass.

  4. Use the getPropertyValue(Property property) method of the OntClass to get the value. It returns an RDFNode.

  5. To turn the RDFNode into a string, either use simply toString(), or do myRDFNode.asLiteral().getString().

cygri
A: 

hi. i a new. its my first java and ontology program. how can i load the ontology that define in my local machine and access the classes ? thanks:::

fateme.hosseini
U CAN LORD THE ONTOLOGY BY USING URL of the OWL file....string ns = "base uri of the owl file"..it's easy for u to starts a new thread and find the answers..this help u