Ajutor:What are domains and ranges?
- question:=What are domains and ranges?
- description:=Domain is the category that can use (instanciate) the property and range is the category whose instances can be used as values of the property.
Categories can have properties. For instance, an atom has an atomic weight, which is a number. Atom is the category and atomic weight is the attribute. So each instance of an atom has an atomic weight, e.g. 1.008 for Hydrogen.
Normally it is sufficient, to create a property (e.g. Property:atomic weight) and assign a type to it (e.g.[[has type::Type:float). The problem is, that the property can be used in every article of any category. In consequence, even a car could have an atomic weight.
To find out errors of this kind, the articles for properties should be annotated with a domain and range hint. The article for Property:atomic weight will contain the following line:
[[has domain hint::Category:Atom]]
The domain is the subject of a property, like the grammatical subject in a normal sentence: An atom has an atomic weight.
Properties can have a type like numbers, string, dates etc. or they can have an object, if they are of type page. For instance, a chemical reaction has a product of a molecule. In this case, the property is has product, its subject (domain) is a Chemical reaction (a category) and its object (called range) is a molecule (a category). So the property has product will be defined like this on the page Property:has product:
[[has domain hint::Category:Chemical reaction]] [[has range hint::Category:Molecule]]