diff options
author | gebele <gebele@in-silico.ch> | 2013-05-07 17:06:49 +0200 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2013-05-07 17:06:49 +0200 |
commit | 7a4e660cc5092cd4973163eab576ece81d7706d4 (patch) | |
tree | d9fbb6e80c3bced801b8fea8f51e7530bc6251e6 | |
parent | ae55440e99529c18367f93e3f6e6b40816767f44 (diff) | |
parent | 5430c1f53f544d61a24236ed5c78c5972f102405 (diff) |
Merge branch 'development' of github.com:opentox/opentox-client into development
-rw-r--r-- | lib/dataset.rb | 2 | ||||
-rw-r--r-- | lib/opentox.rb | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index ec0abdb..f261641 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -178,7 +178,7 @@ module OpenTox query = RDF::Query.new({ :uri => { RDF.type => RDF::OT.Compound } }) @compounds = query.execute(@rdf).collect { |solution| OpenTox::Compound.new solution.uri } query = RDF::Query.new({ :uri => { RDF.type => RDF::OT.Feature } }) - @features = query.execute(@rdf).collect { |solution| OpenTox::Feature.new solution.uri } + @features = query.execute(@rdf).collect { |solution| OpenTox::Feature.new solution.uri, @subjectid } @compounds.each_with_index do |c,i| @features.each_with_index do |f,j| end diff --git a/lib/opentox.rb b/lib/opentox.rb index 040b0df..78a6923 100644 --- a/lib/opentox.rb +++ b/lib/opentox.rb @@ -25,7 +25,7 @@ module OpenTox # Object metadata (lazy loading) # @return [Hash] Object metadata def metadata force_update=false - if (@metadata.nil? or @metadata.empty? or force_update) and URI.accessible? @uri + if (@metadata.nil? or @metadata.empty? or force_update) and URI.accessible? @uri, @subjectid get if @rdf.nil? or @rdf.empty? or force_update # return values as plain strings instead of RDF objects @metadata = @rdf.to_hash[RDF::URI.new(@uri)].inject({}) { |h, (predicate, values)| h[predicate] = values.collect{|v| v.to_s}; h } @@ -52,7 +52,7 @@ module OpenTox # {http://opentox.org/dev/apis/api-1.2/interfaces OpenTox API} # @return [Hash] Object parameters def parameters force_update=false - if (@parameters.empty? or force_update) and URI.accessible? @uri + if (@parameters.empty? or force_update) and URI.accessible? @uri, @subjectid get if @rdf.empty? or force_update params = {} query = RDF::Query.new({ @@ -200,7 +200,7 @@ module OpenTox #@example fetching a model # OpenTox::Model.find(<model-uri>) -> model-object def self.find uri, subjectid=nil - URI.accessible?(uri) ? self.new(uri, subjectid) : nil + URI.accessible?(uri, subjectid) ? self.new(uri, subjectid) : nil end def self.create metadata, subjectid=nil @@ -226,11 +226,11 @@ module OpenTox end end sparql << "}" - uris = RestClientWrapper.get(service_uri,{:query => sparql},{:accept => "text/uri-list", :subjectid => @subjectid}).split("\n") + uris = RestClientWrapper.get(service_uri,{:query => sparql},{:accept => "text/uri-list", :subjectid => subjectid}).split("\n") if uris.empty? self.create metadata, subjectid else - self.new uris.first + self.new uris.first, subjectid end end |