Time constraint in SPARQL Query

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

Time constraint in SPARQL Query

Talya
Dears,

I will explain my problem with a real example.

I have an ontology composed of three classes (patient, event, time) an
object property has-event between Patient and Event classes and an object
property has-time between event and Time. the class patient is instantiated
with the PA and PB, the event is instantiated by E1 and E2 Time is
instantiated by T1, T2, T3, T4. I have now a relation between PA and E1
(has-event) and E1 has time (T1 and T2), of the same I have PB has-event E1
but in time T3. Therefore, I have a relation has-event (PA and E2) E2
has-time T4).

Here I found two main problems:

First how to differentiate between the time of E1 in Ptaient1 and Ptaient2.
Second How to retrieve (by SPARQL Query) the recent event that attacks the
patient (PA).
I have to compare between T1, T2 and T4 and choose for example E2 if T4 is
more recent from T1 and T3.

Thanks in advance for your help

Best regards,



--
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: Time constraint in SPARQL Query

samsontu
Talya,

Your description of the relationships among the Patient, Even, and Time instances doesn’t appear to be a consistent graph. For example, how can a single event E1 has different associated times depending whether E1 is associated with PA or PB? 

Why don’t you write them as a collection of triplets. For example:

PA has_event E1 .
E1 has_time T1.
PA has_event E1.
E2 has_time T4 .
etc.

With best regards,
Samson


On Jul 2, 2018, at 4:09 PM, Talya <[hidden email]> wrote:

Dears,

I will explain my problem with a real example.

I have an ontology composed of three classes (patient, event, time) an
object property has-event between Patient and Event classes and an object
property has-time between event and Time. the class patient is instantiated
with the PA and PB, the event is instantiated by E1 and E2 Time is
instantiated by T1, T2, T3, T4. I have now a relation between PA and E1
(has-event) and E1 has time (T1 and T2), of the same I have PB has-event E1
but in time T3. Therefore, I have a relation has-event (PA and E2) E2
has-time T4).

Here I found two main problems:

First how to differentiate between the time of E1 in Ptaient1 and Ptaient2.
Second How to retrieve (by SPARQL Query) the recent event that attacks the
patient (PA).
I have to compare between T1, T2 and T4 and choose for example E2 if T4 is
more recent from T1 and T3.

Thanks in advance for your help

Best regards,



--
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


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

Re: Time constraint in SPARQL Query

Talya
Thanks for your reply,

In fact, this is my problem and I did not succeed to resolve it.

In fact, a patient can have a medical event (hyperthermia) during different
time. Patient X also can have this event. How to differentiate between which
is for patient X and which is for patient Y.

I did not understand your example, but in my case different patients can
have the same event (hyperthermia) in different time.

Best Regards,



--
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: Time constraint in SPARQL Query

samsontu
Talya,

One way to think about it is that two patients may have “the same disease D” in the sense that each of them experiences an event of the type D. For example, patient X experiences hyperthermia001 and patient Y experiences hyperthermia002. hyperthermia001 (which occurs at time T1) and hyperthermia002 (which occurs at time T2) are different instances of the class Hyperthermia. The disease events that two patients experience are different events.

With best regards,
Samson


On Jul 3, 2018, at 2:50 AM, Talya <[hidden email]> wrote:

Thanks for your reply,

In fact, this is my problem and I did not succeed to resolve it.

In fact, a patient can have a medical event (hyperthermia) during different
time. Patient X also can have this event. How to differentiate between which
is for patient X and which is for patient Y.

I did not understand your example, but in my case different patients can
have the same event (hyperthermia) in different time.

Best Regards,



--
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


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

Re: Time constraint in SPARQL Query

Talya
Dear,

Ok its clear, so the only solution is to create different instances of the
same disease.
and How can I retrieve just the recent disease with SPARQL Query.

For example, I have PatintX with Disease D1 at Time, T1 and Disease D2 at
Time T2. I want to retrieve the recent disease of the patient (compare
between T1 and T2 ad choose the greater one) with SPARQL Language.

Best regards



--
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: Time constraint in SPARQL Query

samsontu
Use “order by desc(…) limit 1” to sort the query results by time (most recent first) and then limit the number of in query results to 1.

With best regards,
Samson



