Protégé dataTime restriction

4k Views Asked by At

I've a Data Property ShowTime with domain Show and range xsd:dateTime. I'd like to know if there is a way to assert that the dataTime range must be included in "2018-01-01TX:X:X", in order to have a fixed date and a variable hour on that date.

I've tried with Manchester Syntax:

xsd:dateTime[>="2018-01-01T00:00:00"^^xsd:dateTime, <"2018-01-01T00:00:00"^^xsd:dateTime]

But told me that the syntax is not correct.

P.S. I'm using HermiT.

Can someone help me? Thanks.

edited

Concrete example. Suppose we have a Show class, which represents the concept of a cinema show. Each show has date and a start time. So, we can trivially represent these informations through a data property showDateTime with domain Show and range xsd:dateTime (something like "2018-01-16T18:00:00").

The problem is that i need to categorize each show in a daily time slot (morning, afternoon, early evening, late night) according to the start time only. I tried with SWRL, property restriction... I haven't found a way to tell the reasoner not to consider the date, which obviously takes precedence over the time and messes me up.

So, i thought of dividing date and time into two separate properties (showDate and showTime), always of type xsd: dateTime, and placing a restriction on showTime binding it to have a fixed date (ex. 2018-01-01). In this way I could define the MorningShow class as follow:

 showTime some xsd:dateTime[>= "2018-01-01T07:00:00"^^xsd:dateTime ,
 <= "2018-01-01T13:00:00"^^xsd:dateTime]

This is the reason for my question.

1

There are 1 best solutions below

7
On

Manchester syntax enables you to create OWL ontologies. However, the semantics of OWL does not allow for what you are trying to do.

EDIT for your updated question

Defining the MorningShow class as you described is not going to work because:

(1) There is no way to dynamically change the definition of the class as you described.

(2) More importantly, it goes against the notion of a class which gives a fixed description of a set to which individuals belong/don't belong. What you have in mind boils down to a different MorningShow class for every possible date.

I was thinking there may be a way in SWRL in Protege to apply some function that will extract only the time. However, this is not the case.

The only other options are:

(1) Consider using the Time Ontology in OWL, though it may be an overkill.

(2) Define your own DateTime class which is the domain for the following data properties:

i. date with range xsd:dateTime,

ii. hours with range xsd:byte,

iii. minutes with range xsd:byte

ObjectProperty: showTime
    Domain:Show
    Range: DateTime

DataProperty: date
    Domain: DateTime
    Range: xsd:dateTime

DataProperty: hours
    Domain: DateTime
    Range:  xsd:byte[>= "0"^^xsd:byte , < "24"^^xsd:byte]

DataProperty: minutes
    Domain: DateTime
    Range: xsd:byte[>= "0"^^xsd:byte , < "60"^^xsd:byte]

Class: Afternoon
    EquivalentTo: hours some xsd:byte[>= "12"^^xsd:byte , < "17"^^xsd:byte]
    SubClassOf: DateTime

Class: DateTime
Class: Morning
    EquivalentTo: hours some xsd:byte[< "12"^^xsd:byte]
    SubClassOf: DateTime

Class: Show
    SubClassOf: showTime some ShowTime

Class: ShowTime
    SubClassOf: showTime exactly 1 DateTime

Individual: dt
    Facts: hours  "8"^^xsd:byte