Modified: branches/showcase48/app/models/research_object.rb (3014 => 3015)
--- branches/showcase48/app/models/research_object.rb 2012-06-06 06:45:29 UTC (rev 3014)
+++ branches/showcase48/app/models/research_object.rb 2012-06-06 08:37:51 UTC (rev 3015)
@@ -26,7 +26,7 @@
format_attribute :description
- def load_graph
+ def load_graph_from_zip
begin
@@ -71,6 +71,33 @@
end
end
+ def load_graph
+
+ # create RDF graph
+
+ manifest_name = "tmp/graph.#{Process.pid}.ttl"
+
+ File.open(manifest_name, "w") do |f|
+ f.write(content_blob.data)
+ end
+
+ graph = RDF::Graph.load(manifest_name)
+
+ FileUtils.rm_rf(manifest_name)
+
+ # create triples
+
+ graph.query([nil, nil, nil]).each do |s, p, o|
+
+ annotations.create(
+ :subject_text => s.to_s,
+ :predicate_text => p.to_s,
+ :objekt_text => o.to_s)
+ end
+
+ graph
+ end
+
def wf4ever_resources
resources = annotations.find(:all, :conditions =>