opentox-ruby 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/VERSION +1 -1
- data/lib/authorization.rb +1 -1
- data/lib/ontology.rb +16 -27
- metadata +6 -4
data/ChangeLog
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.1
|
data/lib/authorization.rb
CHANGED
@@ -319,7 +319,7 @@ module OpenTox
|
|
319
319
|
# if policy exists check for POST rights
|
320
320
|
if authorize(uri, "POST", subjectid)
|
321
321
|
true
|
322
|
-
|
322
|
+
else
|
323
323
|
LOGGER.error "OpenTox::Authorization.check_policy, already exists, but no POST-authorization with subjectid: #{subjectid}"
|
324
324
|
false
|
325
325
|
end
|
data/lib/ontology.rb
CHANGED
@@ -4,13 +4,9 @@ module OpenTox
|
|
4
4
|
|
5
5
|
def self.querystring(classname="Endpoints")
|
6
6
|
return CGI.escape("PREFIX ot:<http://www.opentox.org/api/1.1#>
|
7
|
-
PREFIX ota:<http://www.opentox.org/algorithms.owl#>
|
8
|
-
PREFIX owl:<http://www.w3.org/2002/07/owl#>
|
9
7
|
PREFIX dc:<http://purl.org/dc/elements/1.1/>
|
10
8
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
11
|
-
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
12
9
|
PREFIX otee:<http://www.opentox.org/echaEndpoints.owl#>
|
13
|
-
PREFIX toxcast:<http://www.opentox.org/toxcast.owl#>
|
14
10
|
select *
|
15
11
|
where {
|
16
12
|
?endpoint rdfs:subClassOf otee:#{classname}.
|
@@ -18,25 +14,22 @@ module OpenTox
|
|
18
14
|
}")
|
19
15
|
end
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
17
|
+
# Gets Endpoint name of a specific endpoint URI
|
18
|
+
# @param [String] endpointuri e.G. "http://www.opentox.org/echaEndpoints.owl#EcotoxicEffects"
|
19
|
+
# @return [String] endpointname: e.G.: "Ecotoxic effects"
|
20
|
+
def self.get_endpoint_name(endpointuri)
|
21
|
+
qstring = CGI.escape("PREFIX dc:<http://purl.org/dc/elements/1.1/>
|
22
|
+
select distinct ?title
|
23
|
+
where {
|
24
|
+
?endpoint dc:title ?title.
|
25
|
+
FILTER (?endpoint = <#{endpointuri}>)
|
26
|
+
}")
|
27
|
+
begin
|
28
|
+
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
|
29
|
+
rescue
|
30
|
+
LOGGER.warn "OpenTox::Ontology::Echa.get_endpoint_name(#{endpointuri}) ontology service is not reachable."
|
31
|
+
[]
|
30
32
|
end
|
31
|
-
return out
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.endpoint_option_list(include_blank=true)
|
35
|
-
out = "<select id='endpoint' name='endpoint'>\n"
|
36
|
-
out += "<option value='' id='please_select'>Please select</option>\n" if include_blank
|
37
|
-
out += make_option_list
|
38
|
-
out += "</select>\n"
|
39
|
-
return out
|
40
33
|
end
|
41
34
|
|
42
35
|
# Gets Endpoints of specific level from ontology service
|
@@ -115,11 +108,8 @@ module OpenTox
|
|
115
108
|
# Query string to find a registered model
|
116
109
|
# @param [String] uri, model URI
|
117
110
|
def self.querystring(uri)
|
118
|
-
return CGI.escape("PREFIX
|
119
|
-
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
120
|
-
PREFIX owl:<http://www.w3.org/2002/07/owl#>
|
111
|
+
return CGI.escape("PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
121
112
|
PREFIX dc:<http://purl.org/dc/elements/1.1/>
|
122
|
-
PREFIX dcterms:<http://purl.org/dc/terms/>
|
123
113
|
PREFIX ot:<http://www.opentox.org/api/1.1#>
|
124
114
|
select distinct ?model ?title ?creator ?trainingDataset ?algorithm
|
125
115
|
where {
|
@@ -132,6 +122,5 @@ module OpenTox
|
|
132
122
|
}")
|
133
123
|
end
|
134
124
|
end
|
135
|
-
|
136
125
|
end
|
137
126
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentox-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 1
|
10
|
+
version: 3.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christoph Helma, Martin Guetlein, Andreas Maunz, Micha Rautenberg, David Vorgrimmler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-24 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -536,9 +536,11 @@ executables: []
|
|
536
536
|
extensions: []
|
537
537
|
|
538
538
|
extra_rdoc_files:
|
539
|
+
- ChangeLog
|
539
540
|
- LICENSE
|
540
541
|
- README.markdown
|
541
542
|
files:
|
543
|
+
- ChangeLog
|
542
544
|
- LICENSE
|
543
545
|
- README.markdown
|
544
546
|
- Rakefile
|