I have a question about an OWL ontology that I am making. I have a class that is actually an ID class and I would li开发者_JS百科ke to have instances: first, second, third etc.
The first solution that I have figured is creating individuals {first, second, third etc} for this class, but then I have to write a huge number of individuals.
The other solution is to create a data property that will be connected with my class that has type "integer".
The second solution looks more appropriate but the thing is that I can't represent the word "first", just the number 1.
Do you know how I can do that?
You could create a class of ordinals that are uniquely identified by an integer, like so (in Turtle syntax):
:hasPosition a owl:DatatypeProperty, owl:FunctionalProperty ;
rdfs:range xsd:integer .
:Ordinal a owl:Class ;
rdfs:subClassOf [
a owl:Restriction ;
owl:onProperty :hasPosition ;
owl:someValuesFrom :integer
] ;
owl:hasKey ( :hasPosition ) .
Note the use of owl:hasKey
(introduced in OWL 2) which means that the value of :hasPosition
identifies a unique instance. The property is functional so that an instance cannot have two distinct positions.
精彩评论