From school, “domain” is the scope of all possible inputs to a function and “range” is the scope of all possible outputs.
A guitar amp has a domain of 0 to 10[^1] dialed in on the knob, and the range is the audio level, going from silent to the loudest it gets.
![[IMG_1199.jpeg|350]]
Domain and range are also used in [[Protege]] to describe valid classes that can comprise the “from” and “to” ends of a given type of relationship.
![[IMG_1200.jpeg|350]]
# Range Validity
The entire concept of having a "range" implies that some results are impossible (or at least _invalid_). [[Pkl]] uses a neat syntax to capture range validity:
```pkl
port: Int(this > 1000) = 90 //would flag as an error
```
# In [[Ontology]]
In the formal representation of ontologies, Domain is the set of classes that can fill the "from" end of an arrow linking two entities, and Range is the set of all classes (or [[Data Types]], in the case of Datatype Properties) that can fill the "to" end of the arrow.
The [[Turtle]] syntax for asserting domain and range:
```turtle
:ownsDog rdfs:domain :Human ;
rdfs:range :Dog .
```
or.
```turtle
:hasAge rdfs:domain :Person ;
rdfs:range xsd:nonNegativeInteger .
```
****
# More
## Source
- Messing with [[Protege]]
## Related
- [[Tradespace]]
[^1]: Spinal Tap not withstanding