myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3593] branches/packs: RO-centric view and specif


From: noreply
Subject: [myexperiment-hackers] [3593] branches/packs: RO-centric view and specify type and folder on resource add
Date: Fri, 12 Jul 2013 13:35:49 +0000 (UTC)

Revision
3593
Author
dgc
Date
2013-07-12 13:35:48 +0000 (Fri, 12 Jul 2013)

Log Message

RO-centric view and specify type and folder on resource add

Modified Paths

Diff

Modified: branches/packs/app/controllers/packs_controller.rb (3592 => 3593)


--- branches/packs/app/controllers/packs_controller.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/controllers/packs_controller.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -6,6 +6,10 @@
 class PacksController < ApplicationController
   include ApplicationHelper
   
+  ## NOTE: URI must match config/default_settings.yml ro_resource_types
+  WORKFLOW_DEFINITION = "http://purl.org/wf4ever/wfdesc#WorkflowDefinition"
+  RO_RESOURCE = "http://purl.org/wf4ever/ro#Resource"
+
   before_filter :login_required, :except => [:index, :show, :search, :items, :download, :statistics]
   
   before_filter :find_pack_auth, :except => [:index, :new, :create, :search]
@@ -77,6 +81,8 @@
     respond_to do |format|
       format.html {
         
+        @graph = @pack.research_object.merged_annotation_graphs
+
         @lod_nir  = pack_url(@pack)
         @lod_html = pack_url(:id => @pack.id, :format => 'html')
         @lod_rdf  = pack_url(:id => @pack.id, :format => 'rdf')
@@ -383,6 +389,9 @@
 
         # By this point, we either have errors, or have an entry that needs saving.
         if errors.empty? && entry.save
+
+          post_process_created_resource(@pack, entry.resource, params)
+
           flash[:notice] = 'Item succesfully added to pack.'
           format.html { redirect_to pack_url(@pack) }
           format.js   { render :layout => false }
@@ -534,4 +543,49 @@
       final_errs.add_to_base(msg)
     end
   end
+
+  def annotate_resource_type(resource, type_uri)
+
+    body = RDF::Graph.new
+    body << [RDF::URI(resource.uri), RDF.type, RDF::URI(type_uri)]
+
+    @pack.research_object.create_annotation(:body_graph => body, :resources => [resource.uri], :creator_uri => "/users/#{current_user.id}")
+  end
+
+  def post_process_created_resource(pack, resource, params)
+
+    ro = pack.research_object
+
+    config = Conf.ro_resource_types.select { |x| x["uri"] == params[:type] }.first
+puts "config = #{config.inspect}"
+#   if params[:type] == WORKFLOW_DEFINITION
+#     result = transform_wf(ruri)
+#   end
+
+    if params[:type] != RO_RESOURCE
+      annotate_resource_type(resource, params[:type])
+    end
+
+    # Folder selection is performed on the following with decreasing order of
+    # priority.
+    #
+    # 1. If a folder was specified, and it exists in the RO, then the resource
+    #    will be placed in that folder.
+    #
+    # 2. If there is a folder specified in the RO template for the
+    #    resource type, and it exists in the RO, then use it.
+    #
+    # 3. Place the resource in the root folder.
+
+    folder = ro.find_using_path(params[:folder])
+puts "folder = #{folder.inspect}"
+    folder = ro.find_using_path(config["folder"]) if folder.nil? && config && config["folder"]
+puts "folder = #{folder.inspect}"
+
+    folder = ro.root_folder if folder.nil?
+puts "folder = #{folder.inspect}"
+
+    ro.create_folder_entry(resource.path, folder.path, user_path)
+  end
+
 end

Modified: branches/packs/app/helpers/research_objects_helper.rb (3592 => 3593)


--- branches/packs/app/helpers/research_objects_helper.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/helpers/research_objects_helper.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -3,6 +3,7 @@
 # Copyright (c) 2007-2013 The University of Manchester, the University of
 # Oxford, and the University of Southampton.  See license.txt for details.
 
+require 'securerandom'
 require 'xml/libxml'
 
 module ResearchObjectsHelper

Modified: branches/packs/app/models/pack.rb (3592 => 3593)


--- branches/packs/app/models/pack.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/models/pack.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -32,7 +32,7 @@
 
   belongs_to :license
 
-  belongs_to :research_object
+  belongs_to :research_object, :dependent => :destroy
 
   def find_version(version)
     match = versions.find(:first, :conditions => ["version = ?", version])

Modified: branches/packs/app/models/pack_contributable_entry.rb (3592 => 3593)


--- branches/packs/app/models/pack_contributable_entry.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/models/pack_contributable_entry.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -22,6 +22,8 @@
 
   after_save :synchronize_research_object
 
+  belongs_to :resource, :dependent => :destroy
+
   def check_unique
 
     conditions = ["pack_id = ?", "version = ?", "contributable_type = ?", "contributable_id = ?"]
@@ -97,8 +99,29 @@
   def synchronize_research_object
 
     ro = pack.research_object
+    
+    user_path = "/users/#{user_id}"
 
-    if ro
+    if ro && resource_id.nil?
+
+      case contributable
+      when Workflow
+        data = ""
+        path = contributable.unique_name + (contributable.file_ext ? ".#{contributable.file_ext}" : "") 
+      when Blob
+        data = ""
+        path = contributable.local_name
+      end
+
+      resource = ro.create_aggregated_resource(
+          :user_uri     => user_path,
+          :path         => path,  # FIXME - where should these be URL encoded?
+          :data         ="" data,
+          :content_type => contributable.content_type.mime_type)
+
+      update_attribute(:resource_id, resource.id)
+
+      ro.update_manifest!
     end
   end
 end

Modified: branches/packs/app/models/research_object.rb (3592 => 3593)


--- branches/packs/app/models/research_object.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/models/research_object.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -5,6 +5,7 @@
 
 require 'rdf'
 require 'rdf/raptor'
+require 'yaml'
 
 class ResearchObject < ActiveRecord::Base
 
@@ -323,6 +324,43 @@
     stub
   end
 
+  # opts = :slug, :body_graph, :creator_uri, :resources
+  #
+  def create_annotation(opts = {})
+
+    # FIXME - these should be validations on the resource model
+    throw "body_graph required"   unless opts[:body_graph]
+    throw "resources required"    unless opts[:resources]
+    throw "creator_uri required"  unless opts[:creator_uri]
+    
+    resources = opts[:resources]
+    resources = [resources] unless resources.kind_of?(Array)
+
+    if opts[:body_graph].kind_of?(RDF::Graph)
+      data = "" { |graph| graph << opts[:body_graph] }
+    else
+      data = ""
+    end
+
+    # Create an annotation body using the provided graph
+
+    ao_body = create_aggregated_resource(
+      :path         => calculate_path(opts[:slug], 'application/rdf+xml'),
+      :data         ="" data,
+      :content_type => "application/rdf+xml",
+      :user_uri     => opts[:creator_uri])
+
+    stub = create_annotation_stub(
+      :user_uri       => opts[:creator_uri],
+      :ao_body_path   => ao_body.path,
+      :resource_paths => resources.map { |resource| relative_uri(resource, uri) } )
+
+    stub.update_graph!
+
+    stub
+
+  end
+
   def create_aggregated_resource(opts = {})
 
     throw "user_uri required"     unless opts[:user_uri]
@@ -443,6 +481,103 @@
     object
   end
 
+  def merged_annotation_graphs
+
+    result = RDF::Graph.new
+
+    resources.all(:conditions => { :is_annotation => true }).each do |annotation|
+      ao_body = annotation.ao_body
+      result << load_graph(ao_body.content_blob.data, ao_body.content_type)
+    end
+
+    result
+  end
+
+  def ore_structure_aux(entry, all_entries) #:nodoc:
+
+    if entry.proxy_for.nil?
+      {
+        :name => entry.entry_name,
+        :uri  => entry.proxy_for_path,
+        :type => :remote
+      }
+    elsif entry.proxy_for.is_folder
+
+      sub_entries = all_entries.select { |fe| fe.proxy_in_path == entry.proxy_for_path }
+
+      { 
+        :name => entry.entry_name,
+        :type => :folder,
+        :entries => sub_entries.map { |sub_entry| ore_structure_aux(sub_entry, all_entries) }
+      }
+    else
+      {
+        :name => entry.entry_name,
+        :type => :file
+      }
+    end
+  end
+
+  def ore_structure
+
+    return [] if root_folder.nil?
+
+    all_entries = resources.find(:all, :conditions => { :is_folder_entry => true } )
+
+    all_entries.select { |entry| entry.proxy_in_path == root_folder.path }.map do |entry|
+      ore_structure_aux(entry, all_entries)
+    end
+  end
+
+  def ore_directories_aux(prefix, structure)
+    results = []
+
+    structure.each do |entry|
+      if entry[:type] == :folder
+        results << "#{prefix}#{entry[:name]}"
+        results += ore_directories_aux("#{prefix}#{entry[:name]}/", entry[:entries])
+      end
+    end
+
+    results
+  end
+
+  def ore_directories
+    ore_directories_aux('', ore_structure).sort
+  end
+
+  def find_template_from_graph(graph, templates)
+
+    templates.each do |name, template|
+      parameters = match_ro_template(graph, template)
+      return [template, parameters] if parameters
+    end
+
+    nil
+  end
+
+  def create_graph_using_ro_template(parameters, template)
+
+    graph = RDF::Graph.new
+
+    # Create the B-nodes.
+
+    if template["bnodes"]
+      template["bnodes"].each do |bnode|
+        parameters[bnode] = RDF::Node.new(bnode)
+      end
+    end
+
+    template["required_statements"].each do |statement|
+
+      graph << [prepare_ro_template_value(statement[0], parameters),
+                prepare_ro_template_value(statement[1], parameters),
+                prepare_ro_template_value(statement[2], parameters)]
+    end
+
+    graph
+  end
+
 private
 
   def create_manifest #:nodoc:
@@ -452,4 +587,79 @@
 
     update_manifest!
   end
+
+  def match_ro_template(graph, template)
+
+    parameters = {}
+
+    # Work on a copy of the graph
+
+    graph_copy = RDF::Graph.new
+
+    graph.each do |statement|
+      graph_copy << statement
+    end
+
+    template["required_statements"].each do |statement|
+
+      # Find a statement that matches the current statement in the template.
+
+      target = [prepare_ro_template_value(statement[0], parameters),
+                prepare_ro_template_value(statement[1], parameters),
+                prepare_ro_template_value(statement[2], parameters)]
+
+      match = graph_copy.query(target).first
+
+
+      return nil if match.nil?
+
+      # Verify that there are no mismatches between existing parameters and found
+      # parameters;  Then fill in newly defined parameters.
+
+      return nil unless process_ro_template_parameter(statement[0], match[0], parameters)
+      return nil unless process_ro_template_parameter(statement[1], match[1], parameters)
+      return nil unless process_ro_template_parameter(statement[2], match[2], parameters)
+
+      # Remove the current statement from the graph copy
+
+      graph_copy.delete(match)
+    end
+
+    # Verify that all statements were consumed in processing the template.
+
+    return nil unless graph_copy.empty?
+
+    parameters
+  end
+
+  def process_ro_template_parameter(name, value, parameters)
+
+    # Terms in the template can be one of three things:
+    #
+    #   1. A parameter, denoted by a symbol
+    #   2. A URI, denoted by a string enclosed by angle brackets
+    #   3. A literal, denoted by a string enclosed with double quote marks
+
+    return true unless name.class == Symbol
+
+    if parameters[name].nil?
+      parameters[name] = value
+      true
+    else
+      value == parameters[name]
+    end
+  end
+
+  def prepare_ro_template_value(value, parameters)
+    if value.class == Symbol
+      parameters[value]
+    elsif (value[0..0] == '<') && (value[-1..-1] == '>')
+      RDF::URI.parse(value[1..-2])
+    elsif (value[0..0] == '"') && (value[-1..-1] == '"')
+      RDF::Literal.new(value[1..-2])
+    else
+      raise "Unknown template value: #{value}"
+    end
+  end
+
 end

Modified: branches/packs/app/models/resource.rb (3592 => 3593)


--- branches/packs/app/models/resource.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/models/resource.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -16,8 +16,10 @@
   belongs_to :content_blob, :dependent => :destroy
 
   belongs_to :proxy_for,          :primary_key => :path, :foreign_key => :proxy_for_path,     :class_name => 'Resource'
-  has_one    :proxy,              :primary_key => :path, :foreign_key => :proxy_for_path,     :class_name => 'Resource'
+  has_one    :proxy,              :primary_key => :path, :foreign_key => :proxy_for_path,     :class_name => 'Resource', :conditions => 'is_proxy = 1', :dependent => :destroy
 
+  has_one    :folder_entry,       :primary_key => :path, :foreign_key => :proxy_for_path,     :class_name => 'Resource', :conditions => 'is_folder_entry = 1', :dependent => :destroy
+
   belongs_to :proxy_in,           :primary_key => :path, :foreign_key => :proxy_in_path,      :class_name => 'Resource'
   has_many   :proxies,            :primary_key => :path, :foreign_key => :proxy_in_path,      :class_name => 'Resource'
 
@@ -36,6 +38,8 @@
   validates_presence_of :content_type
   validates_presence_of :path
 
+  after_destroy :update_manifest!
+
   def is_manifest?
     path == ResearchObject::MANIFEST_PATH
   end
@@ -149,21 +153,34 @@
     update_attribute(:content_blob, ContentBlob.new(:data ="" new_description))
   end
 
+  def annotations
+    research_object.annotation_resources.find(:all,
+        :conditions => { :resource_path => path }).map { |ar| ar.annotation }
+  end
+
   def merged_annotation_graphs
 
     result = RDF::Graph.new
 
-    annotation_resources = research_object.annotation_resources.find(:all,
-        :conditions => { :resource_path => path })
-    
-    annotation_resources.each do |ar|
-      ao_body = ar.annotation.ao_body
+    annotations.each do |annotation|
+      ao_body = annotation.ao_body
       result << load_graph(ao_body.content_blob.data, ao_body.content_type)
     end
 
     result
   end
 
+  def annotations_with_templates
+    annotations.map do |annotation|
+      template, parameters = research_object.find_template_from_graph(load_graph(annotation.ao_body.content_blob.data, annotation.ao_body.content_type), Conf.ro_templates)
+      {
+        :annotation => annotation,
+        :template => template,
+        :paramters => parameters
+      }
+    end
+  end
+
   def copy_metadata
     if content_blob
       self.sha1 = content_blob.calc_sha1
@@ -173,4 +190,8 @@
       self.size = nil
     end
   end
+
+  def update_manifest!
+    research_object.update_manifest!
+  end
 end

Modified: branches/packs/app/models/user.rb (3592 => 3593)


--- branches/packs/app/models/user.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/models/user.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -657,6 +657,10 @@
     all_networks.map {|n| n.policies}.flatten
   end
 
+  def uri
+    "#{Conf.base_uri}/users/#{id}"
+  end
+
 protected
 
   # clean up emails and username before validation

Modified: branches/packs/app/views/packs/_add_item.rhtml (3592 => 3593)


--- branches/packs/app/views/packs/_add_item.rhtml	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/views/packs/_add_item.rhtml	2013-07-12 13:35:48 UTC (rev 3593)
@@ -16,7 +16,11 @@
 						<p class="inner">(a link)</p>
 					</td>
 					<td style="padding-bottom: 0;">
-						<%= text_field_tag "uri", params[:uri], :size => 47 -%>
+						<%= text_field_tag "uri", params[:uri], :style => "width: 280px;",
+            :placeholder => 'http://www.example.com/resource' -%>
+              <%= select_tag(:type, options_for_select(Conf.ro_resource_types.map { |x| [x["label"], x["uri"]] },
+                    "http://purl.org/wf4ever/ro#Resource") )  -%>
+              Folder: <%= select_tag(:folder, options_for_select(['(automatic)'] + @pack.research_object.ore_directories)) -%>
 					</td>
 					<td class="submit" style="padding-bottom: 0;">
 						<%= submit_tag "Add", :disable_with => "..." -%>
@@ -25,7 +29,7 @@
 				<tr>
 					<td style="padding-top: 0;">
 						<p style="text-align: center; color: #333333; font-size: 77%; padding: 0;">
-							eg: "http://www.myexperiment.org/workflows/1" or "http://www.example.com/something-nice"
+							eg: "http://www.myexperiment.org/workflows/1" or "http://www.example.com/resource"
 						</p>
 					</td>
 					<td style="padding-top: 0;">&nbsp;</td>
@@ -46,7 +50,7 @@
 							<p class="inner">(from your stuff)</p>
 						</td>
 						<td>
-							<select id="uri2" name="uri" style="width: 320px;">
+							<select id="uri2" name="uri" style="width: 280px;">
 					  		<% contributions.each do |c| -%>
 									<% if ["workflow", "blob", "pack"].include? c.contributable_type.downcase -%>
 						    	  <% show = (c.contributable.class.to_s == 'Pack' ? (@pack.id != c.contributable.id) : true) -%> <!-- prevents from displaying current pack in the list of things that are enabled to be added to the current pack -->
@@ -58,6 +62,9 @@
 									<% end -%>
 					  		<% end -%>
 							</select>
+              <%= select_tag(:type, options_for_select(Conf.ro_resource_types.map { |x| [x["label"], x["uri"]] },
+                    "http://purl.org/wf4ever/ro#Resource") )  -%>
+              Folder: <%= select_tag(:folder, options_for_select(['(automatic)'] + @pack.research_object.ore_directories)) -%>
 						</td>
 						<td class="submit">
 							<%= submit_tag "Add", :disable_with => "..." -%>

Modified: branches/packs/app/views/packs/show.rhtml (3592 => 3593)


--- branches/packs/app/views/packs/show.rhtml	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/app/views/packs/show.rhtml	2013-07-12 13:35:48 UTC (rev 3593)
@@ -47,19 +47,10 @@
 
     <%= render(:partial => "packs/version_selector", :locals => { :resource => @pack, :version => @version, :path => :pack_version_path }) %>
 
-		<div class="contribution_version_inner_box">
-			<p>
-		    <b>Title:</b>
-		    <span class="title"><%=h @pack.title %></span>
-			</p>
+	</div>
 			
-			<br/>
+			<h2>Description</h2>
 			
-			<h3>
-				<%= info_icon_with_tooltip("This section shows the overall description of this Pack") %>
-				Description
-			</h3>
-			
 			<% unless @pack.description.blank? %>
 				<div class="contribution_description">
 					<%= @pack.description_html %>
@@ -73,10 +64,31 @@
 					Not set
 				</p>
 			<% end %>
-			
-		</div>
-	</div>
-	
+
+  <% @sketch = @graph.query(:predicate => RDF.type,
+                            :object    => RDF::URI("http://purl.org/wf4ever/roterms#Sketch")).first_subject %>
+
+  <% @hypothesis = @graph.query(:predicate => RDF.type,
+                                :object    => RDF::URI("http://purl.org/wf4ever/roterms#Hypothesis")).first_subject %>
+
+  <% @conclusions = @graph.query(:predicate => RDF.type,
+                                 :object    => RDF::URI("http://purl.org/wf4ever/roterms#Conclusions")).first_subject %>
+
+  <% if @sketch %>
+    <h2>Research overview</h2>
+    <%= image_tag(@sketch.to_s, :width => '100%') -%>
+  <% end %>
+
+  <% if @hypothesis %>
+    <h2>Hypothesis</h2>
+    <p><%= link_to(h(@hypothesis.to_s), @hypothesis.to_s) -%></p>
+  <% end %>
+
+  <% if @conclusions %>
+    <h2>Conclusions</h2>
+    <p><%= link_to(h(@conclusions.to_s), @conclusions.to_s) -%></p>
+  <% end %>
+
 	<div class="contribution_version_box" style="background-color: #EEEEEE;">
 		<div class="contribution_version_inner_box">
 			<h4>
@@ -136,6 +148,58 @@
 		</div>
 	</div>
 
+  <h1>Debug</h1>
+
+  <div id="tabsContainer" class="tabsContainer"></div>
+    
+    <div class="tabContainer">
+      <div class="tabTitle">Structure</div>
+      <div class="tabContent">
+        <pre><%=h @pack.research_object.ore_structure.to_yaml -%></pre>
+      </div>
+    </div>
+    
+    <div class="tabContainer">
+      <div class="tabTitle">Resources</div>
+      <div class="tabContent">
+        <table class="simple">
+          <tr>
+            <th>Path</th>
+            <th>Size</th>
+            <th>Annotations</th>
+          </tr>
+          <% @pack.research_object.resources.each do |resource| %>
+            <tr>
+              <td><%=h resource.path -%></td>
+              <td><%=h resource.size -%></td>
+              <td><%=h resource.annotations.count -%></td>
+            </tr>
+          <% end %>
+        </table>
+      </div>
+    </div>
+
+    <div class="tabContainer">
+      <div class="tabTitle">Statements</div>
+      <div class="tabContent">
+
+        <div>Number of statements in merged annotation graph: <%= @graph.count -%></div>
+
+        <% @graph.each do |statement| %>
+          <div style="margin: 8px; box-shadow: 4px 4px 8px #ddd;">
+            <table class="simple" style="width: 100%">
+              <tr><td><%=h statement.subject -%></td></tr>
+              <tr><td><%=h statement.predicate -%></td></tr>
+              <tr><td><%=h statement.object -%></td></tr>
+            </table>
+          </div>
+        <% end %>
+
+      </div>
+    </div>
+
+  </div>
+
 </div>
 
 <div class="contribution_right_box">

Modified: branches/packs/config/default_settings.yml (3592 => 3593)


--- branches/packs/config/default_settings.yml	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/config/default_settings.yml	2013-07-12 13:35:48 UTC (rev 3593)
@@ -700,3 +700,786 @@
 - root/workflows/main
 - root/workflows/nested
 
+relationships:
+
+- title:       inputDataTo
+  phrase:      is an input to
+  description: This concept is used to indicate that the subject is an input to the object.
+
+- title:       outputDataFrom
+  phrase:      is an output from
+  description: This concept is used to indicate that the subject is an output from the object.
+
+- title:       exampleInputDataTo
+  phrase:      is an example input to
+  description: This concept is used to indicate that the subject is an example input to the object.
+
+- title:       exampleOutputDataFrom
+  phrase:      is an example output from
+  description: This concept is used to indicate that the subject is an example output from the object.
+
+- title:       presentAt
+  phrase:      was presented at
+  description: This concept is used to indicate that the subject was presented at the object.
+
+roles:
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/article-guarantor
+  label: article guarantor
+  description:
+
+    "The role of a person who takes responsibility for the integrity of the
+    work as a whole, from the inception of the research investigation to the
+    published research article."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/consortium-author
+  label: consortium author
+  description:
+
+    "The authorship role of an organisation or consortium that has contributed
+    collectively to the work described in the publication and is named in the
+    list of authors, e.g. 'Wellcome Trust Case Control Consortium' or 'Malaria
+    Genomic Epidemiology Network'. (The members of such a group should be
+    separately listed elsewhere in the document)."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/corresponding-author
+  label: corresponding author
+  description:
+
+    "The role an author has of being the corresponding author of the document,
+    with whom editors and readers should correspond concerning it."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/illustrator
+  label: illustrator
+  description:
+
+    "The role a person has of being an illustrator of, or for, some entity."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/photographer
+  label: photographer
+  description:
+
+    "The role a person has of being a photographer of, or for, some entity."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/principal-author
+  label: principal author
+  description:
+
+    "The role an author has of being the principal or primary author of the
+    document, who has contributed most to the work described."
+
+- category: authorship
+  iri: http://purl.org/spar/scoro/senior-author
+  label: senior author
+  description:
+
+    "The role an author has of being the senior author of the document."
+
+- category: data
+  iri: http://purl.org/spar/scoro/access-provider
+  label: access provider
+  description:
+
+    "The role of an agent who provides access to a resource, for example an
+    online data repository."
+
+- category: data
+  iri: http://purl.org/spar/scoro/curator
+  label: curator
+  description:
+
+    "The role of an agent that documents, cares for and manages collections of
+    objects (for example in a museum) or of data (as in a data repository or
+    database)."
+
+- category: data
+  iri: http://purl.org/spar/scoro/data-creator
+  label: data creator
+  description:
+
+    "The role a person has of being a creator or originator of new data."
+
+- category: data
+  iri: http://purl.org/spar/scoro/data-curator
+  label: data curator
+  description:
+
+    "The role a person has of being a data curator, responsible for long-term
+    preservation of data, for example those arising from the research project."
+
+- category: data
+  iri: http://purl.org/spar/scoro/data-manager
+  label: data manager
+  description:
+
+    "The role a person has of being a data manager, responsible for day-to-day
+    management and back-up of data, for example those arising from the research
+    project."
+
+- category: data
+  iri: http://purl.org/spar/scoro/data-publisher
+  label: data publisher
+  description:
+
+    "The role of an agent who publishes data."
+
+- category: data
+  iri: http://purl.org/spar/scoro/data-user
+  label: data user
+  description:
+
+    "The role a person has of being a user or re-user of existing data."
+
+- category: data
+  iri: http://purl.org/spar/scoro/embargo-controller
+  label: embargo controller
+  description:
+
+    "The role of the person who has responsibility for setting and lifting
+    embargos that restrict access to a dataset (or a document) for a specified
+    period of time."
+
+- category: data
+  iri: http://purl.org/spar/scoro/repository-manager
+  label: repository manager
+  description:
+
+    "The role a person has of being a manager of a repository where entities
+    are given secure long-term storage, typically digital repository for
+    information objects, for example a data repository."
+
+- category: data
+  iri: http://purl.org/spar/scoro/web-master
+  label: web-master
+  description:
+
+    "The role of a person responsible for maintaining a web site and its
+    content."
+
+- category: educational
+  iri: http://purl.org/spar/scoro/faculty-member
+  label: faculty member
+  description:
+
+    "The role of an academic employed to undertake research and teaching within
+    a university department, school or institute."
+
+- category: educational
+  iri: http://purl.org/spar/scoro/postgraduate-student
+  label: postgraduate student
+  description:
+
+    "The role of a person registerd for a graduate (masters or doctoral) degree
+    at a university."
+
+- category: educational
+  iri: http://purl.org/spar/scoro/supervisor
+  label: supervisor
+  description:
+
+    "The role of a person who supervises the research activities of a student
+    during that student's research project undertaken as part of a degree
+    course at a university."
+
+- category: educational
+  iri: http://purl.org/spar/scoro/undergraduate-student
+  label: undergraduate student
+  description:
+
+    "The role of a person registerd for an undergraduate degree at a
+    university."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/accountant
+  label: accountant
+  description:
+
+    "The role held by a person whose job is to manage financial accounts, for
+    example the accounts of an organization, or of a particular funded project
+    or activity of that organization."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/auditor
+  label: auditor
+  description:
+  
+    "The role held by a person who conducts a formal audit of financial
+    accounts."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/claimant
+  label: claimant
+  description:
+
+    "The role held by a person making a financial claim, for example for refund
+    of travel expenses from a project grant."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/contractor
+  label: contractor
+  description:
+
+    "The role held by an agent who enters into a contract to undertake
+    specified work or to supply specified services in return for payment."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/financial-controller
+  label: financial controller
+  description:
+
+    "The role held by an agent of controlling the finances, for example the
+    finances of an organization, a building project or a research project. This
+    role extends to the control of or the authorisation of expenditure from a
+    budget, and may be undertaken by a computational agent."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/funder 
+  label: funder
+  description:
+
+    "The role held by an agent of providing funds, for example for a research
+    project."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/funding-recipient
+  label: funding recipient
+  description:
+
+    "The role held by an agent who is the official recipient of funding, for
+    example the university of which a funded research project leader is a
+    member."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/owner
+  label: owner
+  description:
+
+    "The role held by an agent who is the owner of something with actual or
+    potential financial value, for example a building, a piece of equipment,
+    the copyright of a document, or the intellectual property rights relating
+    to an idea or discovery."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/purchaser
+  label: purchaser
+  description:
+
+    "The role held by an agent of making purchases of goods or services, the
+    cost of which is typically charged to a particular academic budget, for
+    example a project manager placing an order to purchase equipment funded
+    from a research grant."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/sponsor
+  label: sponsor
+  description:
+
+    "The role held by an agent that provides funds or support for something
+    such as a project or activity, often in return for access to the
+    exploitable commercial potential associated with that project or activity,
+    for example through advertising."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/sub-contractor
+  label: sub-contractor
+  description:
+
+    "The role held by an agent who enters into a contract to take over part of
+    another contractor's obligation to undertake specified work or supply
+    specified services in return for payment."
+
+- category: financial
+  iri: http://purl.org/spar/scoro/supplier
+  label: supplier
+  description:
+
+    "The role held by an agent of providing goods or services in exchange for
+    payment."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/chief-scientist
+  label: chief scientist
+  description:
+
+    "A senior scientist who takes a leadership role in an organization or
+    group."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/co-investigator
+  label: co-investigator
+  description:
+
+    "The role a person has of being a co-investigator for a research
+    investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/collaborator
+  label: collaborator
+  description:
+
+    "The role a person, typically from another research group or institution,
+    who collaborates with the team undertaking a research investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/computer-programmer
+  label: computer programmer
+  description:
+
+    "The role a person has of being someone who develops computer software."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/consultant
+  label: consultant
+  description:
+
+    "The role a person has of being a consultant who is providing expertise or
+    services."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/inventor
+  label: inventor
+  description:
+
+    "The role a person has of being the inventor or some entity (for example a
+    computer algorithm, or an experimental procedure)."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/postdoctoral-researcher
+  label: postdoctoral researcher
+  description:
+
+    "The role a person has of being a post-doctoral researcher involved in a
+    research investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/principal-investigator
+  label: principal investigator
+  description:
+
+    "The role a person has of being the principal investigator for a research
+    investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/project-student
+  label: project student
+  description:
+
+    "The role a person has of being a project student, namely someone engaged
+    in an undergraduate research project as part of studying for an
+    undergraduate degree at a university, whose research will be presented in
+    an undergraduate research project report in part fulfilment of the
+    requirements of that degree."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/research-assistant
+  label: research assistant
+  description:
+
+    "The role a person has of being a research assistant involved in a research
+    investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/research-student
+  label: research student
+  description:
+
+    "The role a person has of being a research student, namely someone engaged
+    in research as part of studying for a higher degree at a university or
+    research institute, whose research will be presented in a thesis in part
+    fulfilment of the requirements of that degree."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/researcher
+  label: researcher
+  description:
+
+    "The role a person has of being a researcher involved in a research
+    investigation."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/scholar
+  label: scholar
+  description:
+
+    "The role of an academic who undertakes scholarly activities, including
+    research investigations. This role is particularly used to describe
+    endeavours in the arts and humanites that are frequently undertaken without
+    financial support from a particular funded project dedicated to these
+    scholarly activities."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/service-engineer
+  label: service engineer
+  description:
+
+    "The role held by a person who services, maintains and repairs equipment,
+    facilities or technical infrastructure."
+
+- category: investigation
+  iri: http://purl.org/spar/scoro/technician
+  label: technician
+  description:
+
+    "The role a person has of being a technician, providing technical
+    assistance in some endeavour such as a research investigation."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/chief-executive-officer
+  label: CEO
+  description:
+
+    "The role held by a person who is the chief executive officer of an
+    organization, responsible for directing and managing the business of that
+    organization."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/chief-technology-officer
+  label: CTO
+  description:
+
+    "The role held by a person who is the chief technology officer of an
+    organization, responsible for directing and managing technical developments
+    for that organization."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/administrator
+  label: administrator
+  description:
+
+    "The role held by an agent responsible for the day-to-day management and
+    running of an organization or activity."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/affiliate
+  label: affiliate
+  description:
+
+    "The role an agent has of being affiliated to some organization or
+    institution in a context of some entity or activity, for example a
+    document, a project or an internship."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/agent
+  label: agent
+  description:
+
+    "An agent that acts on behalf of another agent."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/college-fellow
+  label: college fellow
+  description:
+
+    "The role held by an academic as a senior member of a college."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/college-head
+  label: college head
+  description:
+
+    "The role held by a senior academic who heads a college and acts as its
+    CEO. Among the many alternative titles give to this role, the most common
+    are President or Master of the college."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/contact-person
+  label: contact person
+  description:
+
+    "The role of a person who serves as the primary contact and information
+    provider for third parties wishing to find out more about an organization
+    or an activity."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/departmental-administrator
+  label: departmental administrator
+  description:
+
+    "The role held by a person who is the administrator of a department within
+    a larger organization, for example of a university academic department."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/director
+  label: director
+  description:
+
+    "The role held by a person who is in charge of an organization or activity,
+    for example a research institute or a dramatic performance."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/employee
+  label: employee
+  description:
+
+    "The role held by a person employed for wages or a salary by an
+    organization, to undertake work for that organization."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/employer
+  label: employer
+  description:
+
+    "The role held by an agent that employs one or more people to undertake
+    work on that agent's behalf."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/head-of-department
+  label: head of department
+  description:
+
+    "The role held by a person who is the chief executive officer of a
+    department within a larger organization, for example a senior academic who
+    is head of a university academic department."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/manager
+  label: manager
+  description:
+
+    "The role held by a person responsible for managing the day-to-day
+    activities of an activity, enterprise or organization."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/member
+  label: member
+  description:
+
+    "The role held by an agent of belonging to a group or organization."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/non-academic-staff-member
+  label: non-academic staff member
+  description:
+
+    "The role of a person employed within a university department, school or
+    institute who is not a member of the academic faculty."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/organizer
+  label: organizer
+  description:
+
+    "The role held by an agent who organizes something, such as a conference, a
+    private meeting or a public event."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/participant
+  label: participant
+  description:
+
+    "The role held by an agent who takes part in something, for example a
+    conference, a private meeting or a public event."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/partner
+  label: partner
+  description:
+
+    "The role held by a person who is a partner with one or more other people
+    in an organization, project, endeavour, activity or sphere of common
+    interest."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/patent-holder
+  label: patent holder
+  description:
+
+    "The role held by an agent who holds a patent."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/possessor
+  label: possessor
+  description:
+
+    "The role held by an agent as possessor or owner of some entity such as an
+    address or a telephone number."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/programme-manager
+  label: programme manager
+  description:
+
+    "The role held by a person who is in charge of a programme of related
+    activities or projects, for example on behalf of a funding agency."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/registrar
+  label: registrar
+  description:
+
+    "The role held by an agent responsible for maintaining official records,
+    for example the records of student enrollment and academic standing held by
+    a college or university, or the records of securities owned by a financial
+    institution."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/rights-holder
+  label: rights holder
+  description:
+
+    "The role held by an agent who holds the legal rights to a project or
+    activity and its products and outcomes, for example the exploitation,
+    licensing and intellectual property rights."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/spokesperson
+  label: spokesperson
+  description:
+
+    "The role held by a person who makes statements on behalf of another
+    individual, a group, a project or an institution."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/stakeholder
+  label: stakeholder
+  description:
+
+    "The role held by an agent with an interest or concern in something, for
+    example the creation of a new university."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/successor
+  label: successor
+  description:
+
+    "The relationship held by an entity that succeeds another, for example a
+    new electron microscope that replaces an out-dated one, a research project
+    that follows on from a preceding project, or a faculty member who succeeds
+    a colleague as head of department."
+
+- category: organizational
+  iri: http://purl.org/spar/scoro/vice-chancellor
+  label: vice-chancellor
+  description:
+
+    "The role held by the chief executive officer of a university, responsible
+    for directing and managing its business and academic activities."
+
+- category: project
+  iri: http://purl.org/spar/scoro/co-applicant
+  label: co-applicant
+  description:
+
+    "The role a person has of being a co-applicant on the grant application to
+    obtain funding to fund an endeavour such as a research project."
+
+- category: project
+  iri: http://purl.org/spar/scoro/lead-applicant
+  label: lead applicant
+  description:
+
+    "The role a person has of being the lead applicant on the grant application
+    to obtain funding to fund an endeavour such as a research project."
+
+- category: project
+  iri: http://purl.org/spar/scoro/project-leader
+  label: project leader
+  description:
+
+    "The role a person or an institution has of being project leader for a
+    project such as a research project."
+
+- category: project
+  iri: http://purl.org/spar/scoro/project-manager
+  label: project manager
+  description:
+
+    "The role a person has of being project manager for a project such as a
+    research project."
+
+- category: project
+  iri: http://purl.org/spar/scoro/project-member
+  label: project member
+  description:
+
+    "The role a person has of being a member of a project such as a research
+    project."
+
+- category: project
+  iri: http://purl.org/spar/scoro/workpackage-leader
+  label: workpackage leader
+  description:
+
+    "The role a person or institution has of being leader for a workpackage
+    within a project such as a research project."
+
+## ro_resource_types - types for adding resources (_add_item_ro.rhtml)
+# 
+# List of tuples:
+#
+# 
+#   - label:  "The Label"  
+#     uri:    "http://example.com/vocab#predicate"
+#
+#   - label:  "The Label"  
+#     uri:    "http://example.com/vocab#predicate"
+#     folder: "workflows"
+
+ro_resource_types:
+
+  - label:  "Workflow"
+    uri:    "http://purl.org/wf4ever/wfdesc#WorkflowDefinition"
+    folder: "workflows"
+
+  - label:  "Resource"
+    uri:    "http://purl.org/wf4ever/ro#Resource"
+
+  - label:  "Sketch"
+    uri:    "http://purl.org/wf4ever/roterms#Sketch"
+
+  - label:  "Hypothesis"
+    uri:    "http://purl.org/wf4ever/roterms#Hypothesis"    
+
+  - label:  "Conclusions"
+    uri:    "http://purl.org/wf4ever/roterms#Conclusions"
+
+  - label:  "Results"
+    uri:    "http://purl.org/wf4ever/roterms#Results"
+
+  - label:  "Example inputs"
+    uri:    "http://purl.org/wf4ever/roterms#ExampleInputs"
+    folder: "datasets/inputs"
+
+  - label:  "Example outputs"
+    uri:    "http://purl.org/wf4ever/roterms#ExampleOutputs"
+
+  - label:  "Workflow run"
+    uri:    "http://purl.org/wf4ever/roterms#WorkflowRunBundle"
+    folder: "datasets/results"
+
+ro_templates:
+
+  creator:
+
+    label: Creator
+
+    bnodes: [:b1]
+
+    required_statements:
+    - [:resource, "<http://purl.org/dc/terms/creator>", :b1]
+    - [:b1,       "<http://xmlns.com/foaf/0.1/Agent>",  :person]
+    - [:b1,       "<http://purl.org/dc/terms/date>",    :date]
+    - [:b1,       "<http://xmlns.com/foaf/0.1/name>",   :name]
+
+  creator_simple:
+
+    label: Creator (simple)
+
+    required_statements:
+    - [:resource, "<http://purl.org/dc/terms/creator>", :agent]
+
+  input_selection_relationship:
+
+    label: Input selection relationship
+
+    required_statements:
+    - [:resource1, "<http://purl.org/wf4ever/roterms#inputSelected>", :resource2]
+
+empty:
+