On Jul 3, 2018, at 6:12 AM, Talya <[hidden email]> wrote:

Dear,

Ok its clear, so the only solution is to create different instances of the
same disease.
and How can I retrieve just the recent disease with SPARQL Query.

For example, I have PatintX with Disease D1 at Time, T1 and Disease D2 at
Time T2. I want to retrieve the recent disease of the patient (compare
between T1 and T2 ad choose the greater one) with SPARQL Language.

Best regards



--
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


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

Re: Time constraint in SPARQL Query

Michael DeBellis-2
In reply to this post by Talya
Talya, I haven't been following this thread very closely so perhaps I'm missing something but I think what you may need to do is to distinguish between a kind of event (i.e., a class: Hyperthermia) and an individual event: HyperthermiaPatientX, HyperthermiaPatientY, etc. The class would have properties for the startTime of the Event, the endTime, the Person who is having the Hyperthermia (PatientX, PatientY), etc. Each individual instance of the Event class would have (different) values for the startTime, endTime, patient, etc. I think that is the same solution that Samson described in a previous message. 

Also, FYI, there is a very rich model of time included in the SWRL model: https://github.com/protegeproject/swrlapi/wiki/ModellingTime   

I have a model of Events in my ontology and I make my Event class a subclass of the ExtendedProposition class that is in the SWRL Time ontology. That gives all kinds of sophisticated ways for reasoning about time via SWRL rules. 

Michael

On Tue, Jul 3, 2018 at 2:50 AM, Talya <[hidden email]> wrote:
Thanks for your reply,

In fact, this is my problem and I did not succeed to resolve it.

In fact, a patient can have a medical event (hyperthermia) during different
time. Patient X also can have this event. How to differentiate between which
is for patient X and which is for patient Y.

I did not understand your example, but in my case different patients can
have the same event (hyperthermia) in different time.

Best Regards,



--
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


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

Re: Time constraint in SPARQL Query

Lorenz Buehmann

Or the OWL Time ontology [1] ...

[1] https://www.w3.org/TR/owl-time/

On 03.07.2018 18:43, Michael DeBellis wrote:
Talya, I haven't been following this thread very closely so perhaps I'm missing something but I think what you may need to do is to distinguish between a kind of event (i.e., a class: Hyperthermia) and an individual event: HyperthermiaPatientX, HyperthermiaPatientY, etc. The class would have properties for the startTime of the Event, the endTime, the Person who is having the Hyperthermia (PatientX, PatientY), etc. Each individual instance of the Event class would have (different) values for the startTime, endTime, patient, etc. I think that is the same solution that Samson described in a previous message. 

Also, FYI, there is a very rich model of time included in the SWRL model: https://github.com/protegeproject/swrlapi/wiki/ModellingTime   

I have a model of Events in my ontology and I make my Event class a subclass of the ExtendedProposition class that is in the SWRL Time ontology. That gives all kinds of sophisticated ways for reasoning about time via SWRL rules. 

Michael

On Tue, Jul 3, 2018 at 2:50 AM, Talya <[hidden email]> wrote:
Thanks for your reply,

In fact, this is my problem and I did not succeed to resolve it.

In fact, a patient can have a medical event (hyperthermia) during different
time. Patient X also can have this event. How to differentiate between which
is for patient X and which is for patient Y.

I did not understand your example, but in my case different patients can
have the same event (hyperthermia) in different time.

Best Regards,



--
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



_______________________________________________
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: Time constraint in SPARQL Query

Lorenz Buehmann
In reply to this post by samsontu

Don't forget to use proper literals that are comparable w.r.t. time ... don't use String values


On 03.07.2018 16:37, Samson Tu wrote:
Use “order by desc(…) limit 1” to sort the query results by time (most recent first) and then limit the number of in query results to 1.

With best regards,
Samson



On Jul 3, 2018, at 6:12 AM, Talya <[hidden email]> wrote:

Dear,

Ok its clear, so the only solution is to create different instances of the
same disease.
and How can I retrieve just the recent disease with SPARQL Query.

For example, I have PatintX with Disease D1 at Time, T1 and Disease D2 at
Time T2. I want to retrieve the recent disease of the patient (compare
between T1 and T2 ad choose the greater one) with SPARQL Language.

Best regards



--
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



_______________________________________________
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