myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3147] branches/wf4ever: renamed annotations (as


From: noreply
Subject: [myexperiment-hackers] [3147] branches/wf4ever: renamed annotations (as RDF statements) to statements
Date: Tue, 9 Oct 2012 13:13:04 +0000 (UTC)

Revision
3147
Author
dgc
Date
2012-10-09 13:13:04 +0000 (Tue, 09 Oct 2012)

Log Message

renamed annotations (as RDF statements) to statements

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/wf4ever/app/controllers/research_objects_controller.rb (3146 => 3147)


--- branches/wf4ever/app/controllers/research_objects_controller.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/controllers/research_objects_controller.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -140,14 +140,14 @@
   # GET /research_objects/:id/resource/:path
   def resource_show
 
-    resource_object = Annotation.find(:first, :conditions => {
+    resource_object = Statement.find(:first, :conditions => {
         :research_object_id => @contributable.id,
         :predicate_text => 'http://purl.org/wf4ever/ro#name',
         :objekt_text => params[:path]})
 
     raise ActiveRecord::RecordNotFound if resource_object.nil?
 
-    statements = Annotation.find(:all, :conditions => {
+    statements = Statement.find(:all, :conditions => {
         :subject_text => resource_object.subject_text
     })
     

Modified: branches/wf4ever/app/helpers/research_objects_helper.rb (3146 => 3147)


--- branches/wf4ever/app/helpers/research_objects_helper.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/helpers/research_objects_helper.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -11,10 +11,10 @@
     p_uris = []
     o_uris = []
 
-    ro.annotations.each do |annotation|
-      s_uris << annotation.subject_text
-      p_uris << annotation.predicate_text
-      o_uris << annotation.objekt_text
+    ro.statements.each do |statement|
+      s_uris << statement.subject_text
+      p_uris << statement.predicate_text
+      o_uris << statement.objekt_text
     end
 
     uris = (s_uris + p_uris + o_uris).uniq!
@@ -38,14 +38,14 @@
     uris
   end
 
-  def research_object_annotations(contributable)
+  def research_object_statements(contributable)
 
     return [] unless contributable.respond_to?(:content_blob)
 
     hash = contributable.content_blob.md5
     
-    annotations = Annotation.find(:all,
-        :joins      => "JOIN annotations AS a1 ON annotations.subject_text = a1.subject_text",
+    statements = Statement.find(:all,
+        :joins      => "JOIN statements AS a1 ON statements.subject_text = a1.subject_text",
         :conditions => ["a1.predicate_text = ? AND a1.objekt_text = ?",
                         "http://purl.org/wf4ever/ro#checksum",
                         "urn:MD5:#{hash.upcase}"])

Deleted: branches/wf4ever/app/models/annotation.rb (3146 => 3147)


--- branches/wf4ever/app/models/annotation.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/models/annotation.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -1,15 +0,0 @@
-# myExperiment: app/models/annotations.rb
-#
-# Copyright (c) 2012 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class Annotation < ActiveRecord::Base
-
-  belongs_to :research_object
-
-  validates_presence_of :subject_text
-  validates_presence_of :predicate_text
-  validates_presence_of :objekt_text
-
-end
-

Modified: branches/wf4ever/app/models/research_object.rb (3146 => 3147)


--- branches/wf4ever/app/models/research_object.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/models/research_object.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -17,7 +17,7 @@
   acts_as_site_entity
   acts_as_contributable
 
-  has_many :annotations, :dependent => :destroy
+  has_many :statements, :dependent => :destroy
 
   belongs_to :content_blob, :dependent => :destroy
 
@@ -61,7 +61,7 @@
 
       graph.query([nil, nil, nil]).each do |s, p, o|
 
-        annotations.create(
+        statements.create(
             :subject_text =>   s.to_s,
             :predicate_text => p.to_s,
             :objekt_text =>    o.to_s)
@@ -89,7 +89,7 @@
 
     graph.query([nil, nil, nil]).each do |s, p, o|
 
-      annotations.create(
+      statements.create(
           :subject_text =>   s.to_s,
           :predicate_text => p.to_s,
           :objekt_text =>    o.to_s)
@@ -100,7 +100,7 @@
 
   def wf4ever_resources
 
-    resources = annotations.find(:all, :conditions =>
+    resources = statements.find(:all, :conditions =>
       ['predicate_text = ? AND objekt_text = ?',
         'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
         'http://purl.org/wf4ever/ro#Resource']).map do
@@ -111,15 +111,15 @@
 
       metadata = {}
 
-      annotations.find(:all, :conditions =>
-        ['subject_text = ?', resource]).each do |annotation|
+      statements.find(:all, :conditions =>
+        ['subject_text = ?', resource]).each do |statement|
 
-        case annotation.predicate_text
-        when "http://purl.org/wf4ever/ro#name":      metadata[:name]    = annotation.objekt_text
-        when "http://purl.org/dc/terms/created":     metadata[:created] = Date.parse(annotation.objekt_text)
-        when "http://purl.org/dc/terms/creator":     metadata[:creator] = annotation.objekt_text
-        when "http://purl.org/wf4ever/ro#checksum" : metadata[:md5]     = annotation.objekt_text
-        when "http://purl.org/wf4ever/ro#filesize" : metadata[:size]    = annotation.objekt_text.to_i
+        case statement.predicate_text
+        when "http://purl.org/wf4ever/ro#name":      metadata[:name]    = statement.objekt_text
+        when "http://purl.org/dc/terms/created":     metadata[:created] = Date.parse(statement.objekt_text)
+        when "http://purl.org/dc/terms/creator":     metadata[:creator] = statement.objekt_text
+        when "http://purl.org/wf4ever/ro#checksum" : metadata[:md5]     = statement.objekt_text
+        when "http://purl.org/wf4ever/ro#filesize" : metadata[:size]    = statement.objekt_text.to_i
         end
 
       end
@@ -177,16 +177,16 @@
     end
   end
 
-  def ao_annotations
+  def annotations
 
     results = []
 
-    annotation_bodies = annotations.find(:all,
+    annotation_bodies = statements.find(:all,
         :conditions => ['predicate_text = ?', 'http://purl.org/ao/body'])
 
     annotation_bodies.each do |body|
 
-      type = annotations.find(:first,
+      type = statements.find(:first,
           :conditions => ['predicate_text = ? AND subject_text = ?',
           'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
           body.subject_text])

Copied: branches/wf4ever/app/models/statement.rb (from rev 3142, branches/wf4ever/app/models/annotation.rb) (0 => 3147)


--- branches/wf4ever/app/models/statement.rb	                        (rev 0)
+++ branches/wf4ever/app/models/statement.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -0,0 +1,15 @@
+# myExperiment: app/models/statements.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class Statement < ActiveRecord::Base
+
+  belongs_to :research_object
+
+  validates_presence_of :subject_text
+  validates_presence_of :predicate_text
+  validates_presence_of :objekt_text
+
+end
+

Modified: branches/wf4ever/app/views/research_objects/show.rhtml (3146 => 3147)


--- branches/wf4ever/app/views/research_objects/show.rhtml	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/views/research_objects/show.rhtml	2012-10-09 13:13:04 UTC (rev 3147)
@@ -29,13 +29,13 @@
 
   <tr>
     <td>RDF statement count</td>
-    <td><%= @contributable.annotations.length -%></td>
+    <td><%= @contributable.statements.length -%></td>
   </tr>
 
 </table>
 
 <% resources   = @contributable.wf4ever_resources %>
-<% annotations = @contributable.ao_annotations    %>
+<% annotations = @contributable.annotations       %>
 
 <% if resources.length > 0 %>
 
@@ -66,11 +66,11 @@
 
 <% end %>
 
-<% if @contributable.annotations.length > 0 %>
+<% if @contributable.statements.length > 0 %>
 
   <div class="fold">
 
-    <div class="foldTitle">RDF statements (<%= @contributable.annotations.length -%>)</div>
+    <div class="foldTitle">RDF statements (<%= @contributable.statements.length -%>)</div>
     <div class="foldContent" style="display: none;">
 
       <h2>Summary</h2>
@@ -95,12 +95,12 @@
       <h2>Statements</h2>
 
       <div id="annotation_list">
-        <% @contributable.annotations.each do |annotation| %>
+        <% @contributable.statements.each do |statement| %>
           <div>
             <table>
-              <tr><td><%=h annotation.subject_text   -%></td></tr>
-              <tr><td><%=h annotation.predicate_text -%></td></tr>
-              <tr><td><%=h annotation.objekt_text    -%></td></tr>
+              <tr><td><%=h statement.subject_text   -%></td></tr>
+              <tr><td><%=h statement.predicate_text -%></td></tr>
+              <tr><td><%=h statement.objekt_text    -%></td></tr>
             </table>
           </div>
         <% end %>

Modified: branches/wf4ever/app/views/workflows/show.rhtml (3146 => 3147)


--- branches/wf4ever/app/views/workflows/show.rhtml	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/app/views/workflows/show.rhtml	2012-10-09 13:13:04 UTC (rev 3147)
@@ -206,25 +206,25 @@
 		
 			<br/>
 			
-      <% annotations = research_object_annotations(@workflow) %>
+      <% statements = research_object_statements(@workflow) %>
 
-      <% if annotations.length > 0 %>
+      <% if statements.length > 0 %>
 
-      <h3>Annotations</h3>
+      <h3>RDF Statements</h3>
 
       <div class="fold">
 
-        <div class="foldTitle">Annotations (<%= annotations.length -%>)</div>
+        <div class="foldTitle">Statements (<%= statements.length -%>)</div>
         <div class="foldContent" style="display: none;">
 
-          <div id="annotation_list">
-            <% annotations.each do |annotation| %>
+          <div id="statement_list">
+            <% statements.each do |statement| %>
               <div>
                 <table>
-                  <tr><td><%= link_to(annotation.research_object.title, annotation.research_object) -%></td></tr>
-                  <tr><td><%=h annotation.subject_text          -%></td></tr>
-                  <tr><td><%=h annotation.predicate_text        -%></td></tr>
-                  <tr><td><%=h annotation.objekt_text           -%></td></tr>
+                  <tr><td><%= link_to(statement.research_object.title, statement.research_object) -%></td></tr>
+                  <tr><td><%=h statement.subject_text          -%></td></tr>
+                  <tr><td><%=h statement.predicate_text        -%></td></tr>
+                  <tr><td><%=h statement.objekt_text           -%></td></tr>
                 </table>
               </div>
             <% end %>

Deleted: branches/wf4ever/db/migrate/20120518002924_create_annotations.rb (3146 => 3147)


--- branches/wf4ever/db/migrate/20120518002924_create_annotations.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/db/migrate/20120518002924_create_annotations.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -1,21 +0,0 @@
-# myExperiment: db/migrate/20120518002924_create_annotations.rb
-#
-# Copyright (c) 2012 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-class CreateAnnotations < ActiveRecord::Migration
-  def self.up
-    create_table "annotations", :force => true do |t|
-      t.integer  "research_object_id"
-      t.string   "subject_text"
-      t.string   "predicate_text"
-      t.string   "objekt_text"
-      t.datetime "created_at"
-      t.datetime "updated_at"
-    end
-  end
-
-  def self.down
-    drop_table :announcements
-  end
-end

Copied: branches/wf4ever/db/migrate/20120518002924_create_statements.rb (from rev 3142, branches/wf4ever/db/migrate/20120518002924_create_annotations.rb) (0 => 3147)


--- branches/wf4ever/db/migrate/20120518002924_create_statements.rb	                        (rev 0)
+++ branches/wf4ever/db/migrate/20120518002924_create_statements.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -0,0 +1,21 @@
+# myExperiment: db/migrate/20120518002924_create_statements.rb
+#
+# Copyright (c) 2012 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+class CreateAnnotations < ActiveRecord::Migration
+  def self.up
+    create_table "statements", :force => true do |t|
+      t.integer  "research_object_id"
+      t.string   "subject_text"
+      t.string   "predicate_text"
+      t.string   "objekt_text"
+      t.datetime "created_at"
+      t.datetime "updated_at"
+    end
+  end
+
+  def self.down
+    drop_table :statements
+  end
+end

Modified: branches/wf4ever/db/schema.rb (3146 => 3147)


--- branches/wf4ever/db/schema.rb	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/db/schema.rb	2012-10-09 13:13:04 UTC (rev 3147)
@@ -22,15 +22,6 @@
     t.datetime "promote_after"
   end
 
-  create_table "annotations", :force => true do |t|
-    t.integer  "research_object_id"
-    t.string   "subject_text"
-    t.string   "predicate_text"
-    t.string   "objekt_text"
-    t.datetime "created_at"
-    t.datetime "updated_at"
-  end
-
   create_table "announcements", :force => true do |t|
     t.string   "title"
     t.integer  "user_id"
@@ -676,6 +667,15 @@
   add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
   add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
 
+  create_table "statements", :force => true do |t|
+    t.integer  "research_object_id"
+    t.string   "subject_text"
+    t.string   "predicate_text"
+    t.string   "objekt_text"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
   create_table "taggings", :force => true do |t|
     t.integer  "tag_id"
     t.integer  "taggable_id"

Modified: branches/wf4ever/public/stylesheets/styles.css (3146 => 3147)


--- branches/wf4ever/public/stylesheets/styles.css	2012-10-09 01:17:48 UTC (rev 3146)
+++ branches/wf4ever/public/stylesheets/styles.css	2012-10-09 13:13:04 UTC (rev 3147)
@@ -2380,17 +2380,17 @@
   -webkit-border-bottom-right-radius: 6px;
 }
 
-#annotation_list TABLE {
+#statement_list TABLE {
   border-collapse: collapse;
   margin-bottom: 16px;
   width: 100%;
 }
 
-#annotation_list DIV {
+#statement_list DIV {
   box-shadow: 5px 5px 8px #AAA;
 }
 
-#annotation_list TD {
+#statement_list TD {
   border: 1px solid gray;
   text-align: left;
 }

reply via email to

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