Modified: branches/packs/db/migrate/20130520145900_create_research_objects.rb (3592 => 3593)


--- branches/packs/db/migrate/20130520145900_create_research_objects.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/db/migrate/20130520145900_create_research_objects.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -50,8 +50,8 @@
 
     add_column :packs, :ro_uri, :text
     add_column :packs, :research_object_id, :text
-    add_column :pack_contributable_entries, :resource_path, :text
-    add_column :pack_remote_entries, :resource_path, :text
+    add_column :pack_contributable_entries, :resource_id, :integer
+    add_column :pack_remote_entries, :resource_id, :integer
   end
 
   def self.down
@@ -61,8 +61,8 @@
 
     remove_column :packs, :ro_uri
     remove_column :packs, :research_object_id
-    remove_column :pack_contributable_entries, :resource_path
-    remove_column :pack_remote_entries, :resource_path
+    remove_column :pack_contributable_entries, :resource_id
+    remove_column :pack_remote_entries, :resource_id
   end
 
 end

Modified: branches/packs/db/schema.rb (3592 => 3593)


--- branches/packs/db/schema.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/db/schema.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -66,11 +66,6 @@
     t.datetime "updated_at"
   end
 
-  create_table "auto_tables", :force => true do |t|
-    t.string "name"
-    t.text   "schema"
-  end
-
   create_table "blob_versions", :force => true do |t|
     t.integer  "blob_id"
     t.integer  "version"
