The first thing to do is to represent the identity morphism that all objects in category must have. This can be done simply by adding a reflexive and transitive object property hasIdentityMorphism with range Thing and domain Thing, so that all things have such identity property.
A second task to accomplish is to endow an ontology O with a terminal object class to represent the terminal object in the categorical completion C of O. I took the Pizza ontology and added a subclass TerminalObject to Thing. Also, in order to ensure "all things" have a terminal object, a transitive object property (terminalProperty) was added.
I use the Java OWLAPI to materialize these operations. These are the relevant lines of code for the two first steps explained above:
OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); IRI iri = IRI.create("http://www.co-ode.org/ontologies/pizza/pizza.owl"); OWLOntology pizzaOntology = manager.loadOntologyFromOntologyDocument(iri); OWLClass Thing = factory.getOWLClass(IRI.create("http://www.w3.org/2002/07/owl#Thing")); OWLClass TerminalObject = factory.getOWLClass(IRI.create(iri + "#TerminalObject")); OWLObjectProperty terminalProperty = factory.getOWLObjectProperty(IRI.create(iri + "#hasTerminalObject")); OWLTransitiveObjectPropertyAxiom TerminalObjectProperty = factory.getOWLTransitiveObjectPropertyAxiom(terminalProperty); manager.addAxiom(pizzaOntology, TerminalObjectProperty); SetterminalAxioms = new HashSet (); terminalAxioms.add(factory.getOWLObjectPropertyDomainAxiom(terminalProperty, Thing)); terminalAxioms.add(factory.getOWLObjectPropertyRangeAxiom(terminalProperty, TerminalObject)); terminalAxioms.add(factory.getOWLSubClassOfAxiom(TerminalObject, Thing)); manager.addAxioms(pizzaOntology, terminalAxioms); File file = new File("/tmp/catcomp_pizza.owl"); manager.saveOntology(pizzaOntology, owlxmlFormat, IRI.create(file.toURI()));
This is screenshot taken from a Protege/OntoGraf view on the new transformed ontology.
No comments:
Post a Comment