update on modelling

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

update on modelling

Bruce D'Arcus
Apropropos in part of today's DOI post, I've been slowly working a bit
more on a possible data model through a Rails app.  Below is the schema
definition in Ruby, with comments. I still need to figure out what to
do about titles/alternate titles, and dates. Let me know what you
think.

The core class is a ReferenceItem, which can:

        belong to a container, or a collection
        be linked to an original version or an event
        have many
                identifiers
                locators
                contributors*
                notes
                tags

The Contributor class, in turn, has a primary name, and may also have
either a name in another script, and/or a previous name (I thought
about allowing many names, but I think that's unnecessarily
complicated).

BTW, for user authentication and identification, I think I'm going to
use OpenID. Could be kind of interesting to see this picked up by bib
apps.

        http://openid.net/

Bruce

* Right now these means multiple publishers too, but that's mostly
because I can't figure out how to only have one!

class InitialSchema < ActiveRecord::Migration
   def self.up

     create_table "reference_items" do |t|
       # any citable item
       t.column "title", :string
       t.column "year", :integer, :limit => 4
       t.column "type", :string, :limit => 15
       t.column "container_id", :integer
       t.column "collection_id", :integer
       t.column "original_id", :integer
       t.column "event_id", :integer
     end

     create_table "collections" do |t|
       # any non-citable collection (subclasses of Periodical, etc.)
       t.column "title", :string
       t.column "short_title", :string
       t.column "description", :text
     end

     create_table "contributions" do |t|
       # includes roles of Author, Editor, Publisher, Translator
       t.column "reference_item_id", :integer
       t.column "contributor_id", :integer
       t.column "position", :integer
       t.column "role", :string, :limit => 15
     end

     create_table "contributors" do |t|
       # names are really difficult if you want to be international;
       # for now I've only a maximum of three specific names, stored
       # in a separate table
       t.column "name_id", :integer
       t.column "previous_name_id", :integer
       t.column "original_script_name_id", :integer
       t.column "type", :string, :limit => 15, :default => "Person"
     end

     create_table "names" do |t|
       t.column "full", :string
       t.column "given", :string
       t.column "family", :string
       t.column "prefix", :string, :limit => 10
       t.column "suffix", :string, :limit => 10
       t.column "articular", :string, :limit => 5
       # a switch to correctly handle sorting for non-Western names
       t.column "given_first", :boolean, :default => true
       t.column "changed_on", :integer
     end

     create_table "identifiers" do |t|
       # includes DOIs of course
       t.column "reference_item_id", :integer
       t.column "value", :string
       t.column "type", :string, :limit => 15
     end

     create_table "locators" do |t|
       # includes volume, issue, pages, and maybe also box, folder, etc.
       # for archival documents (Matt?)
       t.column "reference_item_id", :integer
       t.column "value", :string
       t.column "type", :string, :limit => 15
     end

     create_table "notes" do |t|
       t.column "reference_item_id", :integer
       t.column "content", :string
       t.column "type", :string, :limit => 15
     end

     create_table :tags do |t|
       t.column "reference_item_id", :integer
       t.column "name", :string
     end

   end

   def self.down
     drop_table :contributors
     drop_table :contributions
     drop_table :names
     drop_table :tags
     drop_table :reference_items
     drop_table :collections
     drop_table :notes
     drop_table :identifiers
     drop_table :locators
   end

end

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: update on modelling

David Wilson-8
Bruce,

        For someone who is just installed Rails, could give a brief description of
how or where we plug in this schema to try it out in Rails ?

David

On Wednesday 19 April 2006 11:03 pm, Bruce D'Arcus wrote:

> Apropropos in part of today's DOI post, I've been slowly working a bit
> more on a possible data model through a Rails app.  Below is the schema
> definition in Ruby, with comments. I still need to figure out what to
> do about titles/alternate titles, and dates. Let me know what you
> think.
>
> The core class is a ReferenceItem, which can:
>
> belong to a container, or a collection
> be linked to an original version or an event
> have many
> identifiers
> locators
> contributors*
> notes
> tags
>
> The Contributor class, in turn, has a primary name, and may also have
> either a name in another script, and/or a previous name (I thought
> about allowing many names, but I think that's unnecessarily
> complicated).
>
> BTW, for user authentication and identification, I think I'm going to
> use OpenID. Could be kind of interesting to see this picked up by bib
> apps.
>
> http://openid.net/
>
> Bruce
>
> * Right now these means multiple publishers too, but that's mostly
> because I can't figure out how to only have one!
>
> class InitialSchema < ActiveRecord::Migration
>    def self.up
>
>      create_table "reference_items" do |t|
>        # any citable item
>        t.column "title", :string
>        t.column "year", :integer, :limit => 4
>        t.column "type", :string, :limit => 15
>        t.column "container_id", :integer
>        t.column "collection_id", :integer
>        t.column "original_id", :integer
>        t.column "event_id", :integer
>      end
>
>      create_table "collections" do |t|
>        # any non-citable collection (subclasses of Periodical, etc.)
>        t.column "title", :string
>        t.column "short_title", :string
>        t.column "description", :text
>      end
>
>      create_table "contributions" do |t|
>        # includes roles of Author, Editor, Publisher, Translator
>        t.column "reference_item_id", :integer
>        t.column "contributor_id", :integer
>        t.column "position", :integer
>        t.column "role", :string, :limit => 15
>      end
>
>      create_table "contributors" do |t|
>        # names are really difficult if you want to be international;
>        # for now I've only a maximum of three specific names, stored
>        # in a separate table
>        t.column "name_id", :integer
>        t.column "previous_name_id", :integer
>        t.column "original_script_name_id", :integer
>        t.column "type", :string, :limit => 15, :default => "Person"
>      end
>
>      create_table "names" do |t|
>        t.column "full", :string
>        t.column "given", :string
>        t.column "family", :string
>        t.column "prefix", :string, :limit => 10
>        t.column "suffix", :string, :limit => 10
>        t.column "articular", :string, :limit => 5
>        # a switch to correctly handle sorting for non-Western names
>        t.column "given_first", :boolean, :default => true
>        t.column "changed_on", :integer
>      end
>
>      create_table "identifiers" do |t|
>        # includes DOIs of course
>        t.column "reference_item_id", :integer
>        t.column "value", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table "locators" do |t|
>        # includes volume, issue, pages, and maybe also box, folder, etc.
>        # for archival documents (Matt?)
>        t.column "reference_item_id", :integer
>        t.column "value", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table "notes" do |t|
>        t.column "reference_item_id", :integer
>        t.column "content", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table :tags do |t|
>        t.column "reference_item_id", :integer
>        t.column "name", :string
>      end
>
>    end
>
>    def self.down
>      drop_table :contributors
>      drop_table :contributions
>      drop_table :names
>      drop_table :tags
>      drop_table :reference_items
>      drop_table :collections
>      drop_table :notes
>      drop_table :identifiers
>      drop_table :locators
>    end
>
> end
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: update on modelling

Bruce D'Arcus

On Apr 19, 2006, at 8:04 PM, David Wilson wrote:

> For someone who is just installed Rails, could give a brief
> description of
> how or where we plug in this schema to try it out in Rails ?

It's not far enough along yet. I'm just at the schema + model + unit
testing phase. I think I just about have the basics worked out.

Bruce

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: update on modelling

David Wilson-7
In reply to this post by Bruce D'Arcus
Bruce,

        Do you envisage the the various types tables - locators, contributors to be
user extendable ?

I notice you have converted role (Author, Editor etc)  from a table of role
types , in earlier models,  to a field in Contributions in this model. I
think it there should be a table. Even if it was not linked into the database
it could used for the pick-list for the user interface and could be thus
extended without programming  changes.

This approach may be an option for some of the other types. The programming
via the pick-list  values enforces the range of allowed types rather than the
database model and foreign keys in tables.

David



On Wednesday 19 April 2006 11:03 pm, Bruce D'Arcus wrote:

