From: Wynne, R. (NIH/N. [C] <wy...@ma...> - 2013-05-28 14:51:03
|
I was able to do this using the OWLDataFactory. Here is my code. I had to get the SuperProperties first, and then create an OWLSubObjectPropertyOfAxiom to be applied to the extraction ontology. public void loadObjectProperties() { Set<OWLObjectProperty> obProps = ontology.getObjectPropertiesInSignature(); for (OWLObjectProperty obProp : obProps) { Set<OWLObjectPropertyExpression> sups = obProp.getSuperProperties(ontology); for( OWLObjectPropertyExpression sup : sups ) { OWLDataFactory factory = extractionManager.getOWLDataFactory(); OWLSubObjectPropertyOfAxiom ax = factory.getOWLSubObjectPropertyOfAxiom(obProp, sup); extractionManager.addAxiom(extractionOntology, ax); } Set<OWLAnnotationAssertionAxiom> annoAxioms = obProp.getAnnotationAssertionAxioms(ontology); for (OWLAnnotationAssertionAxiom annoAx : annoAxioms) { extractionManager.addAxiom(extractionOntology, annoAx); } Set<OWLObjectPropertyDomainAxiom> domains = ontology.getObjectPropertyDomainAxioms(obProp); for (OWLObjectPropertyDomainAxiom domain : domains){ extractionManager.addAxiom(extractionOntology, domain); } Set<OWLObjectPropertyRangeAxiom> ranges = ontology.getObjectPropertyRangeAxioms(obProp); for (OWLObjectPropertyRangeAxiom range: ranges){ extractionManager.addAxiom(extractionOntology, range); } } } Thanks, Rob From: Igor Toujilov [mailto:nam...@ma...] Sent: Sunday, May 26, 2013 5:38 PM To: owl...@li... Subject: Re: [OWLAPI-developer] subPropertyOf To extract a smaller ontology from the source ontology, the existing tools for module extraction are normally useful. However if you need a more customized transformation of the ontology, you can program it manually, using the OWL API, after module extraction. Typically manipulations on an ontology in the OWL API involve creating new entities and axioms, inserting them to the list of changes, applying the changes, and then saving the ontology. And deletion of entities and axioms is programmed in a similar way. I do not know the details of your intentions: why you want to get rid of the super-properties. If the intention is just to reduce the ontology size, an automatic module extraction would do the job. And if the super-properties remain in the extracted module, I would not bother to program manually the further transformation to delete them: extract domains and ranges of the super-properties, apply them to the sub-properties, using new axioms, and then delete the super-properties. Cheers, Igor ----- Original Message ----- From: Wynne, Robert (NIH/NCI) [C] Sent: 05/26/13 05:46 PM To: owl...@li...<mailto:owl...@li...> Subject: Re: [OWLAPI-developer] subPropertyOf Thanks for the reply! I should had been more specific about my goal. I'm trying to extract a smaller ontology from the source (so importing defeats the purpose). I want to keep the ObjectProperties from the source. I can keep everything contained in the ObjectProperties but the rdfs:subPropertyOf axioms. Does anyone know how I can apply them to a new ontology? Rob ________________________________________ From: Igor Toujilov [nam...@ma...] Sent: Sunday, May 26, 2013 7:39 AM To: owl...@li...<mailto:owl...@li...> Subject: Re: [OWLAPI-developer] subPropertyOf Hi Rob, If you import the source ontology into the new one, there is no need to copy anything. Regards, Igor -- Sent from my Android phone with mail.com<http://mail.com> Mail. "Wynne, Robert (NIH/NCI) [C]" <wy...@ma...<mailto:wy...@ma...>> wrote: Hi all, How would I copy a subPropertyOf axiom into a new ontology? From my source ontology such as: <owl:ObjectProperty rdf:about="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Allele_Absent_From_Wild-type_Chromosomal_Location"> … <rdfs:subPropertyOf> <owl:ObjectProperty rdf:about="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Gene_In_Chromosomal_Location"/> </rdfs:subPropertyOf> </owl:ObjectProperty> Without it (in a Protégé view), I lose the domain and range that is inherited from the parent. Thanks, Rob ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ Owlapi-developer mailing list Owl...@li...<mailto:Owl...@li...> https://lists.sourceforge.net/lists/listinfo/owlapi-developer |