From e5838e7607533b5087a89949fea15f694f184b17 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Tue, 22 Jun 2010 16:18:31 +0200 Subject: inital changes to owl to add type (still outcommented) --- lib/owl.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/owl.rb b/lib/owl.rb index d6f9cea..700e6ee 100644 --- a/lib/owl.rb +++ b/lib/owl.rb @@ -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 -- cgit v1.2.3