Reputation: 69
I am currently try to design an ontology but I am a new in this area. My ontology will have classes and object properties. No individual will be available.
I have an object property called Has
. This property will have multiple domains and ranges. For example:
Student (Class Domain) Has (Object Property) Department (Class Range)
Mother (Class Domain) Has (Object Property) Child (Class Range)
Organisation (Class Domain) Has (Object Property) Department (Class Range)
I also expect more domains and ranges for the Has
property to be added. I expect to have lot of object properties which will have multiple domains and ranges.
How to write Java code to store such information in an OWL file? Furthermore, I would like to know:
How to make a query to know how many domains and ranges a specific object property have and which domain matches which range?
How to write a code for finding does an object property has a specific triple? For example, Has (School, Department)
. This triple means a School has a Department. If this triple is not available in the ontology, then I need to insert it into the ontology.
Upvotes: 1
Views: 1112
Reputation: 10659
Declaring domains and ranges with OWL API is done by creating OWLObjectPropertyDomainAxiom and OWLObjectPropertyRangeAxiom objects.
However, from your description of the problem I do not think that multiple domains and ranges for the same property are the best modelling solution. It's probably a better choice to have multiple object properties with their own domain and range, using multiple ones only when required.
For examples see https://github.com/owlcs/owlapi/wiki/Documentation
Upvotes: 2