Search code examples
javaowlowl-api

Declaration of object property using java OWL API


It's easy to create a declaration of OWL class i.e.

Declaration(Class(:ComponentIT))

using java OWL API v5:

OWLClass A = df.getOWLClass(IOR + "#ComponentIT");
OWLDeclarationAxiom da = df.getOWLDeclarationAxiom(A);

The question is how to create a declaration of object property (an axiom for inserting into the OWLOntology object) using OWL API, i.e.

Declaration(ObjectProperty(:hasValue))

Solution

  • The getOWLDeclarationAxiom() method works for the properties the same way as for the classes, i.e.

    OWLObjectProperty hasValue = df.getOWLObjectProperty(IOR + "#hasValue");
    OWLDeclarationAxiom d_hasValue = df.getOWLDeclarationAxiom(hasValue);