Diff
Modified: branches/packs/app/controllers/items_controller.rb (3764 => 3765)
--- branches/packs/app/controllers/items_controller.rb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/controllers/items_controller.rb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -37,15 +37,17 @@
@statements = merge_graphs(@annotations.map { |annotation| annotation[:graph] })
@item_uri = @item.uri
- @view_uri = RDF::URI(params[:view]) if params[:view]
+ @view_uri = RDF::URI(params[:resource]) if params[:resource]
+ @wsdl_uris = @statements.query([nil, RDF::URI("http://purl.org/wf4ever/wf4ever#wsdlURI"), nil]).map { |s, p, o| o }
+
# Show a custom view if a view parameter is given
if @view_uri
@view_types = @statements.query(address@hidden, RDF.type, nil]).objects
@resource_uri = polymorphic_path(address@hidden, :items]) + "/" + @item.ore_path
- @view_uri = RDF::URI(params[:view])
+ @view_uri = RDF::URI(params[:resource])
if @view_types.include?(RDF::URI("http://purl.org/wf4ever/wfprov#WorkflowRun"))
render :workflow_run
@@ -55,7 +57,7 @@
return
else
if Rails.env == "development"
- render :text => "<pre>Types\n\n" + @view_types.map { |t| t.to_s }.join("\n") + "</pre>"
+ render(:partial => "debug", :locals => { :item => @item, :view_uri => @view_uri, :statements => @statements }, :layout => true)
return
end
end
Modified: branches/packs/app/helpers/annotations_helper.rb (3764 => 3765)
--- branches/packs/app/helpers/annotations_helper.rb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/helpers/annotations_helper.rb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -8,11 +8,21 @@
def wfprov_workflow_run(research_object)
graph = research_object.merged_annotation_graphs
- workflows = graph.query([nil, RDF.type, RDF::URI("http://purl.org/wf4ever/wfprov#WorkflowRun")]).subjects
+ things = graph.query([nil, RDF.type, RDF::URI("http://purl.org/wf4ever/wfprov#WorkflowRun")]).subjects
- select_options = workflows.map do |workflow|
- [graph.query([workflow, RDF::RDFS.label, nil]).first_literal.to_s, workflow.to_s]
+ select_options = things.map do |thing|
+ [graph.query([thing, RDF::RDFS.label, nil]).first_literal.to_s, thing.to_s]
end
end
+ def wfdesc_workflow(research_object)
+ graph = research_object.merged_annotation_graphs
+
+ things = graph.query([nil, RDF.type, RDF::URI("http://purl.org/wf4ever/wfdesc#Workflow")]).subjects
+
+ select_options = things.map do |thing|
+ [graph.query([thing, RDF::RDFS.label, nil]).first_literal.to_s, thing.to_s]
+ end
+ end
+
end
Modified: branches/packs/app/helpers/research_objects_helper.rb (3764 => 3765)
--- branches/packs/app/helpers/research_objects_helper.rb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/helpers/research_objects_helper.rb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -307,7 +307,7 @@
if opts[:format] == :rdfxml || opts[:format].nil?
render_rdf_xml(graph, opts)
else
- RDF::Writer.for(opts[:format]).buffer { |writer| writer << graph }
+ RDF::Writer.for(opts[:format]).buffer(:base_uri => opts[:base_uri]) { |writer| writer << graph }
end
end
@@ -346,15 +346,15 @@
folders.reverse
end
- def item_uri(resource)
- polymorphic_url([resource.research_object.context, :items]) + "/" + resource.ore_path
+ def item_uri(item)
+ polymorphic_url([item.research_object.context, :items]) + "/" + item.ore_path
end
- def item_uri_with_view(resource, view)
- item_uri(resource) + "?" + { :view => view }.to_query
+ def item_uri_with_resource(item, resource)
+ item_uri(item) + "?" + { :resource => resource }.to_query
end
- def item_label(resource, statements)
+ def resource_label(resource, statements)
label = statements.query([resource, RDF::RDFS.label, nil]).first_literal
@@ -363,8 +363,8 @@
resource
end
- def item_link(resource, view, statements)
- link_to(h(item_label(view, statements)), item_uri_with_view(resource, view))
+ def item_link(item, resource, statements)
+ link_to(h(resource_label(resource, statements)), item_uri_with_resource(item, resource))
end
end
Modified: branches/packs/app/models/resource.rb (3764 => 3765)
--- branches/packs/app/models/resource.rb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/models/resource.rb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -269,7 +269,7 @@
def annotations_with_templates
annotations.map do |annotation|
- graph = load_graph(annotation.ao_body.content_blob.data, :content_type => annotation.ao_body.content_type)
+ graph = load_graph(annotation.ao_body.content_blob.data, :content_type => annotation.ao_body.content_type, :base_uri => annotation.ao_body.uri)
template, parameters = research_object.find_template_from_graph(graph, Conf.ro_templates)
Modified: branches/packs/app/views/annotations/_annotation.html.erb (3764 => 3765)
--- branches/packs/app/views/annotations/_annotation.html.erb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/views/annotations/_annotation.html.erb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -22,6 +22,8 @@
options = parameter["options"]
elsif parameter["special"] == "wfprov_workflow_run"
options = wfprov_workflow_run(context.research_object)
+ elsif parameter["special"] == "wfdesc_workflow"
+ options = wfdesc_workflow(context.research_object)
end
%>
<% value_match = options.find { |option| value == option[1] } %>
Modified: branches/packs/app/views/annotations/_form.html.erb (3764 => 3765)
--- branches/packs/app/views/annotations/_form.html.erb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/views/annotations/_form.html.erb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -31,6 +31,8 @@
<% when "select" %>
<% if parameter["special"] == "wfprov_workflow_run" %>
<%= select_tag(parameter["symbol"], options_for_select(wfprov_workflow_run(@context.research_object))) -%>
+ <% elsif parameter["special"] == "wfdesc_workflow" %>
+ <%= select_tag(parameter["symbol"], options_for_select(wfdesc_workflow(@context.research_object))) -%>
<% else %>
<%= select_tag(parameter["symbol"], options_for_select(parameter["options"])) -%>
<% end %>
Modified: branches/packs/app/views/items/_debug.html.erb (3764 => 3765)
--- branches/packs/app/views/items/_debug.html.erb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/views/items/_debug.html.erb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -13,7 +13,7 @@
<td><%=h shorten_uri(p.to_s) -%></td>
<td>
<% if o.resource? %>
- <%= link_to(o.to_s, item_uri_with_view(item, o.to_s)) -%></td>
+ <%= link_to(o.to_s, item_uri_with_resource(item, o.to_s)) -%></td>
<% else %>
<%=h o.to_s -%></td>
<% end %>
@@ -32,7 +32,7 @@
<tr>
<td>
<% if s.resource? %>
- <%= link_to(s.to_s, item_uri_with_view(item, s.to_s)) -%></td>
+ <%= link_to(s.to_s, item_uri_with_resource(item, s.to_s)) -%></td>
<% else %>
<%=h s.to_s -%></td>
<% end %>
@@ -53,7 +53,7 @@
</tr>
<% statements.query([nil, RDF.type, nil]).each do |s, p, o| %>
<tr>
- <td><%= link_to(s.to_s, item_uri_with_view(item, s.to_s)) -%></td>
+ <td><%= link_to(s.to_s, item_uri_with_resource(item, s.to_s)) -%></td>
<td><%=h shorten_uri(o.to_s) -%></td>
</tr>
<% end %>
Modified: branches/packs/app/views/items/workflow_run.html.erb (3764 => 3765)
--- branches/packs/app/views/items/workflow_run.html.erb 2013-11-01 15:54:36 UTC (rev 3764)
+++ branches/packs/app/views/items/workflow_run.html.erb 2013-11-01 15:55:21 UTC (rev 3765)
@@ -1,4 +1,4 @@
-<h1>Workflow Run: <%=h item_label(@view_uri, @statements) -%></h1>
+<h1>Workflow Run: <%=h resource_label(@view_uri, @statements) -%></h1>
<%= render(:partial => "duration", :locals => { :resource_uri => @view_uri, :statements => @statements }) -%>