myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2869] branches/datasets: Refactored data items i


From: noreply
Subject: [myexperiment-hackers] [2869] branches/datasets: Refactored data items into separate model, fixed various bugs, cleaned up code
Date: Wed, 7 Dec 2011 05:50:54 -0500 (EST)

Revision
2869
Author
fbacall
Date
2011-12-07 05:50:49 -0500 (Wed, 07 Dec 2011)

Log Message

Refactored data items into separate model, fixed various bugs, cleaned up code

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/datasets/app/controllers/data_items_controller.rb (2868 => 2869)


--- branches/datasets/app/controllers/data_items_controller.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/controllers/data_items_controller.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -5,51 +5,45 @@
 
 class DataItemsController < ApplicationController
 
-  before_filter :fetch_relationship, :except => [:create, :new]
+  before_filter :fetch_data_item, :except => [:create, :new]
   before_filter :fetch_data_set_and_workflow
   before_filter :auth
   before_filter :fetch_port_names, : [:new, :edit]
   before_filter :fetch_blobs, : [:new, :edit]
 
   def create
-    @errors = []
-    @data_item = Relationship.new
+    @data_item = DataItem.new
 
-    if (port = get_port) && (data = "" &&
-       @data_item.update_attributes(:subject => data, :objekt => port,
-                                    :predicate => Predicate.find(params[:predicate_id]), :context => @data_set)
+    if (data = "" &&
+       @data_item.update_attributes(:data ="" data, :port_name => params[:workflow_port], :port_type => params[:workflow_port_type],
+                                    :data_set => @data_set)
       respond_to do |format|
         format.html {render :partial => "data_sets/data_set", :object => @data_set}
       end
     else
-      @errors = @errors + @data_item.errors.full_messages
       respond_to do |format|
-        format.html {render :partial => "data_sets/errors", :status => 400}
+        format.html {render :partial => "data_sets/errors", :status => 400,
+                            :locals => {:errors => @data_item.errors.full_messages}}
       end
     end
   end
 
   def update
-    @errors = []
-
-    if (port = get_port) && (data = "" &&
-       @data_item.update_attributes(:subject => data, :objekt => port,
-                                    :predicate => Predicate.find(params[:predicate_id]), :context => @data_set)
+    if @data_item.update_attributes(:data ="" get_data, :port_name => params[:workflow_port], :port_type => params[:workflow_port_type],
+                                    :data_set => @data_set)
       respond_to do |format|
         format.html {render :partial => "data_sets/data_item", :object => @data_item,
                             :locals => {:port_type => params[:workflow_port_type]}}
       end
     else
-      @errors = @errors + @data_item.errors.full_messages
       respond_to do |format|
-        format.html {render :partial => "data_sets/errors", :status => 400}
+        format.html {render :partial => "data_sets/errors", :status => 400,
+                            :locals => {:errors => @data_item.errors.full_messages}}
       end
     end
   end
 
   def destroy
-    @errors = []
-
     if @data_item.destroy
       respond_to do |format|
         format.html {render :partial => "data_sets/data_set", :object => @data_set}
@@ -60,12 +54,12 @@
   def edit
     respond_to do |format|
       format.html {render :partial => "data_sets/data_item_form",
-                          :locals => {:port_type => @data_item.objekt.port_type.to_s}}
+                          :locals => {:port_type => @data_item.port_type}}
     end
   end
 
   def new
-    @data_item = Relationship.new
+    @data_item = DataItem.new
 
     if @port_names.empty?
       respond_to do |format|
@@ -81,114 +75,41 @@
 
   def show
     respond_to do |format|
-      format.html {render :partial => "data_sets/data_item", :object => @data_item,
-                          :locals => {:port_type => @data_item.objekt.port_type.to_s}}
+      format.html {render :partial => "data_sets/data_item", :object => @data_item}
     end
   end
 
   private
-  def fetch_relationship
-    @data_item = Relationship.find(params[:id])
+  def fetch_data_item
+    @data_item = DataItem.find(params[:id])
   end
 
   def fetch_data_set_and_workflow
-    @data_set = @data_item ? @data_item.context : DataSet.find(params[:data_set_id])
+    @data_set = @data_item ? @data_item.data_set : DataSet.find(params[:data_set_id])
     @workflow = @data_set.workflow
   end
 
   def get_data
-    data = ""
-
-    if params[:data_type] == "text"
-      #If it wasn't associated with text data before, create some
-      if address@hidden(TextData)
-        data = "" => params[:data], :data_set => @data_set)
-        unless data.save
-          @errors = @errors + data.errors.full_messages
-          return false
-        end
-      #Otherwise just update the existing text data
+    if params[:data_type] == "TextData"
+      if @data_item.data.kind_of?(TextData) && params[:data] == @data_item.data.data
+          return @data_item.data
       else
-        data = ""
-        unless data.update_attributes(:data ="" params[:data])
-          @errors = @errors + data.errors.full_messages
-          return false
-        end
+        # Create new data to be autosaved when data item is saved
+        return TextData.new(:data ="" params[:data])
       end
-    elsif params[:data_type] == "file"
-      #delete existing text data
-      if @data_item.subject.kind_of?(TextData)
-        @data_item.subject.destroy
-      end
-
-      data = ""
+    elsif params[:data_type] == "Blob"
+      return Blob.find(params[:data_id])
     else
       raise "Invalid data type specified."
     end
-
-    data
   end
 
-  def get_port
-    port = nil
-    port_type = params[:workflow_port_type]
-    version = @data_set.workflow_version
-
-    #Try and get existing port from relationship
-    if @data_item.objekt
-      #But only if port wasn't changed in the form
-      if (params[:workflow_port] == @data_item.objekt.name) &&
-         (port_type == @data_item.objekt.port_type.to_s)
-        port = @data_item.objekt
-      end
-    end
-
-    #Try finding a port with identical attributes
-    unless port
-      port = WorkflowPort.find(:first,
-                               :conditions => ["name = ? AND port_type = ? AND workflow_id = ? AND workflow_version = ?",
-                                                             params[:workflow_port], port_type, @workflow.id, version])
-
-      #If we found a port, check if there isn't already some data connected to it within this data set
-      if port && Relationship.find(:first, :conditions => ["context_type = 'DataSet' AND context_id = ? AND " +
-                                                   "objekt_type = 'WorkflowPort' AND objekt_id = ?",
-                                                   @data_set.id, port.id])
-        @errors << "Data already exists for this port."
-        return false
-      end
-    end
-
-    #If we still don't have a port, make one
-    unless port
-      #Check if port name from form is a valid port name
-      workflow_model = @data_set.workflow.get_workflow_model_object(version)
-      collection = ((port_type == "input") ? workflow_model.sources : workflow_model.sinks)
-
-      if collection.map { |s| s.name }.include?(params[:workflow_port])
-        port = WorkflowPort.new(:name => params[:workflow_port], :workflow => @workflow,
-                                :port_type => port_type, :workflow_version => version)
-        unless port.save
-          @errors = @errors + port.errors.full_messages
-          return false
-        end
-      else
-        @errors << "Invalid port name specified."
-        return false
-      end
-    end
-
-    port
-  end
-
   def fetch_port_names
-    port_type = params[:port_type] || @data_item.objekt.port_type.to_s
+    port_type = params[:port_type] || @data_item.port_type
 
-    existing_ports = @data_set.data_items.select do |r|
-      port_type == "input" && r.objekt.input? ||
-      port_type == "output" && r.objekt.output?
-    end.collect {|r| r.objekt.name}
+    existing_ports = @data_set.data_items.select {|i| port_type == i.port_type}.map {|r| r.port_name}
 
-    existing_ports.delete(@data_item.objekt.name) if @data_item
+    existing_ports.delete(@data_item.port_name) if @data_item
 
     version = @data_set.workflow_version
 

Added: branches/datasets/app/models/data_item.rb (0 => 2869)


--- branches/datasets/app/models/data_item.rb	                        (rev 0)
+++ branches/datasets/app/models/data_item.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -0,0 +1,42 @@
+# myExperiment: app/models/data_item.rb
+#
+# Copyright (c) 2011 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class DataItem < ActiveRecord::Base
+
+  belongs_to :data_set
+  belongs_to :data, :polymorphic => true, :autosave => true
+
+  validates_presence_of :port_name, :port_type, :data, :data_set
+  validates_inclusion_of :port_type, :in => ["input", "output"]
+  validates_inclusion_of :data_type, :in => ["TextData", "Blob"]
+  validates_uniqueness_of :port_name, :scope => [:port_type, :data_set_id]
+
+  # To avoid leaving useless orphaned text data
+  after_destroy :destroy_text_data
+  before_save :destroy_old_text_data
+
+  def input?
+    port_type == "input"
+  end
+
+  def output?
+    port_type == "output"
+  end
+
+  private
+
+  def destroy_text_data
+    if data.kind_of?(TextData)
+      data.destroy
+    end
+  end
+
+  def destroy_old_text_data
+    # Cool new Rails 2 methods to get the former attribute values
+    if (data_type_changed? || data_id_changed?) && data_type_was == "TextData"
+      TextData.find(data_id_was).destroy
+    end
+  end
+end

Modified: branches/datasets/app/models/data_set.rb (2868 => 2869)


--- branches/datasets/app/models/data_set.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/models/data_set.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -20,14 +20,8 @@
 
   belongs_to :workflow
   belongs_to :contributor, :polymorphic => true
+  has_many :data_items, :dependent => :destroy
 
-  #The "data items" are represented as relationships. Subject = data, Object = port
-  has_many :data_items, :class_name => "Relationship", :as => :context,
-           :dependent => :destroy
-
-  #this association is just to ensure text data is deleted when the data set is. not actually used.
-  has_many :text_datas, :dependent => :destroy
-
   validates_inclusion_of :category, :in => ["example_data"] #Need some more categories!
 
   # Zips the pack up and returns a StringIO object containing its contents
@@ -44,19 +38,18 @@
       # or "text.txt" if it is just text data.
 
       data_items.each do |data_item|
-        data = ""
-        port = data_item.objekt
+        data = ""
 
         if data.kind_of?(Blob)
           if Authorization.is_authorized?("download", nil, data, user)
-            zipfile.add_data("#{port.port_type}s/#{port.name} - #{data.local_name}", data.content_blob.data)
-            stats[port.port_type][:files] += 1
+            zipfile.add_data("#{data_item.port_type}s/#{data_item.port_name} - #{data.local_name}", data.content_blob.data)
+            stats[data_item.port_type][:files] += 1
           else
-            stats[port.port_type][:hidden] += 1
+            stats[data_item.port_type][:hidden] += 1
           end
         elsif data.kind_of?(TextData)
-          zipfile.add_data("#{port.port_type}s/#{port.name} - text.txt", data.data)
-          stats[port.port_type][:text] += 1
+          zipfile.add_data("#{data_item.port_type}s/#{data_item.port_name} - text.txt", data.data)
+          stats[data_item.port_type][:text] += 1
         else
           raise "Unsupported data type"
         end

Modified: branches/datasets/app/models/relationship.rb (2868 => 2869)


--- branches/datasets/app/models/relationship.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/models/relationship.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -17,21 +17,8 @@
   after_save :touch_context
   after_destroy :touch_context
 
-  #To avoid leaving orphaned text data
-  after_destroy :destroy_text_data
-
   def touch_context
     # Rails 2 - use context.destroyed? instead of context.contribution.nil?
-    if context.respond_to?(:contribution)
-      context.touch if !context.contribution.nil? && context.respond_to?(:touch)
-    end
+    context.touch if !context.contribution.nil? && context.respond_to?(:touch)
   end
-
-  private
-
-  def destroy_text_data
-    if subject.kind_of?(TextData)
-      subject.destroy
-    end
-  end
 end

Modified: branches/datasets/app/models/text_data.rb (2868 => 2869)


--- branches/datasets/app/models/text_data.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/models/text_data.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -6,9 +6,7 @@
 class TextData < ActiveRecord::Base
 
   set_table_name "text_data"
+  validates_presence_of :data
 
-  belongs_to :data_set
-
-  validates_presence_of :data, :data_set_id
-
-end
\ No newline at end of file
+  has_one :data_item, :as => :data
+end

Modified: branches/datasets/app/models/workflow.rb (2868 => 2869)


--- branches/datasets/app/models/workflow.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/models/workflow.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -56,7 +56,6 @@
   has_previews
 
   has_many :data_sets, :dependent => :destroy, :order => ["updated_at DESC"]
-  has_many :workflow_ports, :dependent => :destroy
 
   explicit_versioning(:version_column => "current_version",
                       :extra_attributes => ["image", "svg"],
@@ -77,7 +76,7 @@
     after_destroy { |wv| wv.content_blob.destroy if wv.content_blob }
 
     # Destroy data sets + ports linked to this version after destroy
-    after_destroy :clean_up_data_sets_and_ports
+    after_destroy :clean_up_data_sets
     
     # Update the parent contribution model buy only if this isn't the current version (because the workflow model will take care of that).
     # This is required to keep the contribution's updated_at field accurate.
@@ -104,8 +103,8 @@
       @display_data_format = (klass.nil? ? self.file_ext : klass.display_data_format)
     end
 
-    def clean_up_data_sets_and_ports
-      (workflow.data_sets + workflow.workflow_ports).select { |d| d.workflow_version == version }.each do |d|
+    def clean_up_data_sets
+      workflow.data_sets.select { |d| d.workflow_version == version }.each do |d|
         d.destroy
       end
     end

Deleted: branches/datasets/app/models/workflow_port.rb (2868 => 2869)


--- branches/datasets/app/models/workflow_port.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/models/workflow_port.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,29 +0,0 @@
-# myExperiment: app/models/workflow_port.rb
-#
-# Copyright (c) 2011 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-
-#WorkflowPort - a model of an input or output port on a workflow. Its primary use is to allow relationships to be stated
-# between things and workflows on a more fine-grained level. WorkflowPorts are created "lazily" as needed, as opposed to
-# being created when the workflow is uploaded. They are only removed when the workflow is destroyed.
-
-class WorkflowPort < ActiveRecord::Base
-
-  belongs_to :workflow
-
-  validates_presence_of :name, :port_type, :workflow_id, :workflow_version
-
-  validates_uniqueness_of :name, :scope => [:port_type, :workflow_id, :workflow_version]
-
-  validates_inclusion_of :port_type, :in => ["input", "output"]
-
-  def input?
-    port_type == "input"
-  end
-
-  def output?
-    port_type == "output"
-  end
-
-end
\ No newline at end of file

Modified: branches/datasets/app/views/data_sets/_data_item.rhtml (2868 => 2869)


--- branches/datasets/app/views/data_sets/_data_item.rhtml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/views/data_sets/_data_item.rhtml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,13 +1,14 @@
 <%
-   data = ""
-   port = data_item.objekt
+   data = ""
+   port_type = data_item.port_type
+   port_name = data_item.port_name
 %>
 
 <% port_td = capture do %>
   <td class="port <%= port_type -%>">
     <h5><img src="" <%= port_type.capitalize %> Name</h5>
     <div>
-      <input title="<%= port.name -%>" type="text" readonly="readonly" value="<%= port.name -%>" size="24" class="readonly"/>
+      <input title="<%= port_name -%>" type="text" readonly="readonly" value="<%= port_name -%>" size="24" class="readonly"/>
     </div>
   </td>
 <% end  %>

Modified: branches/datasets/app/views/data_sets/_data_item_form.rhtml (2868 => 2869)


--- branches/datasets/app/views/data_sets/_data_item_form.rhtml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/views/data_sets/_data_item_form.rhtml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,12 +1,10 @@
 <%
-  data = ""
-  port = @data_item.objekt
-  data_type = ""
-  data_type = "file" if data.kind_of?(Blob)
-  data_type = "text" if data.kind_of?(TextData)
+  data = ""
+  port_name = @data_item.port_name
+  port_type = @data_item.port_type || params[:port_type]
 
   port_names_for_select = @port_names.map do |p|
-    %(<option #{"selected=\"selected\"" if (port && port.name == p)}
+    %(<option #{"selected=\"selected\"" if (port_name == p)}
         value="#{p}" title="#{h p}">#{h truncate(p, :length => 20)}</option>)
   end.join.html_safe
 
@@ -34,29 +32,29 @@
       <h5>
         <%= port_type == "input" ? "1" : "2" -%>. Select data type
         <div class="data_type">
-          <%= radio_button_tag "data_type", "text", data_type == "text" || data_type.blank?,
+          <%= radio_button_tag "data_type", "TextData", data.kind_of?(TextData) || data.blank?,
                                { :id => "data_type_text_#{unique_id}",
                                  : "$$('##{container_element} .data_form').each(function (f){ f.hide()});"+
                                              "$('text_data_form_#{unique_id}').show();" } %>
           <label for=""
 
           <span style="color: #999"> | </span>
-          <%= radio_button_tag "data_type", "file", data_type == "file", { :id => "data_type_file_#{unique_id}",
+          <%= radio_button_tag "data_type", "Blob", data.kind_of?(Blob), { :id => "data_type_file_#{unique_id}",
                                : "$$('##{container_element} .data_form').each(function (f){ f.hide()});"+
                                            "$('file_data_form_#{unique_id}').show();" } %>
           <label for=""
         </div>
       </h5>
 
-      <div class="data_form" id="text_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if data_type != "text" && !data_type.blank? -%>>
+      <div class="data_form" id="text_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if !(data.kind_of?(TextData) || data.blank?) -%>>
         <h5><%= port_type == "input" ? "2" : "3" -%>. Input your data</h5>
-        <%= text_area_tag(:data, (data.data if data_type == "text"), :rows => 4, :cols => 50) %>
+        <%= text_area_tag(:data, (data.data if data.kind_of?(TextData)), :rows => 4, :cols => 50) %>
       </div>
 
-      <div class="data_form" id="file_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if data_type != "file" -%> >
+      <div class="data_form" id="file_data_form_<%=unique_id-%>" <%= "style=\"display: none\"" if !data.kind_of?(Blob) -%> >
         <h5><%= port_type == "input" ? "2" : "3" -%>. Select data file</h5>
 
-        <%= select_tag :file_id, blob_names_for_select %><br/>
+        <%= select_tag :data_id, blob_names_for_select %><br/>
 
       </div>
       <br class="clearer"/>
@@ -68,12 +66,8 @@
                       :update => {:success => (@data_item.id.nil? ? "data_set_container" : container_element),
                                   :failure => "data_item_form_errors"},
                       :failure => "$('data_item_form_errors').show();",
-                      :loading => "$('relationship_form_spinner_#{unique_id}').show();",
-                      :complete => "$('relationship_form_spinner_#{unique_id}').hide();" do %>
-    <%# todo: fix this %>
-    <%= hidden_field_tag :predicate_id, port_type == "input" ? Predicate.find_by_title("inputDataTo").id :
-                                                               Predicate.find_by_title("outputDataFrom").id %>
-
+                      :loading => "$('data_item_form_spinner_#{unique_id}').show();",
+                      :complete => "$('data_item_form_spinner_#{unique_id}').hide();" do %>
     <div id="data_item_form_errors" style="display:none"></div>
 
     <table>
@@ -92,12 +86,12 @@
             <%= link_to "Cancel", "#", : remote_function(:url ="" data_item_path(@data_item),
                                                      :method => :get,
                                                      :update => {:success => container_element},
-                                                     :loading => "$('relationship_form_spinner_#{unique_id}').show();",
-                                                     :complete => "$('relationship_form_spinner_#{unique_id}').hide();")+
+                                                     :loading => "$('data_item_form_spinner_#{unique_id}').show();",
+                                                     :complete => "$('data_item_form_spinner_#{unique_id}').hide();")+
                                                      ";return false" %>
           <% end %>
           <br/>
-          <img id="relationship_form_spinner_<%=unique_id-%>" src="" style="display:none; vertical-align: middle;"/>
+          <img id="data_item_form_spinner_<%=unique_id-%>" src="" style="display:none; vertical-align: middle;"/>
         </td>
       </tr>
     </table>

Modified: branches/datasets/app/views/data_sets/_data_set.rhtml (2868 => 2869)


--- branches/datasets/app/views/data_sets/_data_set.rhtml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/views/data_sets/_data_set.rhtml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -23,7 +23,7 @@
   <h3>Input data</h3>
   <table>
     <tbody>
-      <% (@data_set.data_items.select{|r| r.objekt.input?}).each do |i| %>
+      <% (@data_set.data_items.select{|r| r.input?}).each do |i| %>
         <tr class="data_item" id="item_<%= i.id -%>">
           <%= render :partial => "data_sets/data_item", :object => i, :locals => {:port_type => "input"} %>
         </tr>
@@ -35,7 +35,7 @@
     </tbody>
   </table>
 
-  <% if @data_set.data_items.select{|r| r.objekt.input?}.empty? %>
+  <% if @data_set.data_items.select{|r| r.input?}.empty? %>
     <span class="none_text">No output data specified</span>
   <% end  %>
 
@@ -57,7 +57,7 @@
 
   <table>
     <tbody>
-      <% (@data_set.data_items.select{|r| r.objekt.output?}).each do |o| %>
+      <% (@data_set.data_items.select{|r| r.output?}).each do |o| %>
         <tr class="data_item" id="item_<%= o.id -%>">
           <%= render :partial => "data_sets/data_item", :object => o, :locals => {:port_type => "output"} %>
         </tr>
@@ -69,7 +69,7 @@
     </tbody>
   </table>
 
-  <% if @data_set.data_items.select{|r| r.objekt.output?}.empty? %>
+  <% if @data_set.data_items.select{|r| r.output?}.empty? %>
     <span class="none_text">No output data specified</span>
   <% end  %>
 

Modified: branches/datasets/app/views/data_sets/_errors.rhtml (2868 => 2869)


--- branches/datasets/app/views/data_sets/_errors.rhtml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/views/data_sets/_errors.rhtml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,7 +1,7 @@
 <div id="errorExplanation" class="errorExplanation">
-  <h2><%= @errors.size -%> <%= @errors.size == 1 ? "error" : "errors" -%> prohibited this data item from being saved</h2>
+  <h2><%= errors.size -%> <%= errors.size == 1 ? "error" : "errors" -%> prohibited this data item from being saved</h2>
   <ul>
-    <% @errors.each do |e| %>
+    <% errors.each do |e| %>
       <li><%= e -%></li>
     <% end %>
   </ul>

Modified: branches/datasets/app/views/data_sets/_form.rhtml (2868 => 2869)


--- branches/datasets/app/views/data_sets/_form.rhtml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/app/views/data_sets/_form.rhtml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -18,7 +18,7 @@
 
   <p>
     <b>Workflow version:</b> <%= f.select :workflow_version,
-                 @workflow.versions.reverse.map {|w| ["#{w.version.to_s} address@hidden(w.version)}", w.version.to_s] } %>
+                 @workflow.versions.reverse.map {|w| ["#{w.version.to_s} address@hidden(w.version)}", w.version] } %>
   </p>
 
   <%= f.hidden_field :category, :value => "example_data" %>

Modified: branches/datasets/config/schema.d/workflows.xml (2868 => 2869)


--- branches/datasets/config/schema.d/workflows.xml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/config/schema.d/workflows.xml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -70,20 +70,19 @@
   </table>
 
   <table name="text_data">
-    <column type="integer"  name="data_set_id"/>
     <column type="text"     name="data"/>
-
-    <belongs-to target="data_sets"/>
   </table>
 
-  <table name="workflow_ports">
+  <table name="data_items">
 
-    <column type="integer"    name="workflow_id"/>
-    <column type="integer"    name="workflow_version"/>
-    <column type="string"     name="name"/>
-    <column type="string"     name="port_type"/>
+    <column type="integer"  name="data_id"/>
+    <column type="string"   name="data_type"/>
+    <column type="integer"  name="data_set_id"/>
+    <column type="string"   name="port_name"/>
+    <column type="string"   name="port_type"/>
 
-    <belongs-to target="workflows"/>
+    <belongs-to target="datas" polymorphic="true"/>
+    <belongs-to target="data_sets"/>
 
   </table>
 

Modified: branches/datasets/db/schema.rb (2868 => 2869)


--- branches/datasets/db/schema.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/db/schema.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,829 +1,841 @@
-# This file is autogenerated. Instead of editing this file, please use the
-# migrations feature of ActiveRecord to incrementally modify your database, and
+# This file is auto-generated from the current state of the database. Instead of editing this file, 
+# please use the migrations feature of Active Record to incrementally modify your database, and
 # then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your database schema. If you need
+# to create the application database on another system, you should be using db:schema:load, not running
+# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
 
 ActiveRecord::Schema.define(:version => 93) do
 
   create_table "activity_limits", :force => true do |t|
-    t.column "contributor_type", :string,   :null => false
-    t.column "contributor_id",   :integer,  :null => false
-    t.column "limit_feature",    :string,   :null => false
-    t.column "limit_max",        :integer
-    t.column "limit_frequency",  :integer
-    t.column "current_count",    :integer,  :null => false
-    t.column "reset_after",      :datetime
-    t.column "promote_after",    :datetime
+    t.string   "contributor_type", :null => false
+    t.integer  "contributor_id",   :null => false
+    t.string   "limit_feature",    :null => false
+    t.integer  "limit_max"
+    t.integer  "limit_frequency"
+    t.integer  "current_count",    :null => false
+    t.datetime "reset_after"
+    t.datetime "promote_after"
   end
 
   create_table "announcements", :force => true do |t|
-    t.column "title",      :string
-    t.column "user_id",    :integer
-    t.column "created_at", :datetime
-    t.column "updated_at", :datetime
-    t.column "body",       :text
-    t.column "body_html",  :text
+    t.string   "title"
+    t.integer  "user_id"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.text     "body"
+    t.text     "body_html"
   end
 
   create_table "attributions", :force => true do |t|
-    t.column "attributor_id",     :integer
-    t.column "attributor_type",   :string
-    t.column "attributable_id",   :integer
-    t.column "attributable_type", :string
-    t.column "created_at",        :datetime
-    t.column "updated_at",        :datetime
+    t.integer  "attributor_id"
+    t.string   "attributor_type"
+    t.integer  "attributable_id"
+    t.string   "attributable_type"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "auto_tables", :force => true do |t|
-    t.column "name",   :string
-    t.column "schema", :text
+    t.string "name"
+    t.text   "schema"
   end
 
   create_table "blobs", :force => true do |t|
-    t.column "local_name",       :string
-    t.column "contributor_id",   :integer
-    t.column "body_html",        :text
-    t.column "created_at",       :datetime
-    t.column "body",             :text
-    t.column "title",            :string
-    t.column "content_blob_id",  :integer
-    t.column "updated_at",       :datetime
-    t.column "license_id",       :integer
-    t.column "content_type_id",  :integer
-    t.column "contributor_type", :string
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "local_name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "title"
+    t.text     "body"
+    t.text     "body_html"
+    t.integer  "content_blob_id"
+    t.integer  "content_type_id"
+    t.integer  "license_id"
   end
 
   create_table "blog_posts", :force => true do |t|
-    t.column "blog_id",    :integer
-    t.column "title",      :string
-    t.column "body",       :text
-    t.column "created_at", :datetime
-    t.column "updated_at", :datetime
-    t.column "body_html",  :text
+    t.integer  "blog_id"
+    t.string   "title"
+    t.text     "body"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.text     "body_html"
   end
 
   create_table "blogs", :force => true do |t|
-    t.column "contributor_id",   :integer
-    t.column "contributor_type", :string
-    t.column "title",            :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "title"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "bookmarks", :force => true do |t|
-    t.column "title",             :string,   :limit => 50, :default => ""
-    t.column "created_at",        :datetime,                               :null => false
-    t.column "bookmarkable_type", :string,   :limit => 15, :default => "", :null => false
-    t.column "bookmarkable_id",   :integer,                :default => 0,  :null => false
-    t.column "user_id",           :integer,                :default => 0,  :null => false
+    t.string   "title",             :limit => 50, :default => ""
+    t.datetime "created_at",                                      :null => false
+    t.string   "bookmarkable_type", :limit => 15, :default => "", :null => false
+    t.integer  "bookmarkable_id",                 :default => 0,  :null => false
+    t.integer  "user_id",                         :default => 0,  :null => false
   end
 
   add_index "bookmarks", ["user_id"], :name => "index_bookmarks_on_user_id"
 
   create_table "citations", :force => true do |t|
-    t.column "user_id",          :integer
-    t.column "workflow_id",      :integer
-    t.column "workflow_version", :integer
-    t.column "authors",          :text
-    t.column "title",            :string
-    t.column "publication",      :string
-    t.column "published_at",     :datetime
-    t.column "accessed_at",      :datetime
-    t.column "url",              :string
-    t.column "isbn",             :string
-    t.column "issn",             :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.integer  "user_id"
+    t.integer  "workflow_id"
+    t.integer  "workflow_version"
+    t.text     "authors"
+    t.string   "title"
+    t.string   "publication"
+    t.datetime "published_at"
+    t.datetime "accessed_at"
+    t.string   "url"
+    t.string   "isbn"
+    t.string   "issn"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "client_applications", :force => true do |t|
-    t.column "name",         :string
-    t.column "url",          :string
-    t.column "support_url",  :string
-    t.column "callback_url", :string
-    t.column "key",          :string,   :limit => 50
-    t.column "secret",       :string,   :limit => 50
-    t.column "user_id",      :integer
-    t.column "key_type",     :string
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "creator_id",   :integer
+    t.string   "name"
+    t.string   "url"
+    t.string   "support_url"
+    t.string   "callback_url"
+    t.string   "key",          :limit => 50
+    t.string   "secret",       :limit => 50
+    t.integer  "user_id"
+    t.string   "key_type"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.integer  "creator_id"
   end
 
   add_index "client_applications", ["key"], :name => "index_client_applications_on_key", :unique => true
 
   create_table "comments", :force => true do |t|
-    t.column "comment",          :text
-    t.column "created_at",       :datetime,                               :null => false
-    t.column "commentable_id",   :integer,                :default => 0,  :null => false
-    t.column "commentable_type", :string,   :limit => 15, :default => "", :null => false
-    t.column "user_id",          :integer,                :default => 0,  :null => false
+    t.text     "comment"
+    t.datetime "created_at",                                     :null => false
+    t.integer  "commentable_id",                 :default => 0,  :null => false
+    t.string   "commentable_type", :limit => 15, :default => "", :null => false
+    t.integer  "user_id",                        :default => 0,  :null => false
   end
 
   add_index "comments", ["user_id"], :name => "index_comments_on_user_id"
 
   create_table "concept_relations", :force => true do |t|
-    t.column "subject_concept_id", :integer
-    t.column "relation_type",      :string
-    t.column "object_concept_id",  :integer
+    t.integer "subject_concept_id"
+    t.string  "relation_type"
+    t.integer "object_concept_id"
   end
 
   create_table "concepts", :force => true do |t|
-    t.column "vocabulary_id",    :integer
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "updated_at",       :datetime
-    t.column "phrase",           :string
-    t.column "description",      :text
+    t.datetime "updated_at"
+    t.text     "description_html"
+    t.string   "phrase"
+    t.text     "description"
+    t.integer  "vocabulary_id"
+    t.datetime "created_at"
   end
 
   create_table "content_blobs", :force => true do |t|
-    t.column "data", :binary
+    t.binary "data", :limit => 2147483647
   end
 
   create_table "content_types", :force => true do |t|
-    t.column "created_at",       :datetime
-    t.column "category",         :string
-    t.column "description_html", :text
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "mime_type",        :string
-    t.column "user_id",          :integer
-    t.column "description",      :text
+    t.integer  "user_id"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.string   "mime_type"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "category"
   end
 
   create_table "contributions", :force => true do |t|
-    t.column "label",                :string
-    t.column "rating",               :float
-    t.column "contributable_type",   :string
-    t.column "contributor_id",       :integer
-    t.column "layout",               :string
-    t.column "created_at",           :datetime
-    t.column "policy_id",            :integer
-    t.column "updated_at",           :datetime
-    t.column "license_id",           :integer
-    t.column "rank",                 :float
-    t.column "content_type_id",      :integer
-    t.column "site_downloads_count", :integer,  :default => 0
-    t.column "viewings_count",       :integer,  :default => 0
-    t.column "contributor_type",     :string
-    t.column "downloads_count",      :integer,  :default => 0
-    t.column "site_viewings_count",  :integer,  :default => 0
-    t.column "contributable_id",     :integer
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.integer  "contributable_id"
+    t.string   "contributable_type"
+    t.integer  "policy_id"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.integer  "downloads_count",      :default => 0
+    t.integer  "viewings_count",       :default => 0
+    t.float    "rating"
+    t.float    "rank"
+    t.integer  "content_type_id"
+    t.integer  "license_id"
+    t.integer  "site_downloads_count", :default => 0
+    t.integer  "site_viewings_count",  :default => 0
+    t.string   "label"
+    t.string   "layout"
   end
 
   add_index "contributions", ["contributable_id", "contributable_type"], :name => "index_contributions_on_contributable_id_and_contributable_type"
   add_index "contributions", ["contributor_id", "contributor_type"], :name => "index_contributions_on_contributor_id_and_contributor_type"
 
   create_table "creditations", :force => true do |t|
-    t.column "creditor_id",     :integer
-    t.column "creditor_type",   :string
-    t.column "creditable_id",   :integer
-    t.column "creditable_type", :string
-    t.column "created_at",      :datetime
-    t.column "updated_at",      :datetime
+    t.integer  "creditor_id"
+    t.string   "creditor_type"
+    t.integer  "creditable_id"
+    t.string   "creditable_type"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "curation_events", :force => true do |t|
-    t.column "user_id",      :integer
-    t.column "category",     :string
-    t.column "object_type",  :string
-    t.column "object_id",    :integer
-    t.column "details",      :text
-    t.column "details_html", :text
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
+    t.integer  "user_id"
+    t.string   "category"
+    t.string   "object_type"
+    t.integer  "object_id"
+    t.text     "details"
+    t.text     "details_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
+  create_table "data_items", :force => true do |t|
+    t.string  "port_type"
+    t.string  "port_name"
+    t.integer "data_set_id"
+    t.string  "data_type"
+    t.integer "data_id"
+  end
+
   create_table "data_sets", :force => true do |t|
-    t.column "category",         :text
-    t.column "description_html", :text
-    t.column "created_at",       :datetime
-    t.column "title",            :text
-    t.column "updated_at",       :datetime
-    t.column "description",      :text
-    t.column "workflow_id",      :integer
-    t.column "workflow_version", :integer
-    t.column "contributor_id",   :integer
-    t.column "contributor_type", :string
+    t.integer  "contributor_id"
+    t.string   "category"
+    t.text     "description_html"
+    t.datetime "created_at"
+    t.integer  "workflow_version"
+    t.string   "title"
+    t.datetime "updated_at"
+    t.integer  "workflow_id"
+    t.text     "description"
+    t.string   "contributor_type"
   end
 
   create_table "downloads", :force => true do |t|
-    t.column "kind",               :string
-    t.column "created_at",         :datetime
-    t.column "accessed_from_site", :boolean,  :default => false
-    t.column "user_id",            :integer
-    t.column "user_agent",         :string
-    t.column "contribution_id",    :integer
+    t.integer  "contribution_id"
+    t.integer  "user_id"
+    t.datetime "created_at"
+    t.string   "user_agent"
+    t.boolean  "accessed_from_site", :default => false
+    t.string   "kind"
   end
 
   add_index "downloads", ["contribution_id"], :name => "index_downloads_on_contribution_id"
 
   create_table "experiments", :force => true do |t|
-    t.column "title",            :string
-    t.column "description",      :text
-    t.column "description_html", :text
-    t.column "contributor_id",   :integer
-    t.column "contributor_type", :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "federation_sources", :force => true do |t|
-    t.column "name", :string
+    t.string "name"
   end
 
   create_table "friendships", :force => true do |t|
-    t.column "user_id",     :integer
-    t.column "friend_id",   :integer
-    t.column "created_at",  :datetime
-    t.column "accepted_at", :datetime
-    t.column "message",     :string,   :limit => 500
+    t.integer  "user_id"
+    t.integer  "friend_id"
+    t.datetime "created_at"
+    t.datetime "accepted_at"
+    t.string   "message",     :limit => 500
   end
 
   add_index "friendships", ["friend_id"], :name => "index_friendships_on_friend_id"
   add_index "friendships", ["user_id"], :name => "index_friendships_on_user_id"
 
   create_table "group_announcements", :force => true do |t|
-    t.column "title",      :string
-    t.column "network_id", :integer
-    t.column "user_id",    :integer
-    t.column "public",     :boolean,  :default => false
-    t.column "created_at", :datetime
-    t.column "updated_at", :datetime
-    t.column "body",       :text
-    t.column "body_html",  :text
+    t.string   "title"
+    t.integer  "network_id"
+    t.integer  "user_id"
+    t.boolean  "public",     :default => false
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.text     "body"
+    t.text     "body_html"
   end
 
   create_table "jobs", :force => true do |t|
-    t.column "title",            :string
-    t.column "description",      :text
-    t.column "description_html", :text
-    t.column "experiment_id",    :integer
-    t.column "user_id",          :integer
-    t.column "runnable_id",      :integer
-    t.column "runnable_version", :integer
-    t.column "runnable_type",    :string
-    t.column "runner_id",        :integer
-    t.column "runner_type",      :string
-    t.column "submitted_at",     :datetime
-    t.column "started_at",       :datetime
-    t.column "completed_at",     :datetime
-    t.column "last_status",      :string
-    t.column "last_status_at",   :datetime
-    t.column "job_uri",          :string
-    t.column "job_manifest",     :binary
-    t.column "inputs_uri",       :string
-    t.column "inputs_data",      :binary
-    t.column "outputs_uri",      :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
-    t.column "parent_job_id",    :integer
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.integer  "experiment_id"
+    t.integer  "user_id"
+    t.integer  "runnable_id"
+    t.integer  "runnable_version"
+    t.string   "runnable_type"
+    t.integer  "runner_id"
+    t.string   "runner_type"
+    t.datetime "submitted_at"
+    t.datetime "started_at"
+    t.datetime "completed_at"
+    t.string   "last_status"
+    t.datetime "last_status_at"
+    t.string   "job_uri"
+    t.binary   "job_manifest",     :limit => 2147483647
+    t.string   "inputs_uri"
+    t.binary   "inputs_data",      :limit => 2147483647
+    t.string   "outputs_uri"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.integer  "parent_job_id"
   end
 
   create_table "key_permissions", :force => true do |t|
-    t.column "client_application_id", :integer
-    t.column "for",                   :string
+    t.integer "client_application_id"
+    t.string  "for"
   end
 
   create_table "labels", :force => true do |t|
-    t.column "vocabulary_id", :integer
-    t.column "language",      :string
-    t.column "text",          :string
-    t.column "label_type",    :string
-    t.column "concept_id",    :integer
+    t.integer "concept_id"
+    t.string  "language"
+    t.string  "text"
+    t.integer "vocabulary_id"
+    t.string  "label_type"
   end
 
   create_table "license_attributes", :force => true do |t|
-    t.column "license_id",        :integer
-    t.column "license_option_id", :integer
-    t.column "created_at",        :datetime
+    t.integer  "license_id"
+    t.integer  "license_option_id"
+    t.datetime "created_at"
   end
 
   create_table "license_options", :force => true do |t|
-    t.column "user_id",          :integer
-    t.column "title",            :string
-    t.column "description",      :text
-    t.column "description_html", :text
-    t.column "uri",              :string
-    t.column "predicate",        :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.integer  "user_id"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.string   "uri"
+    t.string   "predicate"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "licenses", :force => true do |t|
-    t.column "user_id",          :integer
-    t.column "unique_name",      :string
-    t.column "title",            :string
-    t.column "description",      :text
-    t.column "description_html", :text
-    t.column "url",              :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.integer  "user_id"
+    t.string   "unique_name"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.string   "url"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "memberships", :force => true do |t|
-    t.column "user_id",                :integer
-    t.column "network_id",             :integer
-    t.column "created_at",             :datetime
-    t.column "user_established_at",    :datetime
-    t.column "network_established_at", :datetime
-    t.column "message",                :string,   :limit => 500
-    t.column "administrator",          :boolean,                 :default => false
+    t.integer  "user_id"
+    t.integer  "network_id"
+    t.datetime "created_at"
+    t.datetime "user_established_at"
+    t.datetime "network_established_at"
+    t.string   "message",                :limit => 500
+    t.boolean  "administrator",                         :default => false
   end
 
   add_index "memberships", ["network_id"], :name => "index_memberships_on_network_id"
   add_index "memberships", ["user_id"], :name => "index_memberships_on_user_id"
 
   create_table "messages", :force => true do |t|
-    t.column "from",                 :integer
-    t.column "to",                   :integer
-    t.column "subject",              :string
-    t.column "body",                 :text
-    t.column "reply_id",             :integer
-    t.column "created_at",           :datetime
-    t.column "read_at",              :datetime
-    t.column "body_html",            :text
-    t.column "deleted_by_sender",    :boolean,  :default => false
-    t.column "deleted_by_recipient", :boolean,  :default => false
+    t.integer  "from"
+    t.integer  "to"
+    t.string   "subject"
+    t.text     "body"
+    t.integer  "reply_id"
+    t.datetime "created_at"
+    t.datetime "read_at"
+    t.text     "body_html"
+    t.boolean  "deleted_by_sender",    :default => false
+    t.boolean  "deleted_by_recipient", :default => false
   end
 
   create_table "networks", :force => true do |t|
-    t.column "user_id",           :integer
-    t.column "title",             :string
-    t.column "unique_name",       :string
-    t.column "created_at",        :datetime
-    t.column "updated_at",        :datetime
-    t.column "description",       :text
-    t.column "description_html",  :text
-    t.column "new_member_policy", :string,   :default => "open"
-    t.column "inviter_id",        :integer
+    t.integer  "user_id"
+    t.string   "title"
+    t.string   "unique_name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.text     "description"
+    t.text     "description_html"
+    t.string   "new_member_policy", :default => "open"
+    t.integer  "inviter_id"
   end
 
   add_index "networks", ["user_id"], :name => "index_networks_on_user_id"
 
   create_table "oauth_nonces", :force => true do |t|
-    t.column "nonce",      :string
-    t.column "timestamp",  :integer
-    t.column "created_at", :datetime
-    t.column "updated_at", :datetime
+    t.string   "nonce"
+    t.integer  "timestamp"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   add_index "oauth_nonces", ["nonce", "timestamp"], :name => "index_oauth_nonces_on_nonce_and_timestamp", :unique => true
 
   create_table "oauth_tokens", :force => true do |t|
-    t.column "user_id",               :integer
-    t.column "type",                  :string,   :limit => 20
-    t.column "client_application_id", :integer
-    t.column "token",                 :string,   :limit => 50
-    t.column "secret",                :string,   :limit => 50
-    t.column "authorized_at",         :datetime
-    t.column "invalidated_at",        :datetime
-    t.column "created_at",            :datetime
-    t.column "updated_at",            :datetime
+    t.integer  "user_id"
+    t.string   "type",                  :limit => 20
+    t.integer  "client_application_id"
+    t.string   "token",                 :limit => 50
+    t.string   "secret",                :limit => 50
+    t.datetime "authorized_at"
+    t.datetime "invalidated_at"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   add_index "oauth_tokens", ["token"], :name => "index_oauth_tokens_on_token", :unique => true
 
   create_table "ontologies", :force => true do |t|
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "uri",              :string
-    t.column "prefix",           :string
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "user_id",          :integer
-    t.column "description",      :text
+    t.string   "prefix"
+    t.datetime "updated_at"
+    t.string   "uri"
+    t.string   "title"
+    t.text     "description_html"
+    t.text     "description"
+    t.integer  "user_id"
+    t.datetime "created_at"
   end
 
   create_table "pack_contributable_entries", :force => true do |t|
-    t.column "comment",               :text
-    t.column "contributable_type",    :string
-    t.column "contributable_version", :integer
-    t.column "created_at",            :datetime
-    t.column "updated_at",            :datetime
-    t.column "pack_id",               :integer,  :null => false
-    t.column "user_id",               :integer,  :null => false
-    t.column "contributable_id",      :integer,  :null => false
+    t.integer  "pack_id",               :null => false
+    t.integer  "contributable_id",      :null => false
+    t.integer  "contributable_version"
+    t.string   "contributable_type"
+    t.text     "comment"
+    t.integer  "user_id",               :null => false
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "pack_remote_entries", :force => true do |t|
-    t.column "comment",       :text
-    t.column "created_at",    :datetime
-    t.column "uri",           :string
-    t.column "title",         :string
-    t.column "updated_at",    :datetime
-    t.column "pack_id",       :integer,  :null => false
-    t.column "user_id",       :integer,  :null => false
-    t.column "alternate_uri", :string
+    t.integer  "pack_id",       :null => false
+    t.string   "title"
+    t.string   "uri"
+    t.string   "alternate_uri"
+    t.text     "comment"
+    t.integer  "user_id",       :null => false
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "packs", :force => true do |t|
-    t.column "contributor_id",   :integer
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "description",      :text
-    t.column "contributor_type", :string
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "pending_invitations", :force => true do |t|
-    t.column "email",        :string
-    t.column "created_at",   :datetime
-    t.column "request_type", :string
-    t.column "requested_by", :integer
-    t.column "request_for",  :integer
-    t.column "message",      :string,   :limit => 500
-    t.column "token",        :string
+    t.string   "email"
+    t.datetime "created_at"
+    t.string   "request_type"
+    t.integer  "requested_by"
+    t.integer  "request_for"
+    t.string   "message",      :limit => 500
+    t.string   "token"
   end
 
   create_table "permissions", :force => true do |t|
-    t.column "contributor_id",   :integer
-    t.column "contributor_type", :string
-    t.column "policy_id",        :integer
-    t.column "download",         :boolean,  :default => false
-    t.column "edit",             :boolean,  :default => false
-    t.column "view",             :boolean,  :default => false
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.integer  "policy_id"
+    t.boolean  "download",         :default => false
+    t.boolean  "edit",             :default => false
+    t.boolean  "view",             :default => false
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   add_index "permissions", ["policy_id"], :name => "index_permissions_on_policy_id"
 
   create_table "picture_selections", :force => true do |t|
-    t.column "user_id",    :integer
-    t.column "picture_id", :integer
-    t.column "created_at", :datetime
+    t.integer  "user_id"
+    t.integer  "picture_id"
+    t.datetime "created_at"
   end
 
   create_table "pictures", :force => true do |t|
-    t.column "data",    :binary
-    t.column "user_id", :integer
+    t.binary  "data",    :limit => 16777215
+    t.integer "user_id"
   end
 
+  create_table "plugin_schema_info", :id => false, :force => true do |t|
+    t.string  "plugin_name"
+    t.integer "version"
+  end
+
   create_table "policies", :force => true do |t|
-    t.column "name",             :string
-    t.column "contributor_id",   :integer
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
-    t.column "update_mode",      :integer
-    t.column "share_mode",       :integer
-    t.column "contributor_type", :string
-    t.column "public_view",      :boolean,  :default => false
-    t.column "public_download",  :boolean,  :default => false
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.integer  "share_mode"
+    t.integer  "update_mode"
+    t.boolean  "public_download",  :default => false
+    t.boolean  "public_view",      :default => false
   end
 
   create_table "predicates", :force => true do |t|
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "title",            :string
-    t.column "ontology_id",      :integer
-    t.column "updated_at",       :datetime
-    t.column "phrase",           :string
-    t.column "equivalent_to",    :text
-    t.column "description",      :text
+    t.datetime "updated_at"
+    t.string   "title"
+    t.text     "description_html"
+    t.string   "phrase"
+    t.integer  "ontology_id"
+    t.text     "description"
+    t.text     "equivalent_to"
+    t.datetime "created_at"
   end
 
   create_table "previews", :force => true do |t|
-    t.column "created_at",    :datetime
-    t.column "svg_blob_id",   :integer
-    t.column "image_blob_id", :integer
+    t.integer  "svg_blob_id"
+    t.integer  "image_blob_id"
+    t.datetime "created_at"
   end
 
   create_table "profiles", :force => true do |t|
-    t.column "user_id",             :integer
-    t.column "picture_id",          :integer
-    t.column "email",               :string
-    t.column "website",             :string
-    t.column "created_at",          :datetime
-    t.column "updated_at",          :datetime
-    t.column "body",                :text
-    t.column "body_html",           :text
-    t.column "field_or_industry",   :string
-    t.column "occupation_or_roles", :string
-    t.column "organisations",       :text
-    t.column "location_city",       :string
-    t.column "location_country",    :string
-    t.column "interests",           :text
-    t.column "contact_details",     :text
+    t.integer  "user_id"
+    t.integer  "picture_id"
+    t.string   "email"
+    t.string   "website"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.text     "body"
+    t.text     "body_html"
+    t.string   "field_or_industry"
+    t.string   "occupation_or_roles"
+    t.text     "organisations"
+    t.string   "location_city"
+    t.string   "location_country"
+    t.text     "interests"
+    t.text     "contact_details"
   end
 
   add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id"
 
   create_table "ratings", :force => true do |t|
-    t.column "rating",        :integer,                :default => 0
-    t.column "created_at",    :datetime,                               :null => false
-    t.column "rateable_type", :string,   :limit => 15, :default => "", :null => false
-    t.column "rateable_id",   :integer,                :default => 0,  :null => false
-    t.column "user_id",       :integer,                :default => 0,  :null => false
+    t.integer  "rating",                      :default => 0
+    t.datetime "created_at",                                  :null => false
+    t.string   "rateable_type", :limit => 15, :default => "", :null => false
+    t.integer  "rateable_id",                 :default => 0,  :null => false
+    t.integer  "user_id",                     :default => 0,  :null => false
   end
 
   add_index "ratings", ["user_id"], :name => "index_ratings_on_user_id"
 
   create_table "relationships", :force => true do |t|
-    t.column "context_id",   :integer
-    t.column "created_at",   :datetime
-    t.column "context_type", :string
-    t.column "objekt_type",  :string
-    t.column "objekt_id",    :integer
-    t.column "subject_id",   :integer
-    t.column "predicate_id", :integer
-    t.column "subject_type", :string
-    t.column "user_id",      :integer
+    t.string   "objekt_type"
+    t.integer  "objekt_id"
+    t.string   "subject_type"
+    t.integer  "subject_id"
+    t.integer  "user_id"
+    t.datetime "created_at"
+    t.integer  "context_id"
+    t.integer  "predicate_id"
+    t.string   "context_type"
   end
 
   create_table "remote_workflows", :force => true do |t|
-    t.column "workflow_id",        :integer
-    t.column "workflow_version",   :integer
-    t.column "taverna_enactor_id", :integer
-    t.column "workflow_uri",       :string
+    t.integer "workflow_id"
+    t.integer "workflow_version"
+    t.integer "taverna_enactor_id"
+    t.string  "workflow_uri"
   end
 
   create_table "reviews", :force => true do |t|
-    t.column "title",           :string,                 :default => ""
-    t.column "review",          :text
-    t.column "created_at",      :datetime,                               :null => false
-    t.column "updated_at",      :datetime,                               :null => false
-    t.column "reviewable_id",   :integer,                :default => 0,  :null => false
-    t.column "reviewable_type", :string,   :limit => 15, :default => "", :null => false
-    t.column "user_id",         :integer,                :default => 0,  :null => false
+    t.string   "title",                         :default => ""
+    t.text     "review"
+    t.datetime "created_at",                                    :null => false
+    t.datetime "updated_at",                                    :null => false
+    t.integer  "reviewable_id",                 :default => 0,  :null => false
+    t.string   "reviewable_type", :limit => 15, :default => "", :null => false
+    t.integer  "user_id",                       :default => 0,  :null => false
   end
 
   add_index "reviews", ["user_id"], :name => "index_reviews_on_user_id"
 
   create_table "service_categories", :force => true do |t|
-    t.column "label",        :string
-    t.column "uri",          :string
-    t.column "retrieved_at", :datetime
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
+    t.string   "uri"
+    t.datetime "updated_at"
+    t.integer  "service_id"
+    t.string   "label"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "service_deployments", :force => true do |t|
-    t.column "service_provider_id",  :integer
-    t.column "iso3166_country_code", :string
-    t.column "city",                 :string
-    t.column "submitter_label",      :string
-    t.column "uri",                  :string
-    t.column "retrieved_at",         :datetime
-    t.column "created_at",           :datetime
-    t.column "submitter_uri",        :string
-    t.column "country",              :string
-    t.column "updated_at",           :datetime
-    t.column "service_id",           :integer
-    t.column "flag_url",             :string
-    t.column "created",              :datetime
-    t.column "endpoint",             :string
+    t.string   "iso3166_country_code"
+    t.string   "city"
+    t.string   "submitter_label"
+    t.string   "uri"
+    t.datetime "updated_at"
+    t.string   "submitter_uri"
+    t.string   "country"
+    t.integer  "service_id"
+    t.datetime "created"
+    t.integer  "service_provider_id"
+    t.string   "flag_url"
+    t.string   "endpoint"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "service_providers", :force => true do |t|
-    t.column "name",         :string
-    t.column "uri",          :string
-    t.column "retrieved_at", :datetime
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "description",  :text
-    t.column "created",      :datetime
+    t.string   "name"
+    t.string   "uri"
+    t.datetime "updated_at"
+    t.text     "description"
+    t.datetime "created"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "service_tags", :force => true do |t|
-    t.column "label",        :string
-    t.column "uri",          :string
-    t.column "retrieved_at", :datetime
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
+    t.string   "uri"
+    t.datetime "updated_at"
+    t.integer  "service_id"
+    t.string   "label"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "service_types", :force => true do |t|
-    t.column "label",        :string
-    t.column "retrieved_at", :datetime
-    t.column "created_at",   :datetime
-    t.column "updated_at",   :datetime
-    t.column "service_id",   :integer
+    t.datetime "updated_at"
+    t.integer  "service_id"
+    t.string   "label"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "services", :force => true do |t|
-    t.column "iso3166_country_code",     :string
-    t.column "city",                     :string
-    t.column "name",                     :string
-    t.column "contributor_id",           :integer
-    t.column "submitter_label",          :string
-    t.column "uri",                      :string
-    t.column "retrieved_at",             :datetime
-    t.column "created_at",               :datetime
-    t.column "monitor_symbol_url",       :string
-    t.column "country",                  :string
-    t.column "submitter_uri",            :string
-    t.column "updated_at",               :datetime
-    t.column "monitor_message",          :text
-    t.column "monitor_label",            :string
-    t.column "monitor_last_checked",     :datetime
-    t.column "monitor_small_symbol_url", :string
-    t.column "description",              :text
-    t.column "flag_url",                 :string
-    t.column "wsdl",                     :string
-    t.column "provider_label",           :string
-    t.column "contributor_type",         :string
-    t.column "documentation_uri",        :string
-    t.column "endpoint",                 :string
-    t.column "provider_uri",             :string
-    t.column "created",                  :datetime
+    t.string   "documentation_uri"
+    t.string   "iso3166_country_code"
+    t.string   "city"
+    t.string   "name"
+    t.string   "provider_uri"
+    t.string   "submitter_label"
+    t.string   "uri"
+    t.datetime "updated_at"
+    t.string   "monitor_symbol_url"
+    t.datetime "monitor_last_checked"
+    t.string   "monitor_label"
+    t.string   "country"
+    t.string   "submitter_uri"
+    t.string   "monitor_small_symbol_url"
+    t.text     "monitor_message"
+    t.text     "description"
+    t.string   "wsdl"
+    t.datetime "created"
+    t.string   "contributor_type"
+    t.integer  "contributor_id"
+    t.string   "flag_url"
+    t.string   "endpoint"
+    t.string   "provider_label"
+    t.datetime "retrieved_at"
+    t.datetime "created_at"
   end
 
   create_table "sessions", :force => true do |t|
-    t.column "session_id", :string
-    t.column "data",       :text
-    t.column "updated_at", :datetime
+    t.string   "session_id"
+    t.text     "data"
+    t.datetime "updated_at"
   end
 
   add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
   add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
 
   create_table "taggings", :force => true do |t|
-    t.column "tag_id",        :integer
-    t.column "taggable_id",   :integer
-    t.column "taggable_type", :string
-    t.column "user_id",       :integer
-    t.column "created_at",    :datetime
+    t.integer  "tag_id"
+    t.integer  "taggable_id"
+    t.string   "taggable_type"
+    t.integer  "user_id"
+    t.datetime "created_at"
   end
 
   add_index "taggings", ["tag_id", "taggable_type"], :name => "index_taggings_on_tag_id_and_taggable_type"
+  add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type"
   add_index "taggings", ["user_id", "tag_id", "taggable_type"], :name => "index_taggings_on_user_id_and_tag_id_and_taggable_type"
-  add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type"
   add_index "taggings", ["user_id", "taggable_id", "taggable_type"], :name => "index_taggings_on_user_id_and_taggable_id_and_taggable_type"
 
   create_table "tags", :force => true do |t|
-    t.column "name",             :string
-    t.column "taggings_count",   :integer,  :default => 0, :null => false
-    t.column "vocabulary_id",    :integer
-    t.column "description",      :text
-    t.column "description_html", :text
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.string   "name"
+    t.integer  "taggings_count",   :default => 0, :null => false
+    t.integer  "vocabulary_id"
+    t.text     "description"
+    t.text     "description_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   add_index "tags", ["name"], :name => "index_tags_on_name"
   add_index "tags", ["taggings_count"], :name => "index_tags_on_taggings_count"
 
   create_table "taverna_enactors", :force => true do |t|
-    t.column "title",            :string
-    t.column "description",      :text
-    t.column "contributor_id",   :integer
-    t.column "contributor_type", :string
-    t.column "url",              :string
-    t.column "username",         :string
-    t.column "crypted_password", :string
-    t.column "created_at",       :datetime
-    t.column "updated_at",       :datetime
+    t.string   "title"
+    t.text     "description"
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "url"
+    t.string   "username"
+    t.string   "crypted_password"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "text_data", :force => true do |t|
-    t.column "data",        :text
-    t.column "data_set_id", :integer
+    t.text "data"
   end
 
   create_table "topic_feedbacks", :force => true do |t|
-    t.column "submit_dt", :datetime
-    t.column "user_id",   :integer
-    t.column "score",     :integer
-    t.column "topic_id",  :integer
+    t.integer  "score"
+    t.integer  "topic_id"
+    t.datetime "submit_dt"
+    t.integer  "user_id"
   end
 
   create_table "topic_runs", :force => true do |t|
-    t.column "runtime",     :datetime
-    t.column "description", :string
+    t.datetime "runtime"
+    t.string   "description"
   end
 
   create_table "topic_tag_map", :force => true do |t|
-    t.column "display_flag", :boolean
-    t.column "tag_id",       :integer
-    t.column "topic_id",     :integer
-    t.column "probability",  :float
+    t.integer "topic_id"
+    t.boolean "display_flag"
+    t.integer "tag_id"
+    t.float   "probability"
   end
 
   create_table "topic_workflow_map", :force => true do |t|
-    t.column "display_flag", :boolean
-    t.column "workflow_id",  :integer
-    t.column "topic_id",     :integer
-    t.column "probability",  :float
+    t.integer "topic_id"
+    t.boolean "display_flag"
+    t.integer "workflow_id"
+    t.float   "probability"
   end
 
   create_table "topics", :force => true do |t|
-    t.column "name",        :string
-    t.column "orig_run_id", :integer
-    t.column "run_id",      :integer
+    t.string  "name"
+    t.integer "orig_run_id"
+    t.integer "run_id"
   end
 
   create_table "user_reports", :force => true do |t|
-    t.column "report",       :text
-    t.column "created_at",   :datetime
-    t.column "subject_id",   :integer
-    t.column "subject_type", :string
-    t.column "user_id",      :integer
-    t.column "content",      :text
+    t.string   "subject_type"
+    t.text     "content"
+    t.integer  "subject_id"
+    t.integer  "user_id"
+    t.text     "report"
+    t.datetime "created_at"
   end
 
   create_table "users", :force => true do |t|
-    t.column "openid_url",                :string
-    t.column "name",                      :string
-    t.column "created_at",                :datetime
-    t.column "updated_at",                :datetime
-    t.column "last_seen_at",              :datetime
-    t.column "username",                  :string
-    t.column "crypted_password",          :string,   :limit => 40
-    t.column "salt",                      :string,   :limit => 40
-    t.column "remember_token",            :string
-    t.column "remember_token_expires_at", :datetime
-    t.column "downloads_count",           :integer,                :default => 0
-    t.column "viewings_count",            :integer,                :default => 0
-    t.column "email",                     :string
-    t.column "unconfirmed_email",         :string
-    t.column "email_confirmed_at",        :datetime
-    t.column "activated_at",              :datetime
-    t.column "receive_notifications",     :boolean,                :default => true
-    t.column "reset_password_code",       :string
-    t.column "reset_password_code_until", :datetime
+    t.string   "openid_url"
+    t.string   "name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.datetime "last_seen_at"
+    t.string   "username"
+    t.string   "crypted_password",          :limit => 40
+    t.string   "salt",                      :limit => 40
+    t.string   "remember_token"
+    t.datetime "remember_token_expires_at"
+    t.integer  "downloads_count",                         :default => 0
+    t.integer  "viewings_count",                          :default => 0
+    t.string   "email"
+    t.string   "unconfirmed_email"
+    t.datetime "email_confirmed_at"
+    t.datetime "activated_at"
+    t.boolean  "receive_notifications",                   :default => true
+    t.string   "reset_password_code"
+    t.datetime "reset_password_code_until"
   end
 
   create_table "viewings", :force => true do |t|
-    t.column "contribution_id",    :integer
-    t.column "user_id",            :integer
-    t.column "created_at",         :datetime
-    t.column "user_agent",         :string
-    t.column "accessed_from_site", :boolean,  :default => false
+    t.integer  "contribution_id"
+    t.integer  "user_id"
+    t.datetime "created_at"
+    t.string   "user_agent"
+    t.boolean  "accessed_from_site", :default => false
   end
 
   add_index "viewings", ["contribution_id"], :name => "index_viewings_on_contribution_id"
 
   create_table "vocabularies", :force => true do |t|
-    t.column "created_at",       :datetime
-    t.column "description_html", :text
-    t.column "uri",              :string
-    t.column "prefix",           :string
-    t.column "title",            :string
-    t.column "updated_at",       :datetime
-    t.column "user_id",          :integer
-    t.column "description",      :text
+    t.integer  "user_id"
+    t.string   "title"
+    t.text     "description"
+    t.text     "description_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "prefix"
+    t.string   "uri"
   end
 
-  create_table "workflow_ports", :force => true do |t|
-    t.column "name",             :string
-    t.column "port_type",        :string
-    t.column "workflow_id",      :integer
-    t.column "workflow_version", :integer
-  end
-
   create_table "workflow_processors", :force => true do |t|
-    t.column "name",           :string
-    t.column "wsdl_operation", :string
-    t.column "workflow_id",    :integer
-    t.column "wsdl",           :string
+    t.string  "name"
+    t.string  "wsdl_operation"
+    t.string  "wsdl"
+    t.integer "workflow_id"
   end
 
   create_table "workflow_versions", :force => true do |t|
-    t.column "contributor_id",    :integer
-    t.column "revision_comments", :text
-    t.column "created_at",        :datetime
-    t.column "body_html",         :text
-    t.column "body",              :text
-    t.column "title",             :string
-    t.column "content_blob_id",   :integer
-    t.column "license",           :string
-    t.column "updated_at",        :datetime
-    t.column "last_edited_by",    :string
-    t.column "svg",               :string
-    t.column "unique_name",       :string
-    t.column "content_type_id",   :integer
-    t.column "version",           :integer
-    t.column "workflow_id",       :integer
-    t.column "contributor_type",  :string
-    t.column "preview_id",        :integer
-    t.column "image",             :string
-    t.column "file_ext",          :string
+    t.integer  "workflow_id"
+    t.integer  "version"
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "title"
+    t.string   "unique_name"
+    t.text     "body"
+    t.text     "body_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "image"
+    t.string   "svg"
+    t.text     "revision_comments"
+    t.integer  "content_blob_id"
+    t.string   "file_ext"
+    t.string   "last_edited_by"
+    t.integer  "content_type_id"
+    t.string   "license"
+    t.integer  "preview_id"
   end
 
   add_index "workflow_versions", ["workflow_id"], :name => "index_workflow_versions_on_workflow_id"
 
   create_table "workflows", :force => true do |t|
-    t.column "contributor_id",   :integer
-    t.column "created_at",       :datetime
-    t.column "body_html",        :text
-    t.column "body",             :text
-    t.column "title",            :string
-    t.column "content_blob_id",  :integer
-    t.column "updated_at",       :datetime
-    t.column "last_edited_by",   :string
-    t.column "svg",              :string
-    t.column "license_id",       :integer
-    t.column "unique_name",      :string
-    t.column "content_type_id",  :integer
-    t.column "current_version",  :integer
-    t.column "contributor_type", :string
-    t.column "preview_id",       :integer
-    t.column "image",            :string
-    t.column "file_ext",         :string
+    t.integer  "contributor_id"
+    t.string   "contributor_type"
+    t.string   "image"
+    t.string   "svg"
+    t.string   "title"
+    t.string   "unique_name"
+    t.text     "body"
+    t.text     "body_html"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.integer  "current_version"
+    t.integer  "content_blob_id"
+    t.string   "file_ext"
+    t.string   "last_edited_by"
+    t.integer  "content_type_id"
+    t.integer  "license_id"
+    t.integer  "preview_id"
   end
 
 end

Added: branches/datasets/test/fixtures/data_items.yml (0 => 2869)


--- branches/datasets/test/fixtures/data_items.yml	                        (rev 0)
+++ branches/datasets/test/fixtures/data_items.yml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -0,0 +1,19 @@
+# For data set: string_concat_v1_example
+string_concat_v1_example_text_data:
+  data: string1_example (TextData)
+  port_name: string1
+  port_type: input
+  data_set: string_concat_v1_example
+
+string_concat_v1_example_file_data:
+  data_id: 1 # picture
+  data_type: Blob
+  port_name: string2
+  port_type: input
+  data_set: string_concat_v1_example
+
+string_concat_v1_example_text_data2:
+  data: result_example (TextData)
+  port_name: result
+  port_type: output
+  data_set: string_concat_v1_example

Deleted: branches/datasets/test/fixtures/relationships.yml (2868 => 2869)


--- branches/datasets/test/fixtures/relationships.yml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/test/fixtures/relationships.yml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,23 +0,0 @@
-# For data set: string_concat_v1_example
-string_concat_v1_example_text_data:
-  subject: string1_example (TextData)
-  objekt: string_concat_v1_string1 (WorkflowPort)
-  predicate: input_data_to
-  context: string_concat_v1_example (DataSet)
-  user_id: 1 # john
-
-string_concat_v1_example_file_data:
-  subject_id: 1 # picture
-  subject_type: Blob
-  objekt: string_concat_v1_string2 (WorkflowPort)
-  predicate: input_data_to
-  context: string_concat_v1_example (DataSet)
-  user_id: 1 # john
-
-string_concat_v1_example_text_data2:
-  subject: result_example (TextData)
-  objekt: string_concat_v1_result (WorkflowPort)
-  predicate: output_data_from
-  context: string_concat_v1_example (DataSet)
-  user_id: 1 # john
-

Modified: branches/datasets/test/fixtures/text_data.yml (2868 => 2869)


--- branches/datasets/test/fixtures/text_data.yml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/test/fixtures/text_data.yml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,7 +1,5 @@
 string1_example:
   data: hello
-  data_set: string_concat_v1_example
 
 result_example:
   data: hello world
-  data_set: string_concat_v1_example
\ No newline at end of file

Deleted: branches/datasets/test/fixtures/workflow_ports.yml (2868 => 2869)


--- branches/datasets/test/fixtures/workflow_ports.yml	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/test/fixtures/workflow_ports.yml	2011-12-07 10:50:49 UTC (rev 2869)
@@ -1,22 +0,0 @@
-string_concat_v1_string1:
-  workflow: string_concat
-  workflow_version: 1
-  port_type: input
-  name: string1
-
-string_concat_v1_string2:
-  workflow: string_concat
-  workflow_version: 1
-  port_type: input
-  name: string2
-
-string_concat_v1_result:
-  workflow: string_concat
-  workflow_version: 1
-  port_type: output
-  name: result
-
-string_concat_v2_string1:
-  workflow: string_concat
-  workflow_version: 1
-  port_type: input
\ No newline at end of file

Modified: branches/datasets/test/functional/data_items_controller_test.rb (2868 => 2869)


--- branches/datasets/test/functional/data_items_controller_test.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/test/functional/data_items_controller_test.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -12,21 +12,18 @@
 
     login_as(:john)
 
-    assert_no_difference("WorkflowPort.count") do # Port should already exist, so this shouldn't change
     assert_difference("TextData.count", 1) do
-    assert_difference("Relationship.count", 1) do
+    assert_difference("DataItem.count", 1) do
       post :create, :data_set_id => data_set.id,
           :workflow_port => "string1",
-          :predicate_id => predicates(:input_data_to).id,
           :workflow_port_type => "input",
-          :data_type => "text",
+          :data_type => "TextData",
           :data ="" "test"
     end
     end
-    end
 
     assert_response :success
-    assert_equal "test", assigns(:data_item).subject.data
+    assert_equal "test", assigns(:data_item).data.data
   end
 
   test "can add file data to a data set" do
@@ -34,33 +31,48 @@
 
     login_as(:john)
 
-    assert_no_difference("WorkflowPort.count") do # Port should already exist, so this shouldn't change
-    assert_difference("Relationship.count", 1) do
+    assert_difference("DataItem.count", 1) do
       post :create, :data_set_id => data_set.id,
           :workflow_port => "string1",
-          :predicate_id => predicates(:input_data_to).id,
           :workflow_port_type => "input",
-          :data_type => "file",
-          :file_id => blobs(:picture).id
+          :data_type => "Blob",
+          :data_id => blobs(:picture).id
     end
-    end
 
     assert_response :success
-    assert_equal blobs(:picture), assigns(:data_item).subject
+    assert_equal blobs(:picture), assigns(:data_item).data
   end
 
+
+  test "text data not saved if data item not saved" do
+    data_set = data_sets(:string_concat_v1_empty)
+
+    login_as(:john)
+
+    assert_no_difference("TextData.count") do
+    assert_no_difference("DataItem.count") do
+      post :create, :data_set_id => data_set.id,
+          :workflow_port => "string1",
+          :workflow_port_type => "invalid_port_type_that_will_cause_failure",
+          :data_type => "TextData",
+          :data ="" "anything"
+    end
+    end
+
+    assert_response 400
+  end
+
   test "can't add items to an already occupied port in a data set" do
     data_set = data_sets(:string_concat_v1_example)
 
     login_as(:john)
 
     assert_no_difference("TextData.count") do
-    assert_no_difference("Relationship.count") do
+    assert_no_difference("DataItem.count") do
       post :create, :data_set_id => data_set.id,
           :workflow_port => "string1",
-          :predicate_id => predicates(:input_data_to).id,
           :workflow_port_type => "input",
-          :data_type => "text",
+          :data_type => "TextData",
           :data ="" "test"
     end
     end
@@ -74,12 +86,11 @@
     login_as(:jane)
 
     assert_no_difference("TextData.count") do
-    assert_no_difference("Relationship.count") do
+    assert_no_difference("DataItem.count") do
       post :create, :data_set_id => data_set.id,
           :workflow_port => "string1",
-          :predicate_id => predicates(:input_data_to).id,
           :workflow_port_type => "input",
-          :data_type => "text",
+          :data_type => "TextData",
           :data ="" "test"
     end
     end
@@ -88,40 +99,35 @@
   end
 
   test "can replace data in a data set" do
-    data_item = relationships(:string_concat_v1_example_text_data2)
+    data_item = data_items(:string_concat_v1_example_text_data2)
 
     login_as(:john)
 
-    assert_no_difference("WorkflowPort.count") do # Port should already exist, so this shouldn't change
     assert_difference("TextData.count", -1) do
-    assert_no_difference("Relationship.count") do
+    assert_no_difference("DataItem.count") do
       put :update,
           :id => data_item.id,
           :workflow_port => "result",
-          :predicate_id => predicates(:output_data_from).id,
           :workflow_port_type => "output",
-          :data_type => "file",
-          :file_id => blobs(:picture).id
+          :data_type => "Blob",
+          :data_id => blobs(:picture).id
     end
     end
-    end
 
     assert_response :success
-    assert_equal blobs(:picture), assigns(:data_item).subject
+    assert_equal blobs(:picture), assigns(:data_item).data
   end
 
   test "can delete data in a data set" do
-    data_item = relationships(:string_concat_v1_example_text_data2)
+    data_item = data_items(:string_concat_v1_example_text_data2)
 
     login_as(:john)
 
-    assert_no_difference("WorkflowPort.count") do # Port should already exist, so this shouldn't change
     assert_difference("TextData.count", -1) do
-    assert_difference("Relationship.count", -1) do
+    assert_difference("DataItem.count", -1) do
       delete :destroy, :id => data_item.id
     end
     end
-    end
 
     assert_response :success
   end

Modified: branches/datasets/test/functional/data_sets_controller_test.rb (2868 => 2869)


--- branches/datasets/test/functional/data_sets_controller_test.rb	2011-12-06 12:37:34 UTC (rev 2868)
+++ branches/datasets/test/functional/data_sets_controller_test.rb	2011-12-07 10:50:49 UTC (rev 2869)
@@ -45,12 +45,12 @@
   test "can destroy data set without leaving orphaned resources" do
     data_set = data_sets(:string_concat_v1_example)
     item_count = data_set.data_items.size
-    text_data_count = data_set.data_items.select {|i| i.subject_type == "TextData"}.size
+    text_data_count = data_set.data_items.select {|i| i.data_type == "TextData"}.size
 
     login_as(:john)
 
     assert_difference("TextData.count", -text_data_count) do
-    assert_difference("Relationship.count", -item_count) do
+    assert_difference("DataItem.count", -item_count) do
     assert_difference("DataSet.count", -1) do
       delete :destroy, :id => data_set.id
     end

reply via email to

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