myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [2368] branches/biocat: removed BioCat/ bio_cat_


From: noreply
Subject: [myexperiment-hackers] [2368] branches/biocat: removed BioCat/ bio_cat_ prefixes from biocatalogue models
Date: Wed, 31 Mar 2010 09:15:32 -0400 (EDT)

Revision
2368
Author
dgc
Date
2010-03-31 09:15:32 -0400 (Wed, 31 Mar 2010)

Log Message

removed BioCat/bio_cat_ prefixes from biocatalogue models

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/biocat/Rakefile (2367 => 2368)


--- branches/biocat/Rakefile	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/Rakefile	2010-03-31 13:15:32 UTC (rev 2368)
@@ -22,6 +22,11 @@
 desc 'Refresh workflow metadata'
 task "myexp:refresh:workflows" do
   require File.dirname(__FILE__) + '/config/environment'
+
+  conn = ActiveRecord::Base.connection
+
+  conn.execute('TRUNCATE workflow_processors')
+
   Workflow.find(:all).each do |w|
     w.extract_metadata
   end
@@ -30,6 +35,18 @@
 desc 'Import data from BioCatalogue'
 task "myexp:import:biocat" do
   require File.dirname(__FILE__) + '/config/environment'
+
+  Contribution.delete_all("contributable_type = 'Service'")
+
+  conn = ActiveRecord::Base.connection
+
+  conn.execute('TRUNCATE service_categories')
+  conn.execute('TRUNCATE service_deployments')
+  conn.execute('TRUNCATE service_providers')
+  conn.execute('TRUNCATE service_tags')
+  conn.execute('TRUNCATE service_types')
+  conn.execute('TRUNCATE services')
+
   BioCatalogueImport.import_biocatalogue
 end
 

Modified: branches/biocat/app/controllers/services_controller.rb (2367 => 2368)


--- branches/biocat/app/controllers/services_controller.rb	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/app/controllers/services_controller.rb	2010-03-31 13:15:32 UTC (rev 2368)
@@ -42,7 +42,7 @@
   protected
   
   def find_services
