I am using protege 5 for developing ontology. I have created has_composition as object property. In my ontology the same object_property is used for different domai
OWL (Ontology Web Language, the ontology that defines ontologies) does not allow to model what you're trying to do.
A workaround I can think of is to use sub-properties. Imagine the following classes:
PizzaTomatoSauceChocolateCakeChocolateIf you want to define relations such as
Pizza has_composition TomatoSauce, andChocolateCake has_composition Chocolatethen define the following relations:
has_composition: No domain nor range (or a common superclass such as Dish and Ingredient for example)
has_tomato_sauce: Domain Pizza, range TomatoSaucehas_chocolate: Domain ChocolateCake, range ChocolateThis will allow the reasoner (the software that computes inferences) to infer that if something has_chocolate a_chocolate, then
something rdf:type Chocolate (inferred by the domain of has_chocolate);something has_composition a_chocolate (because has_chocolate is a sub-property of has_composition).You can check out this example in this Gist I made.
Download it, open it, and start the reasoner. You will see the inferred statements in yellow.