module OpenTox module OntologyService module Endpoints require 'sparql/client' @sparql = SPARQL::Client.new("http://apps.ideaconsult.net:8080/ontology") def self.qs(classname="Endpoints") return "PREFIX ot: PREFIX ota: PREFIX owl: PREFIX dc: PREFIX rdfs: PREFIX rdf: PREFIX otee: PREFIX toxcast: select ?Endpoints ?title ?id where {?Endpoints rdfs:subClassOf otee:#{classname}. OPTIONAL {?Endpoints dc:title ?title}. OPTIONAL {?Endpoints dc:identifier ?id}.} ORDER BY ?title" end def self.make_option_list(endpoint="Endpoints", level=1) out = "" results = @sparql.query(qs(endpoint)) rescue results = [] results.each do |result| endpointname = result.Endpoints.to_s.split('#').last title = result.bound?(:title) ? result.title : endpointname out += "\n" out += make_option_list(endpointname, level + 1) end return out end def self.get_endpoint_selectlist(include_blank=true) out = "\n" return out end end end end