-    @contributables = BioCatService.find(:all, 
+    @contributables = Service.find(:all, 
                        :order => "created_at DESC",
                        :page => { :size => 20, 
                        :current => params[:page] })
@@ -50,7 +50,7 @@
   
   def find_service
     begin
-      service = BioCatService.find(params[:id])
+      service = Service.find(params[:id])
       
       @contributable = service
       
@@ -71,7 +71,7 @@
   
   def error(notice, message, attr=:id)
     flash[:error] = notice
-     (err = BioCatService.new.errors).add(attr, message)
+     (err = Service.new.errors).add(attr, message)
     
     respond_to do |format|
       format.html { redirect_to services_url }

Deleted: branches/biocat/app/models/bio_cat_service.rb (2367 => 2368)


--- branches/biocat/app/models/bio_cat_service.rb	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/app/models/bio_cat_service.rb	2010-03-31 13:15:32 UTC (rev 2368)
@@ -1,14 +0,0 @@
-# myExperiment: app/models/bio_cat_service.rb
-#
-# Copyright (c) 2007 University of Manchester and the University of Southampton.
-# See license.txt for details.
-
-require 'lib/acts_as_site_entity'
-require 'lib/acts_as_contributable'
-
-class BioCatService < ActiveRecord::Base
-  acts_as_site_entity
-  acts_as_contributable
-  acts_as_structured_data
-end
-

Copied: branches/biocat/app/models/service.rb (from rev 2363, branches/biocat/app/models/bio_cat_service.rb) (0 => 2368)


--- branches/biocat/app/models/service.rb	                        (rev 0)
+++ branches/biocat/app/models/service.rb	2010-03-31 13:15:32 UTC (rev 2368)
@@ -0,0 +1,14 @@
+# myExperiment: app/models/service.rb
+#
+# Copyright (c) 2007 University of Manchester and the University of Southampton.
+# See license.txt for details.
+
+require 'lib/acts_as_site_entity'
+require 'lib/acts_as_contributable'
+
+class Service < ActiveRecord::Base
+  acts_as_site_entity
+  acts_as_contributable
+  acts_as_structured_data
+end
+

Deleted: branches/biocat/app/views/services/_table.rhtml (2367 => 2368)


--- branches/biocat/app/views/services/_table.rhtml	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/app/views/services/_table.rhtml	2010-03-31 13:15:32 UTC (rev 2368)
@@ -1,61 +0,0 @@
-<% query ||= false -%>
-<% odd_row = false -%>
-<% unless collection.empty? %>
-
-<table class="alt_table">
-	<% for contributable in collection %>
-    <tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
-      <% cache(:controller => 'services_cache', :action ="" 'listing', :id => contributable.id) do -%>
-        <td style="width: 100px;">
-          <p style="margin-top:0; padding-top:0; text-align: center;"><b>Submitter:</b></p>
-          <center><%=h contributable.submitter_label %></center>
-        </td>
-        <td style="text-align: left;">
-
-          <p class="title">
-            <%= icon contributable.class.to_s.underscore, nil, nil, nil, '' %>
-            <% title = contributable.name %>
-            <%= link_to(query ? highlight_all(title, query) : title, service_path(contributable)) %>
-          </p>
-
-          <p style="font-size: 85%; margin-top: 0; padding-top: 0;">
-            <b>Retrieved at:</b> <%= datetime(contributable.created_at, false) %>
-          </p>
-  <% if false %>										
-          
-          <p style="font-size:85%;"><b>License: </b><%= license_link contributable.license.to_s %></p>
-          
-          <div class="desc" style="font-size: 85%;">
-            <% if contributable.description and contributable.description.length > 0 %>
-              <% desc = truncate(strip_html(contributable.description), 500) %>
-              <%= query ? highlight_all(desc, query) : desc %>
-            <% else -%>
-              <span class="none_text">No description</span>	
-            <% end %>
-          </div>
-          
-          <p style="font-size: 85%;">
-            <a href="" algorithm_path(contributable) + '#ratings' -%>"><b>Rating: </b><%= number_with_precision(contributable.rating, 1) %> / 5 (<%= pluralize contributable.ratings_count, 'rating' %>)</a> |
-            <a href="" algorithm_path(contributable) + '#comments' -%>"><b>Comments: </b><%= contributable.comments_count %></a> |
-            <b>Viewed internally:</b> <%= pluralize Viewing.total_site_viewings_count_for_contribution(contributable.contribution.id), "time" %>
-          </p>
-          
-          <% unless (tags = contributable.tags).empty? %>
-            <a href="" algorithm_path(contributable) + '#tags' -%>"><p style="font-size: 85%;"><b>Tags:</b></p></a>
-            <div style="display:inline;" class="tags_onesize"><%= tag_cloud_from_collection tags, true %></div>
-          <% else %>
-            <p style="font-size: 85%;"><i>This Algorithm has no tags!</i></p>
-          <% end %>	
-<% end %>
-        </td>
-      <% end %>
-        
-        <td class="actions" style="width: 80px;">
-          <%= icon "show", service_path(contributable), nil, nil, "View" %>
-        </td>
-    </tr>
-	<% end %>
-</table>
-
-<% end %>
-

Copied: branches/biocat/app/views/services/_table.rhtml (from rev 2363, branches/biocat/app/views/bio_cat_services/_table.rhtml) (0 => 2368)


--- branches/biocat/app/views/services/_table.rhtml	                        (rev 0)
+++ branches/biocat/app/views/services/_table.rhtml	2010-03-31 13:15:32 UTC (rev 2368)
@@ -0,0 +1,35 @@
+<% query ||= false -%>
+<% odd_row = false -%>
+<% unless collection.empty? %>
+
+<table class="alt_table">
+	<% for contributable in collection %>
+    <tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" %>">
+      <% cache(:controller => 'services_cache', :action ="" 'listing', :id => contributable.id) do -%>
+        <td style="width: 100px;">
+          <p style="margin-top:0; padding-top:0; text-align: center;"><b>Submitter:</b></p>
+          <center><%= link_to contributable.submitter_label, contributable.submitter_uri %></center>
+        </td>
+        <td style="text-align: left;">
+
+          <p class="title">
+            <%= icon contributable.class.to_s.underscore, nil, nil, nil, '' %>
+            <% title = contributable.name %>
+            <%= link_to(query ? highlight_all(title, query) : title, service_path(contributable)) %>
+          </p>
+
+          <p style="font-size: 85%; margin-top: 0; padding-top: 0;">
+            <b>Retrieved at:</b> <%= datetime(contributable.created_at, false) %>
+          </p>
+        </td>
+      <% end %>
+        
+        <td class="actions" style="width: 80px;">
+          <%= icon "show", service_path(contributable), nil, nil, "View" %>
+        </td>
+    </tr>
+	<% end %>
+</table>
+
+<% end %>
+

Modified: branches/biocat/app/views/services/index.rhtml (2367 => 2368)


--- branches/biocat/app/views/services/index.rhtml	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/app/views/services/index.rhtml	2010-03-31 13:15:32 UTC (rev 2368)
@@ -2,4 +2,4 @@
 	<li><%= icon "view-all", all_services_path, nil, nil, "View All Services" %></li>
 </ul>
 
-<%= render :partial => "contributions/most_tabs", :locals => { :type => "BioCatService" } %>
+<%= render :partial => "contributions/most_tabs", :locals => { :type => "Service" } %>

Modified: branches/biocat/app/views/services/show.rhtml (2367 => 2368)


--- branches/biocat/app/views/services/show.rhtml	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/app/views/services/show.rhtml	2010-03-31 13:15:32 UTC (rev 2368)
@@ -123,7 +123,7 @@
 
 <h2>Service categories</h2>
 
-<% @contributable.bio_cat_service_categories.each do |category| %>
+<% @contributable.service_categories.each do |category| %>
 
   <table class="simple">
 
@@ -158,7 +158,7 @@
 
 <h2>Service types</h2>
 
-<% @contributable.bio_cat_service_types.each do |type| %>
+<% @contributable.service_types.each do |type| %>
 
   <table class="simple">
 
@@ -188,7 +188,7 @@
 
 <h2>Service tags</h2>
 
-<% @contributable.bio_cat_service_tags.each do |tag| %>
+<% @contributable.service_tags.each do |tag| %>
 
   <table class="simple">
 
@@ -223,7 +223,7 @@
 
 <h2>Service deployments</h2>
 
-<% @contributable.bio_cat_service_deployments.each do |deployment| %>
+<% @contributable.service_deployments.each do |deployment| %>
 
   <table class="simple">
 
@@ -289,37 +289,37 @@
 
     <tr>
       <td>Provider created_at</td>
-      <td><%=h deployment.bio_cat_service_provider.created_at -%></td>
+      <td><%=h deployment.service_provider.created_at -%></td>
     </tr>
 
     <tr>
       <td>Provider updated_at</td>
-      <td><%=h deployment.bio_cat_service_provider.updated_at -%></td>
+      <td><%=h deployment.service_provider.updated_at -%></td>
     </tr>
 
     <tr>
       <td>Provider retrieved_at</td>
-      <td><%=h deployment.bio_cat_service_provider.retrieved_at -%></td>
+      <td><%=h deployment.service_provider.retrieved_at -%></td>
     </tr>
 
     <tr>
       <td>Provider uri</td>
-      <td><%=h deployment.bio_cat_service_provider.uri -%></td>
+      <td><%=h deployment.service_provider.uri -%></td>
     </tr>
 
     <tr>
       <td>Provider name</td>
-      <td><%=h deployment.bio_cat_service_provider.name -%></td>
+      <td><%=h deployment.service_provider.name -%></td>
     </tr>
 
     <tr>
       <td>Provider description</td>
-      <td><%=h deployment.bio_cat_service_provider.description -%></td>
+      <td><%=h deployment.service_provider.description -%></td>
     </tr>
 
     <tr>
       <td>Provider created</td>
-      <td><%=h deployment.bio_cat_service_provider.created -%></td>
+      <td><%=h deployment.service_provider.created -%></td>
     </tr>
 
   </table>

Modified: branches/biocat/config/schema.d/services.xml (2367 => 2368)


--- branches/biocat/config/schema.d/services.xml	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/config/schema.d/services.xml	2010-03-31 13:15:32 UTC (rev 2368)
@@ -3,7 +3,7 @@
 
   <!-- BioCatalogue services -->
 
-  <table name="bio_cat_services">
+  <table name="services">
 
     <column type="integer"  name="contributor_id"/>
     <column type="string"   name="contributor_type"/>
@@ -41,63 +41,63 @@
     <column type="string"   name="monitor_small_symbol_url"/>
     <column type="datetime" name="monitor_last_checked"/>
 
-    <has-many target="bio_cat_service_categories"/>
-    <has-many target="bio_cat_service_types"/>
-    <has-many target="bio_cat_service_tags"/>
-    <has-many target="bio_cat_service_deployments"/>
+    <has-many target="service_categories"/>
+    <has-many target="service_types"/>
+    <has-many target="service_tags"/>
+    <has-many target="service_deployments"/>
 
   </table>
 
   <!-- BioCatalogue service categories -->
 
-  <table name="bio_cat_service_categories">
+  <table name="service_categories">
 
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
     <column type="datetime" name="retrieved_at"/>
 
-    <column type="integer"  name="bio_cat_service_id"/>
+    <column type="integer"  name="service_id"/>
     <column type="string"   name="uri"/>
     <column type="string"   name="label"/>
 
-    <belongs-to target="bio_cat_service"/>
+    <belongs-to target="service"/>
 
   </table>
     
   <!-- BioCatalogue service types -->
 
-  <table name="bio_cat_service_types">
+  <table name="service_types">
 
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
     <column type="datetime" name="retrieved_at"/>
 
-    <column type="integer"  name="bio_cat_service_id"/>
+    <column type="integer"  name="service_id"/>
     <column type="string"   name="label"/>
 
-    <belongs-to target="bio_cat_service"/>
+    <belongs-to target="service"/>
 
   </table>
 
   <!-- BioCatalogue service tags -->
 
-  <table name="bio_cat_service_tags">
+  <table name="service_tags">
 
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
     <column type="datetime" name="retrieved_at"/>
 
-    <column type="integer"  name="bio_cat_service_id"/>
+    <column type="integer"  name="service_id"/>
     <column type="string"   name="uri"/>
     <column type="string"   name="label"/>
 
-    <belongs-to target="bio_cat_service"/>
+    <belongs-to target="service"/>
 
   </table>
 
   <!-- BioCatalogue service deployments -->
 
-  <table name="bio_cat_service_deployments">
+  <table name="service_deployments">
 
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
@@ -116,17 +116,17 @@
 
     <column type="datetime" name="created"/>
 
-    <column type="integer"  name="bio_cat_service_id"/>
-    <column type="integer"  name="bio_cat_service_provider_id"/>
+    <column type="integer"  name="service_id"/>
+    <column type="integer"  name="service_provider_id"/>
 
-    <belongs-to target="bio_cat_service_provider"/>
-    <belongs-to target="bio_cat_service"/>
+    <belongs-to target="service_provider"/>
+    <belongs-to target="service"/>
 
   </table>
 
   <!-- BioCatalogue service providers -->
 
-  <table name="bio_cat_service_providers">
+  <table name="service_providers">
 
     <column type="datetime" name="created_at"/>
     <column type="datetime" name="updated_at"/>
@@ -138,7 +138,7 @@
 
     <column type="datetime" name="created"/>
 
-    <has-many target="bio_cat_service_deployments" foreign_key="bio_cat_service_provider_id"/>
+    <has-many target="service_deployments" foreign_key="service_provider_id"/>
 
   </table>
 

Modified: branches/biocat/lib/bio_catalogue_import.rb (2367 => 2368)


--- branches/biocat/lib/bio_catalogue_import.rb	2010-03-31 12:50:51 UTC (rev 2367)
+++ branches/biocat/lib/bio_catalogue_import.rb	2010-03-31 13:15:32 UTC (rev 2368)
@@ -80,7 +80,7 @@
     annotations_element = LibXML::XML::Parser.string(fetch_uri(annotations_uri)).parse.root
     monitoring_element  = LibXML::XML::Parser.string(fetch_uri(monitoring_uri)).parse.root
 
-    service = BioCatService.create(
+    service = Service.create(
         :retrieved_at       => uri_retrieved_at(service_uri),
 
         :contributor        => @federation_source,
@@ -114,26 +114,26 @@
     service.contribution.save
 
     summary_element.find('/bc:service/bc:summary/bc:category', @@biocat_ns).each do |category_element|
-      BioCatServiceCategory.create(
-          :bio_cat_service => service,
-          :retrieved_at    => uri_retrieved_at(summary_uri),
-          :uri             => get_link(category_element, '@xlink:href'),
-          :label           => get_text(category_element, 'text()'))
+      ServiceCategory.create(
+          :service       => service,
+          :retrieved_at  => uri_retrieved_at(summary_uri),
+          :uri           => get_link(category_element, '@xlink:href'),
+          :label         => get_text(category_element, 'text()'))
     end
 
     summary_element.find('/bc:service/bc:summary/bc:serviceType', @@biocat_ns).each do |category_element|
-      BioCatServiceType.create(
-          :bio_cat_service => service,
-          :retrieved_at    => uri_retrieved_at(summary_uri),
-          :label           => get_text(category_element, 'text()'))
+      ServiceType.create(
+          :service      => service,
+          :retrieved_at => uri_retrieved_at(summary_uri),
+          :label        => get_text(category_element, 'text()'))
     end
 
     summary_element.find('/bc:service/bc:summary/bc:tag', @@biocat_ns).each do |tag_element|
-      BioCatServiceTag.create(
-          :bio_cat_service => service,
-          :retrieved_at    => uri_retrieved_at(summary_uri),
-          :uri             => get_link(tag_element, '@xlink:href'),
-          :label           => get_text(tag_element, 'text()'))
+      ServiceTag.create(
+          :service      => service,
+          :retrieved_at => uri_retrieved_at(summary_uri),
+          :uri          => get_link(tag_element, '@xlink:href'),
+          :label        => get_text(tag_element, 'text()'))
     end
 
     # deployments and providers
@@ -143,10 +143,10 @@
       deployment_uri = get_link(deployment_element, '@xlink:href')
       provider_uri   = get_link(deployment_element, 'bc:serviceProvider/@xlink:href')
 
-      next if BioCatServiceDeployment.find_by_uri(deployment_uri)
+      next if ServiceDeployment.find_by_uri(deployment_uri)
 
-      if BioCatServiceProvider.find_by_uri(provider_uri).nil?
-        BioCatServiceProvider.create(
+      if ServiceProvider.find_by_uri(provider_uri).nil?
+        ServiceProvider.create(
             :uri          => provider_uri,
             :retrieved_at => uri_retrieved_at(service_uri),
             :name         => get_text(deployment_element, 'bc:serviceProvider/bc:name/text()'),
@@ -154,35 +154,27 @@
             :created      => get_text(deployment_element, 'bc:serviceProvider/dcterms:created/text()'))
       end
 
-      provider = BioCatServiceProvider.find_by_uri(provider_uri)
+      provider = ServiceProvider.find_by_uri(provider_uri)
 
-      deployment = BioCatServiceDeployment.create(
-          :bio_cat_service          => service,
-          :bio_cat_service_provider => provider,
-          :retrieved_at             => uri_retrieved_at(service_uri),
-          :uri                      => get_link(deployment_element, '@xlink:href'),
-          :endpoint                 => get_text(deployment_element, 'bc:endpoint/text()'),
-          :city                     => get_text(deployment_element, 'bc:location/bc:city/text()'),
-          :country                  => get_text(deployment_element, 'bc:location/bc:country/text()'),
-          :iso3166_country_code     => get_text(deployment_element, 'bc:location/bc:iso3166CountryCode/text()'),
-          :flag_url                 => get_link(deployment_element, 'bc:location/bc:flag/@xlink:href'),
-          :submitter_label          => get_attr(deployment_element, 'bc:submitter/@resourceName'),
-          :submitter_uri            => get_attr(deployment_element, 'bc:submitter/@xlink:href'),
-          :created                  => get_text(deployment_element, 'dcterms:created/text()'))
+      deployment = ServiceDeployment.create(
+          :service              => service,
+          :service_provider     => provider,
+          :retrieved_at         => uri_retrieved_at(service_uri),
+          :uri                  => get_link(deployment_element, '@xlink:href'),
+          :endpoint             => get_text(deployment_element, 'bc:endpoint/text()'),
+          :city                 => get_text(deployment_element, 'bc:location/bc:city/text()'),
+          :country              => get_text(deployment_element, 'bc:location/bc:country/text()'),
+          :iso3166_country_code => get_text(deployment_element, 'bc:location/bc:iso3166CountryCode/text()'),
+          :flag_url             => get_link(deployment_element, 'bc:location/bc:flag/@xlink:href'),
+          :submitter_label      => get_attr(deployment_element, 'bc:submitter/@resourceName'),
+          :submitter_uri        => get_attr(deployment_element, 'bc:submitter/@xlink:href'),
+          :created              => get_text(deployment_element, 'dcterms:created/text()'))
 
     end
   end
 
   def self.import_biocatalogue_services(uri)
 
-    Contribution.delete_all("contributable_type = 'BioCatService'")
-    BioCatService.delete_all
-    BioCatServiceCategory.delete_all
-    BioCatServiceType.delete_all
-    BioCatServiceTag.delete_all
-    BioCatServiceDeployment.delete_all
-    BioCatServiceProvider.delete_all
-
     while true
 
       doc = LibXML::XML::Parser.string(fetch_uri(uri)).parse.root

reply via email to

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