Protege datatype restriction

2019-09-06 23:37发布

问题:

I have populated my ontology with data defining among others Hour. Now, I want to make a restriction on that specific datatype (hour) which is defined as int and has values from 0-23. The restriction would be set on the division of the hour according to day and night for example (hour min 6 int) and (hour max 17 int) for the day and that defined as object Property isDay, but the problem is the inferences does not happen. Thank you in advance, Eliot

回答1:

You can create a :DayEvent class as subclass of :Event and then declare restriction on the dataType property :hour for the range you want to specify as day slot, say 6 <= DayEvent hour <=17, this way:

:DayEvent rdf:type owl:Class ;

      owl:equivalentClass [
                     rdf:type owl:Restriction ;
                     owl:onProperty :hour ;
                     owl:someValuesFrom [ rdf:type rdfs:Datatype ;
                                     owl:onDatatype xsd:integer ;
                                     owl:withRestrictions ( 
                                                 [ xsd:minInclusive 6]
                                                 [ xsd:maxInclusive 17]
                                                )
                                         ]
                          ] ;

      rdfs:subClassOf :Event .

Then all individuals with dataType property :hour having values within the specified range will be inferred as members of :DayEvent.

This would work at least with Protégé 4.3 and 5, with reasoners HermiT, FaCT++ and Pallet.

The equivalent class definition will look in Protégé syntax like this: hour some xsd:integer[>= 6 , <= 17] .