DateTime and comparison.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

DateTime and comparison.

fily1212
This post was updated on .
Hi,
I ask you help for an university exam.

I have a data property "startDate" that I have tried to model with
xsd:dateTime and a new datatype that I have (tried to) define.

With xsd:dateTime the Reasoner find an inconsistency with every date. I have
tried all of  this format <https://www.w3.org/TR/xmlschema-2/#dateTime>  .
For example
<\br>
<http://protege-project.136.n4.nabble.com/file/t376995/mgleJqW.png> .

For the new datatype that I have defined, according with  this
<https://www.w3.org/TR/xmlschema11-2/#dateTime>  , I have tried to write as
Data range expression this regular expression: -?([1-9][0-9]{3,}|0[0-9]{3})
-(0[1-9]|1[0-2])
-(0[1-9]|[12][0-9]|3[01])
T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?

but when I press OK the datatype definition become "rdfs:Literal" and I can
write all and the reasoner doesn't give me inconsistency.

What is it wrong?


After I understand this, I want to "compare" date.
For example assume we have an entity Person that has a birthDate. I want to
create a subclass "President" that is a Person that "manage some Firm" and
has more than 18 years old. Or better, I want that if a person with 17 y/o
manages a firm the reasoner give me an inconsistency.
Or assume we have an entity "Event". A person can join only at one event
every day (he can't be in two places in the same time). If I use dateTime
how I can compare two date and check there are only one Event per Person
every day?

Thanks so much.

Filippo






--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
protege-user@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparizon.

Lorenz B.

Not sure if I understood everything correctly, but why do you define a new datatype with a regex? this will only work on string datatype.

In your image, it's an inconsistency because you defined the range of the property as xsd:dateTime, but the literal used in the data property assertion is just a plain string. You have to use the appropriate datatype on the literal as well.


Note, you can define facets like minInclusive etc. on xsd:dateTime

Hi, 
I ask you help for an university exam. 

I have a data property "startDate" that I have tried to model with
xsd:dateTime and a new datatype that I have (tried to) define.

With xsd:dateTime the Reasoner find an inconsistency with every date. I have
tried all of  this format <https://www.w3.org/TR/xmlschema-2/#dateTime>  .
For example 
<\br>
<http://protege-project.136.n4.nabble.com/file/t376995/mgleJqW.png> .

For the new datatype that I have defined, according with  this
<https://www.w3.org/TR/xmlschema11-2/#dateTime>  , I have tried to write as
Data range expression this regular expression: -?([1-9][0-9]{3,}|0[0-9]{3})
-(0[1-9]|1[0-2])
-(0[1-9]|[12][0-9]|3[01])
T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?

but when I press OK the datatype definition become "rdfs:Literal" and I can
write all and the reasoner doesn't give me inconsistency. 

What is it wrong? 


After I understand this, I want to "compare" date. 
For example assume we have an entity Person that has a birthDate. I want to
create a subclass "President" that is a Person that "manage some Firm" and
has more than 18 years old. Or better, I want that if a person with 17 y/o
manages a firm the reasoner give me an inconsistency. 
Or assume we have an entity "Event". A person can join only at one event
every day (he can't be in two places in the same time). If I use dateTime
how I can compare two date and check there are only one Event per Person
every day? 

Thanks so much. 

Filippo






--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparizon.

fily1212
Thanks for your reply!

I have defined a new datatype because I can't insert the date and I don't
know how insert.

So I have to convert the plain string in xsd:dateTime, is it correct?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparizon.

Lorenz B.

Thanks for your reply!

I have defined a new datatype because I can't insert the date and I don't
know how insert. 

Can't insert the date where? As value for an individual? Why not? What happens? Which literal fails?

You just have to write

2019-02-02T15:00:00

and select the datatype in the "Type" box below


So I have to convert the plain string in xsd:dateTime, is it correct? 



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparison

fily1212
This post was updated on .
thanks, and sorry for my noob question.

Now I have two instance of "Event" with two dateTime, for instance
2019-02-02T15:00 and 2019-02-02T18:00.
I don't want that a "Person" may have two properties with this two events
because they are in the same day.
I think *minInclusive* is not enought... How I can compare only the /day/ of
each datetime?

Maybe is it necessary a SWRL rule?


Another thing I'm interested to do is create a rule like:
if a Person is older than 65 (calculating by the birthDate, dataTime data property and today's date) he is an OldPerson.

How I can count the years of a dateTime?
--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
protege-user@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparison

Lorenz B.
At least in OWL it's not possible, so most likely SWRL with temporal extension is the only way to achieve this if even possible. Note, in the end OWL/SWRL is about inference and not a constraint language. For proper contraints, SHACL would be more appropriate.

thanks, and sorry for my noob question. 

Now I have two instance of "Event" with two dateTime, for instance
2019-02-02T15:00 and 2019-02-02T18:00. 
I don't want that a "Person" may have two properties with this two events
because they are in the same day.
I think *minInclusive* is not enought... How I can compare only the /day/ of
each datetime? 

Maybe is it necessary a SWRL rule? 



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparison

Igor Toujilov-2

I think it was a strategic mistake to drag the XML dateTime data-type and mechanically drop it to the OWL standard. A proper integration should be done instead with a temporal OWL ontology, representing the year, the month, the day, and so on, as native OWL properties. Then some cases could be implemented even without SWRL, and everything could be implemented in SWRL without temporal built-ins.

Such temporal OWL ontology will be eventually implemented, or is already there, but still not famous/mature.

For now I recommend implementing something similar for your use case in pure OWL. I do not like treating compound data-types (like XSD dateTime) as native in OWL. This is challenging, but if you are bold enough, implement the temporal ontology of this kind, unless it already exists somewhere.

 

Cheers,

Igor

 

 
 
Sent: Thursday, February 14, 2019 at 1:21 PM
From: "Lorenz B." <[hidden email]>
To: [hidden email]
Subject: Re: [protege-user] DateTime and comparison
At least in OWL it's not possible, so most likely SWRL with temporal extension is the only way to achieve this if even possible. Note, in the end OWL/SWRL is about inference and not a constraint language. For proper contraints, SHACL would be more appropriate.
 
thanks, and sorry for my noob question.

Now I have two instance of "Event" with two dateTime, for instance
2019-02-02T15:00 and 2019-02-02T18:00.
I don't want that a "Person" may have two properties with this two events
because they are in the same day.
I think *minInclusive* is not enought... How I can compare only the /day/ of
each datetime?

Maybe is it necessary a SWRL rule?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
_______________________________________________ protege-user mailing list [hidden email] https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparison

Michael DeBellis-2
Igor, There are at least two time ontologies already, one defined to work with the SWRL builtins.  Have you looked at this: https://github.com/protegeproject/swrlapi/wiki/SWRLTemporalOntology  There is also this one: https://lov.linkeddata.es/dataset/lov/vocabs/time   When I downloaded the first ontology into mine (this was a long time ago) there were a couple attributes missing that I had to define, my guess is that's been fixed by now. 

I can see why people use the xsd:dateTime though because with the SWRL ontology you ended up creating an awful lot of time objects for any application with realistic requirements for representing times. It's very powerful but (at least it seemed to me) kind of object heavy. 

Michael

On Fri, Feb 15, 2019 at 3:48 PM Igor Toujilov <[hidden email]> wrote:

I think it was a strategic mistake to drag the XML dateTime data-type and mechanically drop it to the OWL standard. A proper integration should be done instead with a temporal OWL ontology, representing the year, the month, the day, and so on, as native OWL properties. Then some cases could be implemented even without SWRL, and everything could be implemented in SWRL without temporal built-ins.

Such temporal OWL ontology will be eventually implemented, or is already there, but still not famous/mature.

For now I recommend implementing something similar for your use case in pure OWL. I do not like treating compound data-types (like XSD dateTime) as native in OWL. This is challenging, but if you are bold enough, implement the temporal ontology of this kind, unless it already exists somewhere.

 

Cheers,

Igor

 

 
 
Sent: Thursday, February 14, 2019 at 1:21 PM
From: "Lorenz B." <[hidden email]>
To: [hidden email]
Subject: Re: [protege-user] DateTime and comparison
At least in OWL it's not possible, so most likely SWRL with temporal extension is the only way to achieve this if even possible. Note, in the end OWL/SWRL is about inference and not a constraint language. For proper contraints, SHACL would be more appropriate.
 
thanks, and sorry for my noob question.

Now I have two instance of "Event" with two dateTime, for instance
2019-02-02T15:00 and 2019-02-02T18:00.
I don't want that a "Person" may have two properties with this two events
because they are in the same day.
I think *minInclusive* is not enought... How I can compare only the /day/ of
each datetime?

Maybe is it necessary a SWRL rule?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
_______________________________________________ protege-user mailing list [hidden email] https://mailman.stanford.edu/mailman/listinfo/protege-user
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: DateTime and comparison

Igor Toujilov-2

Hi Michael,

Thank you for pointing at the two existing ontologies about time. I had not seen them before, and will have a look at them later.

 

If we would have proper automation tools, then “object heavy” ontologies will not be a problem.

We need:

  • A high-quality recognised/standardised temporal ontology (the time object representation); one of those two ontologies might be a candidate;

  • Command line tools for automatically converting the time object representation to XSD dateTime and the reverse conversion;

  • A Protégé plug-in for automating basic tasks for the temporal ontology.

Regards,

Igor

 
 
Sent: Saturday, February 16, 2019 at 6:56 PM
From: "Michael DeBellis" <[hidden email]>
To: "User support for WebProtege and Protege Desktop" <[hidden email]>
Subject: Re: [protege-user] DateTime and comparison
Igor, There are at least two time ontologies already, one defined to work with the SWRL builtins.  Have you looked at this: https://github.com/protegeproject/swrlapi/wiki/SWRLTemporalOntology  There is also this one: https://lov.linkeddata.es/dataset/lov/vocabs/time   When I downloaded the first ontology into mine (this was a long time ago) there were a couple attributes missing that I had to define, my guess is that's been fixed by now. 
 
I can see why people use the xsd:dateTime though because with the SWRL ontology you ended up creating an awful lot of time objects for any application with realistic requirements for representing times. It's very powerful but (at least it seemed to me) kind of object heavy. 
 
Michael
 
On Fri, Feb 15, 2019 at 3:48 PM Igor Toujilov <[hidden email]> wrote:

I think it was a strategic mistake to drag the XML dateTime data-type and mechanically drop it to the OWL standard. A proper integration should be done instead with a temporal OWL ontology, representing the year, the month, the day, and so on, as native OWL properties. Then some cases could be implemented even without SWRL, and everything could be implemented in SWRL without temporal built-ins.

Such temporal OWL ontology will be eventually implemented, or is already there, but still not famous/mature.

For now I recommend implementing something similar for your use case in pure OWL. I do not like treating compound data-types (like XSD dateTime) as native in OWL. This is challenging, but if you are bold enough, implement the temporal ontology of this kind, unless it already exists somewhere.

 

Cheers,

Igor

 

 
 
Sent: Thursday, February 14, 2019 at 1:21 PM
From: "Lorenz B." <[hidden email]>
To: [hidden email]
Subject: Re: [protege-user] DateTime and comparison
At least in OWL it's not possible, so most likely SWRL with temporal extension is the only way to achieve this if even possible. Note, in the end OWL/SWRL is about inference and not a constraint language. For proper contraints, SHACL would be more appropriate.
 
thanks, and sorry for my noob question.

Now I have two instance of "Event" with two dateTime, for instance
2019-02-02T15:00 and 2019-02-02T18:00.
I don't want that a "Person" may have two properties with this two events
because they are in the same day.
I think *minInclusive* is not enought... How I can compare only the /day/ of
each datetime?

Maybe is it necessary a SWRL rule?



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user

--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
_______________________________________________ protege-user mailing list [hidden email] https://mailman.stanford.edu/mailman/listinfo/protege-user
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
_______________________________________________ protege-user mailing list [hidden email] https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user