Beginner EODM question [message #571601] |
Thu, 09 March 2006 02:58 |
Eclipse User |
|
|
|
Originally posted by: glenn.everitt.gmail.com
I think what I want to do is:
1. load an existing owl ontology
2. create a series of statements add them to the model
3. execute a couple of queries against the model (SPARQL queries?)
I downloaded the IODT toolkit from IBM alphaworks and I think the
LoadAndSaveOwlbyOWLFile shows me how to load and parse and owl document into
an owl ontology. (Please correct me if I am using terms incorrectly.)
OWLParser parser = new OWLParserImpl();
//New an OWL Document
OWLDocument food = new OWLDocumentImpl("./testcase/food.owl", null,
true);
//Add the document into the parser
parser.addOWLDocument(food);
//Start to parse OWL documents and get OWL ontologies
OWLOntology ontofood = parser.parseOWLDocument(food);
Now I want to add a statement
//create some RDF statement
RDFSFactory rdfsFactory = RDFSFactory.eINSTANCE;
RDFSResource subjectResource =
rdfsFactory.createRDFSResource(ontofood , subjectURI);
RDFProperty subjectProperty = rdfsFactory.createRDFProperty(ontofood
, predicateURI);
RDFSLiteral literal = rdfsFactory.createRDFSLiteral(ontofood ,
objectStringLiteral);
RDFStatement statement = rdfsFactory.createRDFStatement(ontofood ,
subjectResource, subjectProperty, literal);
Now is statement already in the ontofood ontology?
How would I go about writing a query to find the all subjectResource items
with the same subjectProperty?
Thanks for any help - Glenn
|
|
|
Powered by
FUDForum. Page generated in 0.02239 seconds