I'm using pizza ontology, and there is this object property called hasCountryOfOrigin. This object property doesn't have specific domain and range, probably because the domain can be pizza or pizzaTopping. For other object properties, for example hasBase, I can find where it's used with ontology.getAxioms(AxiomType.OBJECT_PROPERTY_DOMAIN) because it has domain and range. So how can I find where hasCountryOfOrigin is used using OWLAPI?
Asked
Active
Viewed 457 times
1 Answers
0
You can use:
Searcher.values(ontology.axioms(AxiomType.OBJECT_PROPERTY_ASSERTION), property);
This will provide all assertions that have property
as the property, e.g., all axioms of the form subject property value
.
You can then iterate over the axioms and check the types for the subject and object to infer possible domains and ranges from usage.
(Note that these do not force the property to have these classes as domains or ranges; it's just that those classes would not surprise a reasoner or a human looking at the ontology, if they were to be asserted to be domains or ranges of the property.)

Ignazio
- 10,504
- 1
- 14
- 25
-
Hi, thanks for the reply, I still don't understand though. Searcher.values returns Collection
, so I have to infer possible domains and ranges from the Individual? If that's the case, pizza ontology only has individual for country not for pizza so Collection – peculiar Mar 12 '17 at 05:21is empty -
That's a problem - you cannot find the usage of a property that's not used. – Ignazio Mar 12 '17 at 09:01
-
but it's used as class definition, for example "American" (a subclass of pizza) hasCountryOfOrigin America in it's definition, so how can I find other class that also has this object property? – peculiar Mar 12 '17 at 09:15
-
Uhm, in this case the situation is much more complex. You'll have to iterate over all the axioms, and write your own OWLAxiomVisitor to visit the axiom components and find references to the property. You can reduce the number of axioms to inspect checking that the signature of the axiom contains the property you're interested in, but there are no utilities already in the OWL API to carry out this specific task. – Ignazio Mar 13 '17 at 23:37