myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3545] branches/component-querying: Updated scufl


From: noreply
Subject: [myexperiment-hackers] [3545] branches/component-querying: Updated scufl2-wfdesc tool
Date: Mon, 20 May 2013 08:31:59 +0000 (UTC)

Revision
3545
Author
fbacall
Date
2013-05-20 08:31:58 +0000 (Mon, 20 May 2013)

Log Message

Updated scufl2-wfdesc tool

Modified Paths

Added Paths

Diff

Modified: branches/component-querying/app/models/workflow.rb (3544 => 3545)


--- branches/component-querying/app/models/workflow.rb	2013-05-15 13:38:49 UTC (rev 3544)
+++ branches/component-querying/app/models/workflow.rb	2013-05-20 08:31:58 UTC (rev 3545)
@@ -50,7 +50,8 @@
   
   acts_as_reviewable
 
-  acts_as_rdf_serializable('application/x-turtle') do |workflow|
+  acts_as_rdf_serializable('application/x-turtle',
+      :generation_error_message => "Failed to generate RDF, please check the given workflow file is valid.") do |workflow|
     workflow.processor_class.new(workflow.content_blob.data).extract_rdf_structure(workflow)
   end
 

Modified: branches/component-querying/lib/acts_as_rdf_serializable.rb (3544 => 3545)


--- branches/component-querying/lib/acts_as_rdf_serializable.rb	2013-05-15 13:38:49 UTC (rev 3544)
+++ branches/component-querying/lib/acts_as_rdf_serializable.rb	2013-05-20 08:31:58 UTC (rev 3545)
@@ -17,11 +17,12 @@
         # Specify an representation of the resource as a string (in the specified :format:)
         #  in the block (to which the resource instance is yielded).
         # The resource will be stored in TripleStore on save/update, and removed when deleted.
-        def acts_as_rdf_serializable(format, &block)
-          cattr_accessor :rdf_generator, :rdf_format
+        def acts_as_rdf_serializable(format, options = {}, &block)
+          cattr_accessor :rdf_generator, :rdf_format, :rdf_serializable_options
 
-          self.rdf_generator = block
-          self.rdf_format = format
+          self.rdf_serializable_options = options
+          self.rdf_serializable_options[:generator] = block
+          self.rdf_serializable_options[:format] = format
 
           validate :generate_rdf
 
@@ -38,7 +39,7 @@
       module InstanceMethods
 
         def to_rdf
-          self.class.rdf_generator.call(self)
+          self.class.rdf_serializable_options[:generator].call(self)
         end
 
         private
@@ -52,7 +53,7 @@
           begin
             @rdf = self.to_rdf
           rescue
-            errors.add_to_base("RDF failed to generate")
+            errors.add_to_base(self.rdf_serializable_options[:generation_error_message] || "RDF failed to generate")
             false
           else
             true
@@ -60,8 +61,8 @@
         end
 
         def store_rdf
-          unless TripleStore.instance.nil?
-            TripleStore.instance.insert(@rdf, resource_uri, self.class.rdf_format) unless @rdf.nil?
+          unless TripleStore.instance.nil? || @rdf.nil?
+            TripleStore.instance.insert(@rdf, resource_uri, self.class.rdf_serializable_options[:format])
           end
         end
 

Modified: branches/component-querying/lib/sesame.rb (3544 => 3545)


--- branches/component-querying/lib/sesame.rb	2013-05-15 13:38:49 UTC (rev 3544)
+++ branches/component-querying/lib/sesame.rb	2013-05-20 08:31:58 UTC (rev 3545)
@@ -24,7 +24,7 @@
       request.body = rdf
       request.content_type = content_type
 
-      response = @connection.request url, request
+      response = @connection.request url, request   #Net::HTTP::Persistent::Error if can't connect
 
       case response.code
         when '204'
@@ -77,12 +77,13 @@
   end
 
   class RequestException < Exception
-    attr_reader :code, :message
+    attr_reader :code
 
     def initialize(code, message)
+      super(message)
       @code = code
-      @message = message
     end
+
   end
 
   class QueryException < RequestException;  end

Modified: branches/component-querying/lib/workflow_processors/taverna2.rb (3544 => 3545)


--- branches/component-querying/lib/workflow_processors/taverna2.rb	2013-05-15 13:38:49 UTC (rev 3544)
+++ branches/component-querying/lib/workflow_processors/taverna2.rb	2013-05-20 08:31:58 UTC (rev 3545)
@@ -414,7 +414,7 @@
 
     def extract_rdf_structure(workflow)
       rdf = ''
-      IO.popen("java -jar #{RAILS_ROOT}/vendor/java/scufl2-wfdesc/scufl2-wfdesc-0.3.0-SNAPSHOT-standalone.jar", 'r+') do |converter|
+      IO.popen("java -jar #{RAILS_ROOT}/vendor/java/scufl2-wfdesc/scufl2-wfdesc-0.3.0-standalone.jar", 'r+') do |converter|
         converter.puts(workflow.content_blob.data)
         converter.close_write
         rdf = converter.read
@@ -422,7 +422,7 @@
 
       raise "Error generating wfdesc" if rdf.blank?
 
-      # The code below is a hack put in place because the wfdesc tool does not yet merge in semantic annotations
+      # TODO: Remove this hack, put in place because the wfdesc tool does not yet merge in semantic annotations
       # *** Start of hack ***
       structure = RDF::Graph.new
       structure.insert(RDF::Reader.for(:turtle).new(StringIO.new(rdf)))

Added: branches/component-querying/vendor/java/scufl2-wfdesc/scufl2-wfdesc-0.3.0-standalone.jar


(Binary files differ)
Property changes on: branches/component-querying/vendor/java/scufl2-wfdesc/scufl2-wfdesc-0.3.0-standalone.jar ___________________________________________________________________

Added: svn:mime-type


reply via email to

[Prev in Thread] Current Thread [Next in Thread]