diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/environment.rb | 2 | ||||
-rw-r--r-- | lib/ontology.rb (renamed from lib/ontology_service.rb) | 28 | ||||
-rw-r--r-- | lib/opentox-ruby.rb | 2 |
3 files changed, 22 insertions, 10 deletions
diff --git a/lib/environment.rb b/lib/environment.rb index 59578c1..57ae014 100644 --- a/lib/environment.rb +++ b/lib/environment.rb @@ -74,7 +74,7 @@ CONFIG[:authorization][:authenticate_request] = [""] unless CONFIG[:authorizatio CONFIG[:authorization][:authorize_request] = [""] unless CONFIG[:authorization][:authorize_request] CONFIG[:authorization][:free_request] = [""] unless CONFIG[:authorization][:free_request] -RDF = OwlNamespace.new 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' +#RDF = OwlNamespace.new 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' OWL = OwlNamespace.new 'http://www.w3.org/2002/07/owl#' DC = OwlNamespace.new 'http://purl.org/dc/elements/1.1/' OT = OwlNamespace.new 'http://www.opentox.org/api/1.1#' diff --git a/lib/ontology_service.rb b/lib/ontology.rb index 4ff688f..c3952c3 100644 --- a/lib/ontology_service.rb +++ b/lib/ontology.rb @@ -1,6 +1,6 @@ module OpenTox - module OntologyService - module Endpoints + module Ontology + module Echa require 'sparql/client' @sparql = SPARQL::Client.new("http://apps.ideaconsult.net:8080/ontology") def self.qs(classname="Endpoints") @@ -12,11 +12,11 @@ module OpenTox 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 ?Endpoints ?title ?id - where {?Endpoints rdfs:subClassOf otee:#{classname}. - OPTIONAL {?Endpoints dc:title ?title}. - OPTIONAL {?Endpoints dc:identifier ?id}.} - ORDER BY ?title" + select * + where { + ?endpoint rdfs:subClassOf otee:#{classname}. + ?endpoint dc:title ?title. + }" end def self.make_option_list(endpoint="Endpoints", level=1) @@ -38,6 +38,18 @@ module OpenTox out += "</select>\n" return out end + + def self.endpoints#(endpoint="Endpoints") + endpoint_datasets = {} + RestClientWrapper.get("http://apps.ideaconsult.net:8080/ambit2/query/ndatasets_endpoint",:accept => "text/csv").each do |line| + if line.match(/^http/) + e = line.split(',') + endpoint_datasets["#{e.first} (#{e[1]})"] = RestClientWrapper.get(e.last, :accept => "text/uri-list").split("\n")#[0..e[1].to_i-1] # hack to get only the first count entries + end + end + endpoint_datasets + end end + end -end
\ No newline at end of file +end diff --git a/lib/opentox-ruby.rb b/lib/opentox-ruby.rb index ab8d824..ae05cb2 100644 --- a/lib/opentox-ruby.rb +++ b/lib/opentox-ruby.rb @@ -9,6 +9,6 @@ rescue LoadError end ['opentox', 'compound','dataset', 'parser','serializer', 'algorithm','model','task','validation','feature', - 'rest_client_wrapper', 'authorization', 'policy', 'helper', 'to-html' ].each do |lib| + 'rest_client_wrapper', 'authorization', 'policy', 'helper', 'to-html', 'ontology' ].each do |lib| require lib end |