diff options
author | gebele <gebele@in-silico.ch> | 2013-06-10 17:01:34 +0200 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2013-06-10 17:01:34 +0200 |
commit | b92b9702d8c8f8d864d2069e36d05203eb31aa37 (patch) | |
tree | 77dda83531592c29a4ef12c067027f185edd0e75 | |
parent | 0d8bc5916106cea30433aad18573cf68cd977059 (diff) |
new route for internal purposes; last modified uris
-rw-r--r-- | lib/opentox.rb | 11 |
1 files changed, 11 insertions, 0 deletions
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}") |