From cfc64a2966ab38698e499f0b44f41208ee77a07f Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 26 Apr 2016 17:38:15 +0200 Subject: first nanomaterial prediction --- lib/import.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib/import.rb') diff --git a/lib/import.rb b/lib/import.rb index 9091207..3c1edfe 100644 --- a/lib/import.rb +++ b/lib/import.rb @@ -30,7 +30,7 @@ module OpenTox $logger.debug File.join(np["compound"]["URI"],"study") effect["conditions"].delete_if { |k, v| v.nil? } feature = klass.find_or_create_by( - :source => File.join(np["compound"]["URI"],"study"), + #:source => File.join(np["compound"]["URI"],"study"), :name => "#{study["protocol"]["category"]["title"]} #{study["protocol"]["endpoint"]}", :unit => effect["result"]["unit"], :category => study["protocol"]["topcategory"], @@ -48,6 +48,22 @@ module OpenTox datasets.collect{|d| d.id} end +=begin + def self.import_ld # defunct, AMBIT JSON_LD does not have substance entries + #get list of bundle URIs + bundles = JSON.parse(RestClientWrapper.get('https://data.enanomapper.net/bundle?media=application%2Fjson'))["dataset"] + datasets = [] + bundles.each do |bundle| + uri = bundle["URI"] + study = JSON.parse(`curl -H 'Accept:application/ld+json' '#{uri}/substance'`) + study["@graph"].each do |i| + puts i.to_yaml if i.keys.include? "sio:has-value" + end + end + datasets.collect{|d| d.id} + end +=end + def self.dump #get list of bundle URIs `wget 'https://data.enanomapper.net/bundle?media=application%2Fjson' -O bundles.json` -- cgit v1.2.3