diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-09-07 11:08:14 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-09-07 11:08:14 +0200 |
commit | b032c1cef9afd1720235b7d6d121f292e8c77d1e (patch) | |
tree | d3ff347fb6b6171f774d54c951720bd9bc2ff9f8 /lib | |
parent | 6a560290805ff49d7d43842dd8119a2e2bb06b4a (diff) |
tabs expanded
Diffstat (limited to 'lib')
-rw-r--r-- | lib/owl.rb | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -93,7 +93,7 @@ end module OpenTox - class Owl + class Owl # to get correct owl-dl, properties and objects have to be typed # i.e. the following triple is insufficient: @@ -188,26 +188,26 @@ module OpenTox # ot_class is the class of the object as string, e.g. "Model","Dataset", ... # root_node is the root-object node in the rdf # uri the uri of the object - attr_accessor :ot_class, :root_node, :uri, :model + attr_accessor :ot_class, :root_node, :uri, :model private - def initialize - @model = Redland::Model.new Redland::MemoryStore.new - end + def initialize + @model = Redland::Model.new Redland::MemoryStore.new + end # build new owl object # ot_class is the class of this object, should be a string like "Model", "Task", ... # uri is name and identifier of this object public - def self.create( ot_class, uri ) + def self.create( ot_class, uri ) owl = OpenTox::Owl.new owl.ot_class = ot_class owl.root_node = Redland::Resource.new(uri.to_s.strip) owl.set("type",owl.ot_class) owl.uri = uri - owl - end + owl + end # loads owl from data def self.from_data(data, base_uri, ot_class) @@ -250,13 +250,13 @@ module OpenTox end end - def self.from_uri(uri, ot_class) + def self.from_uri(uri, ot_class) return from_data(RestClientWrapper.get(uri,:accept => "application/rdf+xml").to_s, uri, ot_class) - end + end - def rdf - @model.to_string - end + def rdf + @model.to_string + end # returns the first object for subject:root_node and property # (sufficient for accessing simple, root-node properties) @@ -430,14 +430,14 @@ module OpenTox # for "backwards-compatiblity" # better use directly: # set_data( { "parameters" => [ { "title" => <t>, "paramScope" => <s>, "paramValue" => <v> } ] ) - def parameters=(params) + def parameters=(params) converted_params = [] params.each do |name, settings| converted_params << { :title => name, :paramScope => settings[:scope], :paramValue => settings[:value] } end set_data( :parameters => converted_params ) - end + end # PENDING move to dataset.rb # this is for dataset.to_owl |