summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2010-06-22 16:18:31 +0200
committermguetlein <martin.guetlein@gmail.com>2010-06-22 16:18:31 +0200
commite5838e7607533b5087a89949fea15f694f184b17 (patch)
tree7388c1857580dfb8ee6608acfdc5153492bbdcaf /lib
parentf5c6063e757c3728b84cfd61783a9fd616f09c9a (diff)
inital changes to owl to add type (still outcommented)
Diffstat (limited to 'lib')
-rw-r--r--lib/owl.rb21
1 files changed, 18 insertions, 3 deletions
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