summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2013-06-19 16:20:02 +0200
committerChristoph Helma <helma@in-silico.ch>2013-06-19 16:20:02 +0200
commit355d00c9736459c6f5297d9f926ed4a081adec47 (patch)
treefbd2ffd76f85b06ee99e0e5d2dc073cee06856b6
parentb67ab3c220253ffb3146ad66d7ce9ccee422d0cf (diff)
parentdf1d9c779eed10affa4f8bdcccd5a77eaa57ec9a (diff)
Merge branch 'development' of github.com:opentox/opentox-server into development
Conflicts: lib/4store.rb
-rw-r--r--lib/4store.rb21
-rw-r--r--lib/opentox.rb8
2 files changed, 12 insertions, 17 deletions
diff --git a/lib/4store.rb b/lib/4store.rb
index 314ee65..02f3a89 100644
--- a/lib/4store.rb
+++ b/lib/4store.rb
@@ -7,23 +7,10 @@ module OpenTox
def self.list mime_type
bad_request_error "'#{mime_type}' is not a supported mime type. Please specify one of #{@@accept_formats.join(", ")} in the Accept Header." unless @@accept_formats.include? mime_type
- if mime_type =~ /(uri-list|html)/
- sparql = "SELECT DISTINCT ?g WHERE {GRAPH ?g {?g <#{RDF.type}> <#{klass}>} }"
-=begin
- sparql = "SELECT DISTINCT ?g WHERE {GRAPH ?g {?s <#{RDF.type}> <#{klass}>; <#{RDF::DC.date}> ?o.} } ORDER BY ?o"
- #sparql = "SELECT DISTINCT ?g WHERE {GRAPH ?g {?s <#{RDF.type}> <#{klass}>; <#{RDF::DC.modified}> ?o.} } ORDER BY ?o"
- # not working for multiple DC.modified
- sparql = "SELECT DISTINCT ?g WHERE {
- GRAPH ?g {
- ?g <#{RDF.type}> <#{klass}>.
- OPTIONAL {?g <#{RDF::DC.date}> ?date.}
- OPTIONAL {?g <#{RDF::OT.created_at}> ?date.}
- OPTIONAL {?g <#{RDF::DC.modified}> ?date.}
- }
- } ORDER BY ?date"
-=end
- else
- sparql = "CONSTRUCT {?s ?p ?o.} WHERE {?s <#{RDF.type}> <#{klass}>; ?p ?o. }"
+ if mime_type =~ /(uri-list|html|sparql-results)/
+ sparql = "SELECT DISTINCT ?uri WHERE {GRAPH ?uri {?uri <#{RDF.type}> <#{klass}>.} }"
+ else
+ sparql = "CONSTRUCT {?uri <#{RDF.type}> <#{klass}>.} WHERE { GRAPH ?uri {?uri <#{RDF.type}> <#{klass}>.} }"
end
query sparql, mime_type
end
diff --git a/lib/opentox.rb b/lib/opentox.rb
index b7b363c..762c1f7 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -165,6 +165,14 @@ module OpenTox
end
end
+ # internal route not in API
+ get "/#{SERVICE}/last/ordered/?" do
+ FourStore.query("SELECT DISTINCT ?s WHERE
+ {GRAPH ?g
+ {?s <#{RDF.type}> <#{RDF::OT}#{SERVICE.capitalize}>; <#{RDF::DC.date}> ?o. }
+ } ORDER BY ?o ", @accept)
+ end
+
# Create a new resource
post "/#{SERVICE}/?" do
@uri = uri("/#{SERVICE}/#{SecureRandom.uuid}")