0
votes

I'm working with a OWL API 3 / Pellet / SPARQL-DL stack and want to read the asserted TBox axioms of a certain class from an ontology.

I can easily access the axioms with OWL API. However, the OWLClassAxiom just provides function to access the signature without the connections. I.e. I want to know to which Class a ObjectProperty is assigned to. All I can retrieve is a set of all elements in the signature, without their connection.

It seems that OWL API does not really support working with given axioms on a class level well (Reading, not adding.) Or am I missing something? Any other ideas how to achieve that? (With whatever tools.)

Concrete Example: Pizza hasBase some PizzaTopping. I want to retrieve the value "PizzaTopping" by specifying Pizza and hasBase.

1

1 Answers

4
votes

If Pizza is a class, then

        Pizza hasBase some PizzaTopping

isn't a legal axiom. What you probably actually have is

        Pizza subClassof hasBase some PizzaTopping

That means that every instance of Pizza is related to some instance of PizzaTopping by the hasBase property. The axiom is a subclass axiom, so you'd want to retrieve an instance of OWLSubClassOfAxiom, (which is a subclass of OWLClassAxiom).

In this case, if you have a reference to the OWLClass for Pizza, then you could use OWLClass#getSuperclasses() to get a list of superclass expressions. One of them would be an OWLObjectSomeValuesFrom expression for (hasBase some PizzaTopping). You'd have to look for the ones of that type, and then examine the property that it is a restriction on.

That said, your stated goal

to know to which Class a ObjectProperty is assigned to

doesn't quite match up with the OWL model. Object properties (and data properties) don't "belong" to classes in OWL. You can use subclass axioms and property restrictions, like above, to say that members of a class must have a value for a particular property,