> Apropropos in part of today's DOI post, I've been slowly working a bit
> more on a possible data model through a Rails app.  Below is the schema
> definition in Ruby, with comments. I still need to figure out what to
> do about titles/alternate titles, and dates. Let me know what you
> think.
>
> The core class is a ReferenceItem, which can:
>
> belong to a container, or a collection
> be linked to an original version or an event
> have many
> identifiers
> locators
> contributors*
> notes
> tags
>
> The Contributor class, in turn, has a primary name, and may also have
> either a name in another script, and/or a previous name (I thought
> about allowing many names, but I think that's unnecessarily
> complicated).
>
> BTW, for user authentication and identification, I think I'm going to
> use OpenID. Could be kind of interesting to see this picked up by bib
> apps.
>
> http://openid.net/
>
> Bruce
>
> * Right now these means multiple publishers too, but that's mostly
> because I can't figure out how to only have one!
>
> class InitialSchema < ActiveRecord::Migration
>    def self.up
>
>      create_table "reference_items" do |t|
>        # any citable item
>        t.column "title", :string
>        t.column "year", :integer, :limit => 4
>        t.column "type", :string, :limit => 15
>        t.column "container_id", :integer
>        t.column "collection_id", :integer
>        t.column "original_id", :integer
>        t.column "event_id", :integer
>      end
>
>      create_table "collections" do |t|
>        # any non-citable collection (subclasses of Periodical, etc.)
>        t.column "title", :string
>        t.column "short_title", :string
>        t.column "description", :text
>      end
>
>      create_table "contributions" do |t|
>        # includes roles of Author, Editor, Publisher, Translator
>        t.column "reference_item_id", :integer
>        t.column "contributor_id", :integer
>        t.column "position", :integer
>        t.column "role", :string, :limit => 15
>      end
>
>      create_table "contributors" do |t|
>        # names are really difficult if you want to be international;
>        # for now I've only a maximum of three specific names, stored
>        # in a separate table
>        t.column "name_id", :integer
>        t.column "previous_name_id", :integer
>        t.column "original_script_name_id", :integer
>        t.column "type", :string, :limit => 15, :default => "Person"
>      end
>
>      create_table "names" do |t|
>        t.column "full", :string
>        t.column "given", :string
>        t.column "family", :string
>        t.column "prefix", :string, :limit => 10
>        t.column "suffix", :string, :limit => 10
>        t.column "articular", :string, :limit => 5
>        # a switch to correctly handle sorting for non-Western names
>        t.column "given_first", :boolean, :default => true
>        t.column "changed_on", :integer
>      end
>
>      create_table "identifiers" do |t|
>        # includes DOIs of course
>        t.column "reference_item_id", :integer
>        t.column "value", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table "locators" do |t|
>        # includes volume, issue, pages, and maybe also box, folder, etc.
>        # for archival documents (Matt?)
>        t.column "reference_item_id", :integer
>        t.column "value", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table "notes" do |t|
>        t.column "reference_item_id", :integer
>        t.column "content", :string
>        t.column "type", :string, :limit => 15
>      end
>
>      create_table :tags do |t|
>        t.column "reference_item_id", :integer
>        t.column "name", :string
>      end
>
>    end
>
>    def self.down
>      drop_table :contributors
>      drop_table :contributions
>      drop_table :names
>      drop_table :tags
>      drop_table :reference_items
>      drop_table :collections
>      drop_table :notes
>      drop_table :identifiers
>      drop_table :locators
>    end
>
> end
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

--
-------------------
David N. Wilson
Co-Project Lead for the Bibliographic
OpenOffice Project
http://bibliographic.openoffice.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: update on modelling

Bruce D'Arcus
On 4/21/06, David Wilson <[hidden email]> wrote:

> I notice you have converted role (Author, Editor etc)  from a table of role
> types , in earlier models,  to a field in Contributions in this model. I
> think it there should be a table. Even if it was not linked into the database
> it could used for the pick-list for the user interface and could be thus
> extended without programming  changes.

Yeah, it's just that Rails has out-of-box for this sort of
subclassing, where by default if there's a type column, it uses that
to create the objects.

I agree ultimately it'd probably be better to store those in their own
tables. Am just not there yet.

Bruce

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]