myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3670] branches/packs: added role annotation and


From: noreply
Subject: [myexperiment-hackers] [3670] branches/packs: added role annotation and fixed creator uri bug
Date: Thu, 5 Sep 2013 00:29:34 +0000 (UTC)

Revision
3670
Author
dgc
Date
2013-09-05 00:29:34 +0000 (Thu, 05 Sep 2013)

Log Message

added role annotation and fixed creator uri bug

Modified Paths

Diff

Modified: branches/packs/app/controllers/packs_controller.rb (3669 => 3670)


--- branches/packs/app/controllers/packs_controller.rb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/controllers/packs_controller.rb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -503,6 +503,7 @@
       @input_files_for_this_workflow = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#inputSelected"), nil]).objects
       @requires_hardware = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#requiresHardware"), nil]).objects
       @requires_software = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#requiresSoftware"), nil]).objects
+      @roles_in_time = @statements.query([nil, RDF::URI("http://purl.org/spar/pro/relatesToEntity"), @item.uri]).subjects
     end
 
     unless @item
@@ -720,7 +721,7 @@
 
     folder = ro.root_folder if folder.nil?
 
-    ro.create_folder_entry(relative_uri(resource_uri, @pack.research_object.uri), folder.path, user_path)
+    ro.create_folder_entry(relative_uri(resource_uri, @pack.research_object.uri), folder.path, user_path(current_user))
   end
 
 end

Modified: branches/packs/app/models/pack.rb (3669 => 3670)


--- branches/packs/app/models/pack.rb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/models/pack.rb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -718,6 +718,10 @@
     research_object.resources.find_by_path(relative_uri(path, research_object.uri))
   end
 
+  def find_resource_by_ore_path(path)
+    research_object.find_using_path(relative_uri(path, research_object.uri))
+  end
+
   protected
   
   # produces html string containing the required messaged, enclosed within left-padded P tag, belonging to 'none_text' class

Modified: branches/packs/app/models/resource.rb (3669 => 3670)


--- branches/packs/app/models/resource.rb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/models/resource.rb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -161,7 +161,7 @@
     name = path.split("/").last if path
 
     graph << [uri, RDF::DC.created, created_at.to_datetime] if created_at
-    graph << [uri, RDF::DC.creator, RDF::URI(creator_uri)]  if creator_uri
+    graph << [uri, RDF::DC.creator, RDF::URI(Conf.base_uri).join(creator_uri)] if creator_uri
     graph << [uri, RO["name"],      name]                   if name
 
     if content_blob && !is_manifest?

Modified: branches/packs/app/views/annotations/_form.html.erb (3669 => 3670)


--- branches/packs/app/views/annotations/_form.html.erb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/views/annotations/_form.html.erb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -17,13 +17,17 @@
       <td><%= parameter["label"] -%></td>
       <% if values[parameter["symbol"]] %>
         <td>
-          <%=h values[parameter["symbol"]] -%>
+          <% if parameter["type"] == "resource" %>
+            <%= resource_link(@pack.find_resource_by_ore_path(values[parameter["symbol"]])) -%>
+          <% else %>
+            <%=h values[parameter["symbol"]] -%>
+          <% end %>
           <%= hidden_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%>
         </td>
       <% else %>
         <td>
           <% case parameter["type"] ; when "string" %>
-            <%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%>
+            <%= text_field_tag(parameter["symbol"], values[parameter["symbol"]], :placeholder => parameter["placeholder"]) -%>
           <% when "select" %>
             <%= select_tag(parameter["symbol"], options_for_select(parameter["options"])) -%>
           <% when "textarea" %>
@@ -43,7 +47,12 @@
     <% end %>
   <% if required_parameters %>
   <tr>
-    <td colspan="3"><div class="required-parameter">* Required</div></td>
+    <td>
+      <% if defined?(add_button) && add_button == true %>
+        <%= submit_tag("Add") -%>
+      <% end %>
+    </td>
+    <td colspan="2"><div class="required-parameter">* Required</div></td>
   </tr>
   <% end %>
 </table>

