From b92b9702d8c8f8d864d2069e36d05203eb31aa37 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 10 Jun 2013 17:01:34 +0200 Subject: new route for internal purposes; last modified uris --- lib/opentox.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/opentox.rb b/lib/opentox.rb index e5305fd..80339b4 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -131,6 +131,17 @@ module OpenTox end end + # internal route not in API + # example: /SERVICE/last/0 returns last 10 modified uris (default) + # example: /SERVICE/last/5 returns last 5 modified uris + get "/#{SERVICE}/last/:limit/?" do + limit = params[:limit].to_i > 0 ? params[:limit].to_i : 10 + FourStore.query("SELECT DISTINCT ?g WHERE + {GRAPH ?g + {?s <#{RDF::DC.modified}> ?o.} + } ORDER BY ?o LIMIT #{limit}", @accept) + end + # Create a new resource post "/#{SERVICE}/?" do @uri = uri("/#{SERVICE}/#{SecureRandom.uuid}") -- cgit v1.2.3