From: Daniel A. <Dan...@un...> - 2011-10-31 14:33:16
|
Hi everybody, I'm searching for a Way to build a new class using the OWL-API, The Class is described in Protégé 4.1 using curly braces to capsule the Individuals. A Class describtion and the the resulting desired OWL is attached below. And of course my try to Build a class like it in OWL-API. I hope somebody is able to help. Many Thanks in Advance Daniel ================================================= In Protégé 4.1: ================================================= Testclass: Equivalent classes: has_character some pretreatment has_solids_content some{60.4} has_substance some ({Fibers}) has_substance some ({Glucose}) has_substance some ({Fatty_acids}) Where Fibers, Glucose and Fatty_acids are individuals ============================================== The Resulting OWL after saving the Ontology ============================================== <!-- http://www.test.me/general.owl#testclass --> <Class rdf:about="&general;testclass"> <equivalentClass> <Restriction> <onProperty rdf:resource="&general;has_substance"/> <someValuesFrom> <Class> <oneOf rdf:parseType="Collection"> <rdf:Description rdf:about="&general;Fibers"/> </oneOf> </Class> </someValuesFrom> </Restriction> </equivalentClass> <equivalentClass> <Restriction> <onProperty rdf:resource="&general;has_solids_content"/> <someValuesFrom> <rdfs:Datatype> <oneOf> <rdf:Description> <rdf:type rdf:resource="&rdf;List"/> <rdf:first rdf:datatype="&xsd;double">60.4</rdf:first> <rdf:rest rdf:resource="&rdf;nil"/> </rdf:Description> </oneOf> </rdfs:Datatype> </someValuesFrom> </Restriction> </equivalentClass> <equivalentClass> <Restriction> <onProperty rdf:resource="&general;has_substance"/> <someValuesFrom> <Class> <oneOf rdf:parseType="Collection"> <rdf:Description rdf:about="&general;Glucose"/> </oneOf> </Class> </someValuesFrom> </Restriction> </equivalentClass> <equivalentClass> <Restriction> <onProperty rdf:resource="&general;has_character"/> <someValuesFrom rdf:resource="&general;pretreatment"/> </Restriction> </equivalentClass> <equivalentClass> <Restriction> <onProperty rdf:resource="&general;has_substance"/> <someValuesFrom> <Class> <oneOf rdf:parseType="Collection"> <rdf:Description rdf:about="&general;Fatty_acids"/> </oneOf> </Class> </someValuesFrom> </Restriction> </equivalentClass> </Class> ==================================================== My Try to add this class via the OWL-API ==================================================== //new Class OWLClass processclass = this.manager.getOWLDataFactory().getOWLClass(IRI.create("http://www.test.me/general.owl#testclass")); //individuals OWLIndividual ind1 = manager.getOWLDataFactory().getOWLNamedIndividual(IRI.create("http://www.test.me/general.owl#Glucose")); OWLIndividual ind2 = manager.getOWLDataFactory().getOWLNamedIndividual(IRI.create("http://www.test.me/general.owl#Fibers")); //has_substance relation OWLObjectProperty op1 = manager.getOWLDataFactory().getOWLObjectProperty(IRI.create("http://www.test.me/general.owl#has_substance")); //Object ONe of OWLObjectOneOf ooo1 = manager.getOWLDataFactory().getOWLObjectOneOf(ind1); //RelationAXIOM //OWLAxiom axiom = manager.getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(op1, processclass.asOWLNamedIndividual(), ooo1.asObjectUnionOf().asOWLClass().asOWLNamedIndividual()); //OWLAxiom axiom = manager.getOWLDataFactory().getOWLObjectPropertyAssertionAxiom(op1, ind1,ind2); //Add to tontology manager.addAxiom(ontology, axiom); |