Modified: branches/packs/app/views/annotations/new.html.erb (3669 => 3670)


--- branches/packs/app/views/annotations/new.html.erb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/views/annotations/new.html.erb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -5,8 +5,8 @@
       :research_object => @pack.research_object,
       :template => params[:template],
       :annotation_template => @annotation_template,
-      :values => params } ) -%>
-  <%= submit_tag("Add") -%>
+      :values => params,
+      :add_button => true } ) -%>
 <% end %>
 
 <h2>Debug</h2>

Modified: branches/packs/app/views/packs/_annotation.html.erb (3669 => 3670)


--- branches/packs/app/views/packs/_annotation.html.erb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/views/packs/_annotation.html.erb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -25,7 +25,13 @@
         <% unless value.empty? %>
           <tr>
             <td class="label"><%=h label -%></td>
-            <td class="value"><%=h value -%></td>
+            <td class="value">
+            <% if parameter["type"] == "resource" %>
+              <%= resource_link(pack.find_resource_by_path(value)) -%>
+            <% else %>
+              <%=h value -%>
+            <% end %>
+            </td>
           </tr>
         <% end %>
       <% end %>

Modified: branches/packs/app/views/packs/item_show.html.erb (3669 => 3670)


--- branches/packs/app/views/packs/item_show.html.erb	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/views/packs/item_show.html.erb	2013-09-05 00:29:34 UTC (rev 3670)
@@ -16,7 +16,7 @@
     <td><%=h @item.folder_entry.entry_name -%></td>
   </tr>
   <tr>
-    <td>Aggregated at<td>
+    <td>Aggregated at</td>
     <td><%= datetime(@item.created_at) -%></td>
   </tr>
   <tr>
@@ -38,6 +38,27 @@
   <p><%=h simple_format(@description) -%></p>
 <% end %>
 
+<% unless @roles_in_time.empty? %>
+  <h2>Roles</h2>
+  <table class="simple">
+    <% @roles_in_time.each do |role_in_time| %>
+      <% person = @statements.query([nil, RDF::URI("http://purl.org/spar/pro/holdsRoleInTime"), role_in_time]).first_subject %>
+      <% name   = @statements.query([person, RDF::FOAF.name, nil]).first_literal %>
+      <% orcid  = @statements.query([person, RDF::URI("http://purl.org/spar/scoro/hasORCID"), nil]).first_literal %>
+      <% role   = @statements.query([role_in_time, RDF::URI("http://purl.org/spar/pro/withRole"), nil]).first_object %>
+      <tr>
+        <td><%=h name -%></td>
+        <td>
+          <% if orcid %>
+            (OrcID <%=h orcid -%>)
+          <% end %>
+        </td>
+        <td><%=h role -%></td>
+      </tr>
+    <% end %>
+  </table>
+<% end %>
+
 <% unless @input_files_for_this_workflow.empty? %>
   <h2>Input files</h2>
   <ul>
@@ -86,6 +107,7 @@
     <li><%= link_to('Add title', new_pack_annotation_path(@pack, { :template => 'title', :resource => @item.ore_path })) -%></li>
     <li><%= link_to('Add resource type', new_pack_annotation_path(@pack, { :template => 'resource_type', :resource => @item.ore_path })) -%></li>
     <li><%= link_to('Add description', new_pack_annotation_path(@pack, { :template => 'description', :resource => @item.ore_path })) -%></li>
+    <li><%= link_to('Add role', new_pack_annotation_path(@pack, { :template => 'role', :resource => @item.ore_path })) -%></li>
     <li><%= link_to("Select an input file", new_pack_annotation_path(@pack, { :template => 'input_selection_relationship', :workflow => @item.ore_path })) -%></li>
     <li><%= link_to("Add new hardware requirement", new_pack_annotation_path(@pack, { :template => 'requires_hardware', :resource => @item.ore_path })) -%></li>
     <li><%= link_to("Add new software requirement", new_pack_annotation_path(@pack, { :template => 'requires_software', :resource => @item.ore_path })) -%></li>

