From b06b7c7d3312e6b913ee9e6c35d0cfe93137756c Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 23 Aug 2010 15:49:04 +0200 Subject: owl-fix for nil-compounds --- lib/model.rb | 6 +++--- lib/owl.rb | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/model.rb b/lib/model.rb index e8f6048..fb25126 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -28,13 +28,13 @@ module OpenTox if ENV['RACK_ENV'] =~ /test|debug/ begin raise "uri invalid" unless Utils.is_uri?(@uri) - raise "no algorithm" unless @algorithm and @algorithm.size>0 - raise "no dependent variables" unless @dependentVariables and @dependentVariables.size>0 - raise "no indenpendent variables" unless @independentVariables raise "no predicted variables" unless @predictedVariables and @predictedVariables.size>0 rescue => ex RestClientWrapper.raise_uri_error "invalid model: '"+ex.message+"'\n"+self.to_yaml+"\n",@uri.to_s end + LOGGER.warn "model has no dependent variable" unless @dependentVariables and @dependentVariables.size>0 + LOGGER.warn "model has no algorithm" unless @algorithm and @algorithm.size>0 + LOGGER.warn "model has no indenpendent variables" unless @independentVariables end end end diff --git a/lib/owl.rb b/lib/owl.rb index a4c2e68..dcf26a5 100644 --- a/lib/owl.rb +++ b/lib/owl.rb @@ -518,6 +518,11 @@ module OpenTox value_node = value_nodes[0] compound_uri = get_value( @model.object(value_node, node('compound')) ) + unless compound_uri + LOGGER.warn "'compound' missing for data-entry of feature "+feature_uri.to_s+ + ", value: "+@model.object(feature_value_node,node("value")).to_s + next + end value_node_type = @model.object(feature_value_node, RDF_TYPE) if (value_node_type == node('FeatureValue')) -- cgit v1.2.3 From 7da48f4e8ab43e5fbc5379eae133dd9aa929ac55 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Mon, 23 Aug 2010 16:12:57 +0200 Subject: lib/dataset.rb --- lib/dataset.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/dataset.rb b/lib/dataset.rb index ef5b97f..2eb2206 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -202,16 +202,19 @@ module OpenTox # overwrite to yaml: # in case dataset is loaded from owl: - # * load all values - # * set @owl to nil (not necessary in yaml) + # * load all values def to_yaml # loads all features if ((defined? @dirty_features) && @dirty_features.size > 0) load_feature_values end - @owl = nil super end + + # * remove @owl from yaml, not necessary + def to_yaml_properties + super - ["@owl"] + end # saves (changes) as new dataset in dataset service # returns uri -- cgit v1.2.3 From df3ae4a9b84b12cb668e717d5f1c30891d5a2562 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Tue, 24 Aug 2010 13:58:49 +0200 Subject: add dm-validations to dependencies --- lib/environment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/environment.rb b/lib/environment.rb index 80899c5..cfc875d 100644 --- a/lib/environment.rb +++ b/lib/environment.rb @@ -25,7 +25,7 @@ end # database if @@config[:database] - ['dm-core', 'dm-serializer', 'dm-timestamps', 'dm-types', 'dm-migrations' ].each{|lib| require lib } + ['dm-core', 'dm-serializer', 'dm-timestamps', 'dm-types', 'dm-migrations', 'dm-validations' ].each{|lib| require lib } case @@config[:database][:adapter] when /sqlite/i db_dir = File.join(basedir, "db") -- cgit v1.2.3