@@ -457,7 +452,7 @@
     t.datetime "created_at"
     t.datetime "updated_at"
     t.integer  "version"
-    t.text     "resource_path"
+    t.integer  "resource_id"
   end
 
   create_table "pack_remote_entries", :force => true do |t|
@@ -470,7 +465,7 @@
     t.datetime "created_at"
     t.datetime "updated_at"
     t.integer  "version"
-    t.text     "resource_path"
+    t.integer  "resource_id"
   end
 
   create_table "pack_versions", :force => true do |t|
@@ -532,11 +527,6 @@
     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.integer  "contributor_id"
     t.string   "contributor_type"
@@ -914,6 +904,8 @@
     t.text     "body_html"
     t.datetime "created_at"
     t.datetime "updated_at"
+    t.string   "license"
+    t.integer  "preview_id"
     t.string   "image"
     t.string   "svg"
     t.text     "revision_comments"
@@ -921,8 +913,6 @@
     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"
@@ -936,15 +926,15 @@
     t.string   "unique_name"
     t.text     "body"
     t.text     "body_html"
+    t.integer  "current_version"
+    t.integer  "preview_id"
     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
 
   create_table "wsdl_deprecations", :force => true do |t|

Modified: branches/packs/lib/conf.rb (3592 => 3593)


--- branches/packs/lib/conf.rb	2013-07-09 08:05:22 UTC (rev 3592)
+++ branches/packs/lib/conf.rb	2013-07-12 13:35:48 UTC (rev 3593)
@@ -214,6 +214,14 @@
     self.fetch_entry('research_object_default_folders')
   end
 
+  def self.method_missing(method)
+    if @defaults.has_key?(method.to_s)
+      fetch_entry(method.to_s)
+    else
+      super
+    end
+  end
+
   # This method is required to create an administrator in the test fixtures
 
   def self.admins=(value)

reply via email to

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