Modified: branches/packs/app/views/packs/show.rhtml (3669 => 3670)


--- branches/packs/app/views/packs/show.rhtml	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/app/views/packs/show.rhtml	2013-09-05 00:29:34 UTC (rev 3670)
@@ -95,12 +95,12 @@
 
   <% if @research_question %>
     <h2>Research Question</h2>
-    <p><%= link_to(h(@research_question.to_s), @research_question.to_s) -%></p>
+    <p><%= resource_link(@pack.find_resource_by_path(@research_question)) -%></p>
   <% end %>
 
   <% if @hypothesis %>
     <h2>Hypothesis</h2>
-    <p><%= link_to(h(@hypothesis.to_s), @hypothesis.to_s) -%></p>
+    <p><%= resource_link(@pack.find_resource_by_path(@hypothesis)) -%></p>
   <% end %>
 
   <% if @conclusion %>

Modified: branches/packs/config/default_settings.yml (3669 => 3670)


--- branches/packs/config/default_settings.yml	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/config/default_settings.yml	2013-09-05 00:29:34 UTC (rev 3670)
@@ -1692,6 +1692,294 @@
 
     - :resource
 
+  role:
+
+    label: role
+
+    bnodes: [:b1, :b2]
+
+    parameters:
+
+    - label:  Resource
+      type:   resource
+      symbol: :resource
+
+    - label:  Name
+      type:   string
+      symbol: :name
+
+    - label:    OrcID
+      type:     string 
+      symbol:   :orcid
+      placeholder: "0000-0000-0000-0000"
+      optional: true
+
+    - label:     Role
+      type:      select
+      symbol:    :role
+      node_type: resource
+      options:
+
+      - - "article guarantor"
+        - "http://purl.org/spar/scoro/article-guarantor"
+    
+      - - "consortium author"
+        - "http://purl.org/spar/scoro/consortium-author"
+    
+      - - "corresponding author"
+        - "http://purl.org/spar/scoro/corresponding-author"
+    
+      - - "illustrator"
+        - "http://purl.org/spar/scoro/illustrator"
+    
+      - - "photographer"
+        - "http://purl.org/spar/scoro/photographer"
+    
+      - - "principal author"
+        - "http://purl.org/spar/scoro/principal-author"
+    
+      - - "senior author"
+        - "http://purl.org/spar/scoro/senior-author"
+    
+      - - "access provider"
+        - "http://purl.org/spar/scoro/access-provider"
+    
+      - - "curator"
+        - "http://purl.org/spar/scoro/curator"
+    
+      - - "data creator"
+        - "http://purl.org/spar/scoro/data-creator"
+    
+      - - "data curator"
+        - "http://purl.org/spar/scoro/data-curator"
+    
+      - - "data manager"
+        - "http://purl.org/spar/scoro/data-manager"
+    
+      - - "data publisher"
+        - "http://purl.org/spar/scoro/data-publisher"
+    
+      - - "data user"
+        - "http://purl.org/spar/scoro/data-user"
+    
+      - - "embargo controller"
+        - "http://purl.org/spar/scoro/embargo-controller"
+    
+      - - "repository manager"
+        - "http://purl.org/spar/scoro/repository-manager"
+    
+      - - "web-master"
+        - "http://purl.org/spar/scoro/web-master"
+    
+      - - "faculty member"
+        - "http://purl.org/spar/scoro/faculty-member"
+    
+      - - "postgraduate student"
+        - "http://purl.org/spar/scoro/postgraduate-student"
+    
+      - - "supervisor"
+        - "http://purl.org/spar/scoro/supervisor"
+    
+      - - "undergraduate student"
+        - "http://purl.org/spar/scoro/undergraduate-student"
+    
+      - - "accountant"
+        - "http://purl.org/spar/scoro/accountant"
+    
+      - - "auditor"
+        - "http://purl.org/spar/scoro/auditor"
+    
+      - - "claimant"
+        - "http://purl.org/spar/scoro/claimant"
+    
+      - - "contractor"
+        - "http://purl.org/spar/scoro/contractor"
+    
+      - - "financial controller"
+        - "http://purl.org/spar/scoro/financial-controller"
+    
+      - - "funder"
+        - "http://purl.org/spar/scoro/funder "
+    
+      - - "funding recipient"
+        - "http://purl.org/spar/scoro/funding-recipient"
+    
+      - - "owner"
+        - "http://purl.org/spar/scoro/owner"
+    
+      - - "purchaser"
+        - "http://purl.org/spar/scoro/purchaser"
+    
+      - - "sponsor"
+        - "http://purl.org/spar/scoro/sponsor"
+    
+      - - "sub-contractor"
+        - "http://purl.org/spar/scoro/sub-contractor"
+    
+      - - "supplier"
+        - "http://purl.org/spar/scoro/supplier"
+    
+      - - "chief scientist"
+        - "http://purl.org/spar/scoro/chief-scientist"
+    
+      - - "co-investigator"
+        - "http://purl.org/spar/scoro/co-investigator"
+    
+      - - "collaborator"
+        - "http://purl.org/spar/scoro/collaborator"
+    
+      - - "computer programmer"
+        - "http://purl.org/spar/scoro/computer-programmer"
+    
+      - - "consultant"
+        - "http://purl.org/spar/scoro/consultant"
+    
+      - - "inventor"
+        - "http://purl.org/spar/scoro/inventor"
+    
+      - - "postdoctoral researcher"
+        - "http://purl.org/spar/scoro/postdoctoral-researcher"
+    
+      - - "principal investigator"
+        - "http://purl.org/spar/scoro/principal-investigator"
+    
+      - - "project student"
+        - "http://purl.org/spar/scoro/project-student"
+    
+      - - "research assistant"
+        - "http://purl.org/spar/scoro/research-assistant"
+    
+      - - "research student"
+        - "http://purl.org/spar/scoro/research-student"
+    
+      - - "researcher"
+        - "http://purl.org/spar/scoro/researcher"
+    
+      - - "scholar"
+        - "http://purl.org/spar/scoro/scholar"
+    
+      - - "service engineer"
+        - "http://purl.org/spar/scoro/service-engineer"
+    
+      - - "technician"
+        - "http://purl.org/spar/scoro/technician"
+    
+      - - "CEO"
+        - "http://purl.org/spar/scoro/chief-executive-officer"
+    
+      - - "CTO"
+        - "http://purl.org/spar/scoro/chief-technology-officer"
+    
+      - - "administrator"
+        - "http://purl.org/spar/scoro/administrator"
+    
+      - - "affiliate"
+        - "http://purl.org/spar/scoro/affiliate"
+    
+      - - "agent"
+        - "http://purl.org/spar/scoro/agent"
+    
+      - - "college fellow"
+        - "http://purl.org/spar/scoro/college-fellow"
+    
+      - - "college head"
+        - "http://purl.org/spar/scoro/college-head"
+    
+      - - "contact person"
+        - "http://purl.org/spar/scoro/contact-person"
+    
+      - - "departmental administrator"
+        - "http://purl.org/spar/scoro/departmental-administrator"
+    
+      - - "director"
+        - "http://purl.org/spar/scoro/director"
+    
+      - - "employee"
+        - "http://purl.org/spar/scoro/employee"
+    
+      - - "employer"
+        - "http://purl.org/spar/scoro/employer"
+    
+      - - "head of department"
+        - "http://purl.org/spar/scoro/head-of-department"
+    
+      - - "manager"
+        - "http://purl.org/spar/scoro/manager"
+    
+      - - "member"
+        - "http://purl.org/spar/scoro/member"
+    
+      - - "non-academic staff member"
+        - "http://purl.org/spar/scoro/non-academic-staff-member"
+    
+      - - "organizer"
+        - "http://purl.org/spar/scoro/organizer"
+    
+      - - "participant"
+        - "http://purl.org/spar/scoro/participant"
+    
+      - - "partner"
+        - "http://purl.org/spar/scoro/partner"
+    
+      - - "patent holder"
+        - "http://purl.org/spar/scoro/patent-holder"
+    
+      - - "possessor"
+        - "http://purl.org/spar/scoro/possessor"
+    
+      - - "programme manager"
+        - "http://purl.org/spar/scoro/programme-manager"
+    
+      - - "registrar"
+        - "http://purl.org/spar/scoro/registrar"
+    
+      - - "rights holder"
+        - "http://purl.org/spar/scoro/rights-holder"
+    
+      - - "spokesperson"
+        - "http://purl.org/spar/scoro/spokesperson"
+    
+      - - "stakeholder"
+        - "http://purl.org/spar/scoro/stakeholder"
+    
+      - - "successor"
+        - "http://purl.org/spar/scoro/successor"
+    
+      - - "vice-chancellor"
+        - "http://purl.org/spar/scoro/vice-chancellor"
+    
+      - - "co-applicant"
+        - "http://purl.org/spar/scoro/co-applicant"
+    
+      - - "lead applicant"
+        - "http://purl.org/spar/scoro/lead-applicant"
+    
+      - - "project leader"
+        - "http://purl.org/spar/scoro/project-leader"
+    
+      - - "project manager"
+        - "http://purl.org/spar/scoro/project-manager"
+    
+      - - "project member"
+        - "http://purl.org/spar/scoro/project-member"
+    
+      - - "workpackage leader"
+        - "http://purl.org/spar/scoro/workpackage-leader"
+
+    required_statements:
+
+    - template: [:b1, "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", "<http://xmlns.com/foaf/0.1/Agent>"]
+    - template: [:b1, "<http://xmlns.com/foaf/0.1/name>", :name]
+    - template: [:b1, "<http://purl.org/spar/pro/holdsRoleInTime>", :b2]
+    - template: [:b1, "<http://purl.org/spar/scoro/hasORCID>", :orcid]
+      depends:  [:orcid]
+
+    - template: [:b2, "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>", "<http://purl.org/spar/pro/RoleInTime>"]
+    - template: [:b2, "<http://purl.org/spar/pro/withRole>", :role]
+    - template: [:b2, "<http://purl.org/spar/pro/relatesToEntity>", :resource]
+
+    targets: [:resource]
+
 wf_ro_service_uri: "http://www.example.com/wf-ro/jobs"
 wf_ro_service_bearer_token: "bearer-token"
 
@@ -1737,7 +2025,7 @@
     image: /images/famfamfam_silk/page_white_csharp.png
     label: C# source file
 
-  - extensions: [xls, xslx, xslm, csv]
+  - extensions: [xls, xlsx, xlsm, csv]
     image: /images/famfamfam_silk/page_white_excel.png
     label: Excel file
 

Modified: branches/packs/public/stylesheets/styles.css (3669 => 3670)


--- branches/packs/public/stylesheets/styles.css	2013-09-04 14:18:35 UTC (rev 3669)
+++ branches/packs/public/stylesheets/styles.css	2013-09-05 00:29:34 UTC (rev 3670)
@@ -2682,7 +2682,7 @@
   content: ":";
 }
 
-.annotation INPUT,
+.annotation INPUT[type="text"],
 .annotation TEXTAREA {
   width: 500px;
 }
@@ -2700,3 +2700,10 @@
   text-align: right;
   color: red;
 }
+
+.resource-link IMG {
+  position: relative;
+  top: -1px;
+  vertical-align: middle;
+}
+

reply via email to

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