SPARQL query for the last time

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

SPARQL query for the last time

Talya
Hello,

I want to build an SPARQL query that allows me to select the last activity that a person X do.
For that, I have Person Class with some instances and Activity Class with some activity as instances (swimming, etc) and Class Time with time instances that indicate the start time of the activity.

I have a relation (has-activity) between Person and Activity and a relation (start-at) between (activity and Time)

I think the idea is to select the activity that starts at the last time. how to do this, please help me

Thanks in advance

Reply | Threaded
Open this post in threaded view
|

Re: SPARQL query for the last time

Lorenz Buehmann
Sample data and the SPARQL query that you have so far is necessary. This is not a platform for doing your university assignment.

And if you have the person X given, then it's simply using ORDER BY + LIMIT 1, but you still need the time. You said that there is a class time, but I don't understand how you encode the timepoint then. The class Time contains individuals ok, and the timepoint is encoded in their URIs?

SELECT ?a WHERE {X has-activity ?a . ?a start-at ?t . ?t  time-value ?val} ORDER BY ?val LIMIT 1

But I would suggest to read a SPARQL tutorial, anything else doesn't make sense.
Hello, 

I want to build an SPARQL query that allows me to select the last activity
that a person X do. 
For that, I have Person Class with some instances and Activity Class with
some activity as instances (swimming, etc) and Class Time with time
instances that indicate the start time of the activity. 

I have a relation (has-activity) between Person and Activity and a relation
(start-at) between (activity and Time) 

I think the idea is to select the activity that starts at the last time. how
to do this, please help me 

Thanks in advance 





--
View this message in context: http://protege-project.136.n4.nabble.com/SPARQL-query-for-the-last-time-tp4667776.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
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