diff options
author | mguetlein <martin.guetlein@gmail.com> | 2010-06-22 16:18:31 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2010-06-22 16:18:31 +0200 |
commit | e5838e7607533b5087a89949fea15f694f184b17 (patch) | |
tree | 7388c1857580dfb8ee6608acfdc5153492bbdcaf /lib | |
parent | f5c6063e757c3728b84cfd61783a9fd616f09c9a (diff) |
inital changes to owl to add type (still outcommented)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/owl.rb | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -107,7 +107,7 @@ module OpenTox owl = OpenTox::Owl.new owl.ot_class = ot_class owl.root_node = Redland::Resource.new(uri.to_s.strip) - owl.set("type",owl.node(owl.ot_class)) + owl.set("type",owl.node(owl.ot_class)) #,true)) owl end @@ -178,8 +178,9 @@ module OpenTox public def set(name, value, datatype=nil) + raise "uri is no prop, cannot set uri" if name=="uri" - property_node = node(name.to_s) + property_node = node(name.to_s) #, true) begin # delete existing entry t = @model.object(@root_node, property_node) @model.delete @root_node, property_node, t @@ -364,16 +365,30 @@ module OpenTox "date" => DC["date"], "format" => DC["format"]} +# @object_prop = OWL["ObjectProperty"] +# @@type = { "Validation" => OWL["Class"], +# "Model" => OWL["Class"], +# "title" => OWL["AnnotationProperty"], +# "creator" => OWL["AnnotationProperty"], +# "date" => OWL["AnnotationProperty"], +# "format" => OWL["AnnotationProperty"], +# "predictedVariables" => @object_prop} + # this method has two purposes: # * distinguishing ot-properties from dc- and rdf- properties # * caching nodes, as creating nodes is costly - def node(name) + def node(name) #, write_type_to_model=false) raise "dc[identifier] deprecated, use owl.uri" if name=="identifier" n = @@property_nodes[name] unless n n = OT[name] @@property_nodes[name] = n end + +# if write_type_to_model and name!="type" +# raise "no type defined for '"+name+"'" unless @@type[name] +# @model.add n,RDF['type'],@@type[name] +# end return n end |