summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-10-19 13:11:09 +0200
committermr <mr@mrautenberg.de>2011-10-19 13:11:09 +0200
commit1687a218b1593478bae1ab43a3eb8e5596def684 (patch)
tree6518df50a158602ab46777285fc631e06f90a522
parentd95a3473507e231969bfcda38ef512612df7493e (diff)
parent0cf490be298e6c937e7238567f3e91b82fbc27a0 (diff)
Merge branch 'release/v3.0.1'v3.0.1
-rw-r--r--ChangeLog5
-rw-r--r--VERSION2
-rw-r--r--lib/authorization.rb2
-rw-r--r--lib/ontology.rb43
4 files changed, 23 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..de9e01b
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,5 @@
+v3.0.1 2011-10-19
+ * feature: model registration to ontology service
+ * ontology lib gets endpoints from ontology service
+v3.0.0 2011-09-23
+ * datasets stored as json (with Yajl) to improve performance
diff --git a/VERSION b/VERSION
index 56fea8a..cb2b00e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0.0 \ No newline at end of file
+3.0.1
diff --git a/lib/authorization.rb b/lib/authorization.rb
index 8023f60..5d57781 100644
--- a/lib/authorization.rb
+++ b/lib/authorization.rb
@@ -319,7 +319,7 @@ module OpenTox
# if policy exists check for POST rights
if authorize(uri, "POST", subjectid)
true
- else
+ else
LOGGER.error "OpenTox::Authorization.check_policy, already exists, but no POST-authorization with subjectid: #{subjectid}"
false
end
diff --git a/lib/ontology.rb b/lib/ontology.rb
index ad7ba7b..2c20c59 100644
--- a/lib/ontology.rb
+++ b/lib/ontology.rb
@@ -4,13 +4,9 @@ module OpenTox
def self.querystring(classname="Endpoints")
return CGI.escape("PREFIX ot:<http://www.opentox.org/api/1.1#>
- PREFIX ota:<http://www.opentox.org/algorithms.owl#>
- PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX dc:<http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
- PREFIX toxcast:<http://www.opentox.org/toxcast.owl#>
select *
where {
?endpoint rdfs:subClassOf otee:#{classname}.
@@ -18,25 +14,22 @@ module OpenTox
}")
end
- def self.make_option_list(endpoint="Endpoints", level=1)
- out = ""
- results = echa_endpoints(endpoint) rescue results = []
- results.each do |result|
- r = result.split(',')
- endpointname = r.first.split("#").last
- title = r[1..r.size-1]
- out += "<option value='#{r.first}' id='#{endpointname}' class='level_#{level}'>#{title}</option>\n"
- out += make_option_list(endpointname, level + 1)
+ # Gets Endpoint name of a specific endpoint URI
+ # @param [String] endpointuri e.G. "http://www.opentox.org/echaEndpoints.owl#EcotoxicEffects"
+ # @return [String] endpointname: e.G.: "Ecotoxic effects"
+ def self.get_endpoint_name(endpointuri)
+ qstring = CGI.escape("PREFIX dc:<http://purl.org/dc/elements/1.1/>
+ select distinct ?title
+ where {
+ ?endpoint dc:title ?title.
+ FILTER (?endpoint = <#{endpointuri}>)
+ }")
+ begin
+ RestClientWrapper.get("#{ONTOLOGY_SERVER}?query=#{qstring}",:accept => "text/csv").collect{|l| l.gsub("\r\n", "") if l.to_s != "title\r\n"}.uniq.compact.sort.first.to_s
+ rescue
+ LOGGER.warn "OpenTox::Ontology::Echa.get_endpoint_name(#{endpointuri}) ontology service is not reachable."
+ []
end
- return out
- end
-
- def self.endpoint_option_list(include_blank=true)
- out = "<select id='endpoint' name='endpoint'>\n"
- out += "<option value='' id='please_select'>Please select</option>\n" if include_blank
- out += make_option_list
- out += "</select>\n"
- return out
end
# Gets Endpoints of specific level from ontology service
@@ -115,11 +108,8 @@ module OpenTox
# Query string to find a registered model
# @param [String] uri, model URI
def self.querystring(uri)
- return CGI.escape("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
- PREFIX owl:<http://www.w3.org/2002/07/owl#>
+ return CGI.escape("PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc:<http://purl.org/dc/elements/1.1/>
- PREFIX dcterms:<http://purl.org/dc/terms/>
PREFIX ot:<http://www.opentox.org/api/1.1#>
select distinct ?model ?title ?creator ?trainingDataset ?algorithm
where {
@@ -132,6 +122,5 @@ module OpenTox
}")
end
end
-
end
end \ No newline at end of file