dm_panlex 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/COPYNG +674 -0
- data/README.md +37 -0
- data/doc/panlex-db-design.pdf +0 -0
- data/lib/dm_panlex/models/ap.rb +28 -0
- data/lib/dm_panlex/models/apli.rb +13 -0
- data/lib/dm_panlex/models/av.rb +13 -0
- data/lib/dm_panlex/models/cp.rb +13 -0
- data/lib/dm_panlex/models/cu.rb +16 -0
- data/lib/dm_panlex/models/df.rb +15 -0
- data/lib/dm_panlex/models/dm.rb +14 -0
- data/lib/dm_panlex/models/dn.rb +17 -0
- data/lib/dm_panlex/models/ex.rb +17 -0
- data/lib/dm_panlex/models/i1.rb +12 -0
- data/lib/dm_panlex/models/lc.rb +13 -0
- data/lib/dm_panlex/models/lv.rb +22 -0
- data/lib/dm_panlex/models/md.rb +14 -0
- data/lib/dm_panlex/models/mi.rb +12 -0
- data/lib/dm_panlex/models/mn.rb +17 -0
- data/lib/dm_panlex/models/us.rb +16 -0
- data/lib/dm_panlex/models/wc.rb +14 -0
- data/lib/dm_panlex/models/wcex.rb +12 -0
- data/lib/dm_panlex.rb +26 -0
- data/panlex.gemspec +16 -0
- data/spec/dm_panlex/models/ap_spec.rb +75 -0
- data/spec/dm_panlex/models/apli_spec.rb +27 -0
- data/spec/dm_panlex/models/av_spec.rb +24 -0
- data/spec/dm_panlex/models/cp_spec.rb +27 -0
- data/spec/dm_panlex/models/cu_spec.rb +36 -0
- data/spec/dm_panlex/models/df_spec.rb +36 -0
- data/spec/dm_panlex/models/dm_spec.rb +30 -0
- data/spec/dm_panlex/models/dn_spec.rb +36 -0
- data/spec/dm_panlex/models/ex_spec.rb +39 -0
- data/spec/dm_panlex/models/i1_spec.rb +15 -0
- data/spec/dm_panlex/models/lc_spec.rb +24 -0
- data/spec/dm_panlex/models/lv_spec.rb +60 -0
- data/spec/dm_panlex/models/md_spec.rb +33 -0
- data/spec/dm_panlex/models/mi_spec.rb +21 -0
- data/spec/dm_panlex/models/mn_spec.rb +33 -0
- data/spec/dm_panlex/models/us_spec.rb +45 -0
- data/spec/dm_panlex/models/wc_spec.rb +30 -0
- data/spec/dm_panlex/models/wcex_spec.rb +21 -0
- data/spec/spec_helper.rb +7 -0
- metadata +136 -0
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# dm\_panlex
|
2
|
+
This package is an ORM mapping of [Panlex](http://panlex.org) database using Ruby [Data mapper](http://datamapper.org).
|
3
|
+
|
4
|
+
## Differences
|
5
|
+
|
6
|
+
Following are the only differences detected between the database created by this package (tested in PostgreSQL 9.1.6 on Debian Wheezy) and actual Panlex database:
|
7
|
+
|
8
|
+
* 'ON UPDATE CASCADE' in wcex-wc 1-n relation is not implemented because, as far as I know, dm-constraints can't do that without adding 'ON DELETE CASCADE'.
|
9
|
+
* A PK for cu(lv, co, loc, vb) is added because datamapper requires each model to have a PK. That makes cu(loc) field to be a required one even if it's not in original Panlex database. It forces as well cu(loc) and cu(loc) to be String instead of Text, as in MySQL a Text can't be a PK.
|
10
|
+
* Fields with 'character' type are changed to 'character varying'.
|
11
|
+
* PostgreSQL Cluster (http://www.postgresql.org/docs/8.1/static/sql-cluster.html) are not implemented.
|
12
|
+
* Unique indexes appear as 'UNIQUE' instead of 'UNIQUE CONSTRAINT' (don't know why).
|
13
|
+
* An 'index' is created for fields that are FK and haven't any index in the original Panlex database.
|
14
|
+
* Unique indexes are named 'unique\_\*' instead of '\*\_key'
|
15
|
+
* FK are named '\*\_fk' instead of '\_fkey'.
|
16
|
+
* When showing a table schema from the database, fields that 'belong to' some other table are listed as the last ones.
|
17
|
+
|
18
|
+
## TO DO
|
19
|
+
|
20
|
+
* Solve some of the differences if it is really needed.
|
21
|
+
|
22
|
+
## LICENSE
|
23
|
+
|
24
|
+
Copyright 2013 Marc Busqué - <marc@lamarciana.com>
|
25
|
+
|
26
|
+
This program is free software: you can redistribute it and/or modify
|
27
|
+
it under the terms of the GNU General Public License as published by
|
28
|
+
the Free Software Foundation, either version 3 of the License, or
|
29
|
+
(at your option) any later version.
|
30
|
+
|
31
|
+
This program is distributed in the hope that it will be useful,
|
32
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
33
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
34
|
+
GNU General Public License for more details.
|
35
|
+
|
36
|
+
You should have received a copy of the GNU General Public License
|
37
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Ap
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'ap'
|
6
|
+
|
7
|
+
property :ap, Integer, :key => true
|
8
|
+
property :dt, Date, :field => 'dt', :required => true
|
9
|
+
property :tt, Text, :required => true, :unique_index => true
|
10
|
+
property :ur, Text
|
11
|
+
property :bn, Text
|
12
|
+
property :au, Text
|
13
|
+
property :ti, Text
|
14
|
+
property :pb, Text
|
15
|
+
property :yr, Integer, :min => -32768, :max => 32767
|
16
|
+
property :uq, Integer, :min => -32768, :max => 32767, :required => true
|
17
|
+
property :ui, Integer, :min => -32768, :max => 32767
|
18
|
+
property :ul, Text
|
19
|
+
property :ip, Text
|
20
|
+
property :co, Text
|
21
|
+
property :ad, Text
|
22
|
+
|
23
|
+
belongs_to :apli, :parent_key => :li, :child_key => :li
|
24
|
+
|
25
|
+
has n, :avs, :parent_key => :ap, :child_key => :ap, :constraint => :destroy
|
26
|
+
has n, :mns, :parent_key => :ap, :child_key => :ap
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Apli
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'apli'
|
6
|
+
|
7
|
+
property :id, Integer, :key => true
|
8
|
+
property :li, String, :length => 2, :required => true, :unique_index => true
|
9
|
+
property :pl, Text, :required => true, :unique_index => true
|
10
|
+
|
11
|
+
has n, :aps, :parent_key => :li, :child_key => :li
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Av
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'av'
|
6
|
+
|
7
|
+
property :ap, Integer, :key => true
|
8
|
+
property :lv, Integer, :key => true
|
9
|
+
|
10
|
+
belongs_to :ap, :parent_key => :ap, :child_key => :ap
|
11
|
+
belongs_to :lv, :parent_key => :lv, :child_key => :lv
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Cp
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'cp'
|
6
|
+
|
7
|
+
property :lv, Integer, :key => true, :unique_index => :cp_lv_key
|
8
|
+
property :c0, String, :length => 5, :key => true
|
9
|
+
property :c1, String, :length => 5, :required => true, :unique_index => :cp_lv_key
|
10
|
+
|
11
|
+
belongs_to :lv, :parent_key => :lv, :child_key => :lv
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Cu
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'cu'
|
6
|
+
|
7
|
+
#DataMapper requires a primary Key. It's not present in Panlex original database, but we assume it's the :cu_c0_key unique index. In MySQL a 'Text' field can't be a PK, so we change 'loc' and 'vb' to be 'String'
|
8
|
+
property :lv, Integer, :key => true, :required => true, :unique_index => [:cu_c0_key, :cu_c1_key]
|
9
|
+
property :c0, String, :length => 5, :key => true, :required => true, :unique_index => :cu_c0_key
|
10
|
+
property :c1, String, :length => 5, :required => true, :unique_index => :cu_c1_key
|
11
|
+
property :loc, String, :length => 255, :key => true, :unique_index => [:cu_c0_key, :cu_c1_key]
|
12
|
+
property :vb, String, :length => 255, :key => true, :required => true, :unique_index => [:cu_c0_key, :cu_c1_key]
|
13
|
+
|
14
|
+
belongs_to :lv, :parent_key => :lv, :child_key => :lv
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Df
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'df'
|
6
|
+
|
7
|
+
property :df, Integer, :key => true
|
8
|
+
property :mn, Integer, :required => true, :unique_index => :df_mn_key
|
9
|
+
property :lv, Integer, :required => true, :unique_index => :df_mn_key
|
10
|
+
property :tt, Text, :required => true, :unique_index => :df_mn_key
|
11
|
+
|
12
|
+
belongs_to :lv, :parent_key => :lv, :child_key => :lv
|
13
|
+
belongs_to :mn, :parent_key => :mn, :child_key => :mn
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Dm
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'dm'
|
6
|
+
|
7
|
+
property :dm, Integer, :key => true
|
8
|
+
property :mn, Integer, :required => true, :unique_index => :dm_mn_key
|
9
|
+
property :ex, Integer, :required => true, :unique_index => :dm_mn_key
|
10
|
+
|
11
|
+
belongs_to :ex, :parent_key => :ex, :child_key => :ex
|
12
|
+
belongs_to :mn, :parent_key => :mn, :child_key => :mn
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Dn
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'dn'
|
6
|
+
|
7
|
+
property :dn, Integer, :key => true
|
8
|
+
property :mn, Integer, :required => true, :unique_index => :dm_mn_ex_key, :index => true
|
9
|
+
property :ex, Integer, :required => true, :unique_index => :dm_mn_ex_key, :index => true
|
10
|
+
|
11
|
+
belongs_to :ex, :parent_key => :ex, :child_key => :ex
|
12
|
+
belongs_to :mn, :parent_key => :mn, :child_key => :mn
|
13
|
+
|
14
|
+
has n, :mds, :parent_key => :dn, :child_key => :dn
|
15
|
+
has n, :wcs, :parent_key => :dn, :child_key => :dn
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Ex
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'ex'
|
6
|
+
|
7
|
+
property :ex, Integer, :key => true
|
8
|
+
property :lv, Integer, :required => true, :unique_index => :ex_lv_tt_key, :index => true
|
9
|
+
property :tt, Text, :required => true, :unique_index => :ex_lv_tt_key, :index => true
|
10
|
+
property :td, Text, :required => true, :index => true
|
11
|
+
|
12
|
+
belongs_to :lv, :parent_key => :lv, :child_key => :lv
|
13
|
+
|
14
|
+
has n, :dms, :parent_key => :ex, :child_key => :ex
|
15
|
+
has n, :dns, :parent_key => :ex, :child_key => :ex
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class I1
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'i1'
|
6
|
+
|
7
|
+
property :iso1, String, :length => 2, :key => true
|
8
|
+
property :iso3, String, :length => 3, :required => true
|
9
|
+
|
10
|
+
belongs_to :lc, :parent_key => :lc, :child_key => :iso3
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Lc
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'lc'
|
6
|
+
|
7
|
+
property :lc, String, :length => 3, :key => true
|
8
|
+
property :tp, String, :length => 1, :required => true
|
9
|
+
|
10
|
+
has n, :i1s, :parent_key => :lc, :child_key => :iso3
|
11
|
+
has n, :lvs, :parent_key => :lc, :child_key => :lc
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Lv
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'lv'
|
6
|
+
|
7
|
+
property :lv, Integer, :key => true
|
8
|
+
property :lc, String, :length => 3, :required => true, :unique_index => :lv_lc_key
|
9
|
+
property :vc, Integer, :min => -32768, :max => 32767, :required => true, :unique_index => :lv_lc_key
|
10
|
+
property :sy, Boolean, :required => true, :default => true
|
11
|
+
property :am, Boolean, :required => true, :default => true
|
12
|
+
property :tt, Text, :required => true
|
13
|
+
|
14
|
+
belongs_to :lc, :parent_key => :lc, :child_key => :lc
|
15
|
+
|
16
|
+
has n, :avs, :parent_key => :lv, :child_key => :lv, :constraint => :destroy
|
17
|
+
has n, :cps, :parent_key => :lv, :child_key => :lv
|
18
|
+
has n, :cus, :parent_key => :lv, :child_key => :lv
|
19
|
+
has n, :dfs, :parent_key => :lv, :child_key => :lv
|
20
|
+
has n, :exs, :parent_key => :lv, :child_key => :lv
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Md
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'md'
|
6
|
+
|
7
|
+
property :md, Integer, :key => true
|
8
|
+
property :dn, Integer, :required => true, :unique_index => :md_dn_key
|
9
|
+
property :vb, Text, :required => true, :unique_index => :md_dn_key
|
10
|
+
property :vl, Text, :required => true, :unique_index => :md_dn_key
|
11
|
+
|
12
|
+
belongs_to :dn, :parent_key => :dn, :child_key => :dn
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Mn
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'mn'
|
6
|
+
|
7
|
+
property :mn, Integer, :key => true
|
8
|
+
property :ap, Integer, :required => true, :index => true
|
9
|
+
|
10
|
+
belongs_to :ap, :parent_key => :ap, :child_key => :ap
|
11
|
+
|
12
|
+
has n, :dfs, :parent_key => :mn, :child_key => :mn
|
13
|
+
has n, :dms, :parent_key => :mn, :child_key => :mn
|
14
|
+
has n, :dns, :parent_key => :mn, :child_key => :mn
|
15
|
+
has n, :mis, :parent_key => :mn, :child_key => :mn
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Us
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'us'
|
6
|
+
|
7
|
+
property :us, Integer, :key => true
|
8
|
+
property :dt, Date, :field => 'dt', :required => true
|
9
|
+
property :nm, Text
|
10
|
+
property :al, Text, :required => true, :unique_index => true
|
11
|
+
property :sm, Text
|
12
|
+
property :ht, Text
|
13
|
+
property :ok, Boolean, :required => true, :default => false
|
14
|
+
property :ad, Boolean, :required => true, :default => false
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Wc
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'wc'
|
6
|
+
|
7
|
+
property :wc, Integer, :key => true
|
8
|
+
property :dn, Integer, :required => true, :unique_index => :wc_dn_key
|
9
|
+
property :ex, Integer, :required => true, :unique_index => :wc_dn_key
|
10
|
+
|
11
|
+
belongs_to :dn, :parent_key => :dn, :child_key => :dn
|
12
|
+
belongs_to :wcex, :parent_key => :ex, :child_key => :ex
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Dm_Panlex
|
2
|
+
class Wcex
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
storage_names[:default] = 'wcex'
|
6
|
+
|
7
|
+
property :ex, Integer, :key => true
|
8
|
+
property :tt, Text, :required => true, :unique_index => true
|
9
|
+
|
10
|
+
has n, :wcs, :parent_key => :ex, :child_key => :ex
|
11
|
+
end
|
12
|
+
end
|
data/lib/dm_panlex.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
%w[
|
2
|
+
data_mapper
|
3
|
+
].each do |lib|
|
4
|
+
require lib
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'dm_panlex/models/ap'
|
8
|
+
require 'dm_panlex/models/apli'
|
9
|
+
require 'dm_panlex/models/av'
|
10
|
+
require 'dm_panlex/models/cp'
|
11
|
+
require 'dm_panlex/models/cu'
|
12
|
+
require 'dm_panlex/models/df'
|
13
|
+
require 'dm_panlex/models/dm'
|
14
|
+
require 'dm_panlex/models/dn'
|
15
|
+
require 'dm_panlex/models/ex'
|
16
|
+
require 'dm_panlex/models/i1'
|
17
|
+
require 'dm_panlex/models/lc'
|
18
|
+
require 'dm_panlex/models/lv'
|
19
|
+
require 'dm_panlex/models/md'
|
20
|
+
require 'dm_panlex/models/mi'
|
21
|
+
require 'dm_panlex/models/mn'
|
22
|
+
require 'dm_panlex/models/us'
|
23
|
+
require 'dm_panlex/models/wc'
|
24
|
+
require 'dm_panlex/models/wcex'
|
25
|
+
|
26
|
+
DataMapper.finalize
|
data/panlex.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'dm_panlex'
|
3
|
+
s.version = '0.1.0'
|
4
|
+
s.summary = 'Data mapper models for the Panlex database'
|
5
|
+
s.description = 'https://github.com/laMarciana/dm_panlex/'
|
6
|
+
s.license = ''
|
7
|
+
s.homepage = 'https://github.com/laMarciana/dm_panlex/'
|
8
|
+
s.authors = ['Marc Busqué']
|
9
|
+
s.email = 'marc@lamarciana.com'
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
|
12
|
+
s.add_runtime_dependency "data_mapper", "~>1.2"
|
13
|
+
|
14
|
+
s.add_development_dependency "rspec", "~>2.11"
|
15
|
+
s.add_development_dependency "dm-rspec", "~>0.2"
|
16
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Ap, "Approvers" do
|
5
|
+
it "has a property id (ap)" do
|
6
|
+
should have_property :ap
|
7
|
+
end
|
8
|
+
it "has a property registration date (dt)" do
|
9
|
+
should have_property :dt
|
10
|
+
end
|
11
|
+
it "has a property label (tt)" do
|
12
|
+
should have_property :tt
|
13
|
+
end
|
14
|
+
it "has a property URI (ur)" do
|
15
|
+
should have_property :ur
|
16
|
+
end
|
17
|
+
it "has a property ISBN (bn)" do
|
18
|
+
should have_property :bn
|
19
|
+
end
|
20
|
+
it "has a property author (au)" do
|
21
|
+
should have_property :au
|
22
|
+
end
|
23
|
+
it "has a property title (ti)" do
|
24
|
+
should have_property :ti
|
25
|
+
end
|
26
|
+
it "has a property monograph publisher or serial title, volume, and page range (pb)" do
|
27
|
+
should have_property :pb
|
28
|
+
end
|
29
|
+
it "has a property year of publication (yr)" do
|
30
|
+
should have_property :yr
|
31
|
+
end
|
32
|
+
it "has a property quality in editor's judgement (uq)" do
|
33
|
+
should have_property :uq
|
34
|
+
end
|
35
|
+
it "has a property numeric ID specified by the user (ui)" do
|
36
|
+
should have_property :ui
|
37
|
+
end
|
38
|
+
it "has a property miscellaneous information (ul)" do
|
39
|
+
should have_property :ul
|
40
|
+
end
|
41
|
+
it "has a property type of offered license (li)" do
|
42
|
+
should have_property :li
|
43
|
+
end
|
44
|
+
it "has a property summary of intellectual-property claim (ip)" do
|
45
|
+
should have_property :ip
|
46
|
+
end
|
47
|
+
it "has a property name of apparent intellectual-property claimant (co)" do
|
48
|
+
should have_property :co
|
49
|
+
end
|
50
|
+
it "has a property SMTP address for licensing correspondence (ad)" do
|
51
|
+
should have_property :ad
|
52
|
+
end
|
53
|
+
it "is not valid without an id" do
|
54
|
+
should validate_presence_of :ap
|
55
|
+
end
|
56
|
+
it "is not valid without a registration date" do
|
57
|
+
should validate_presence_of :dt
|
58
|
+
end
|
59
|
+
it "is not valid without a label" do
|
60
|
+
should validate_presence_of :tt
|
61
|
+
end
|
62
|
+
it "is not valid without a quality in editor's judgement" do
|
63
|
+
should validate_presence_of :uq
|
64
|
+
end
|
65
|
+
it "belongs to an approver license (apli)" do
|
66
|
+
should belong_to :apli
|
67
|
+
end
|
68
|
+
it "has many approver varieties (av)" do
|
69
|
+
should have_many :avs
|
70
|
+
end
|
71
|
+
it "has many meanings (mn)" do
|
72
|
+
should have_many :mns
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Apli, "Approver license" do
|
5
|
+
it "has a property id (id)" do
|
6
|
+
should have_property :id
|
7
|
+
end
|
8
|
+
it "has a property type code (li)" do
|
9
|
+
should have_property :li
|
10
|
+
end
|
11
|
+
it "has a property text of the type's PanLex expression (pl)" do
|
12
|
+
should have_property :pl
|
13
|
+
end
|
14
|
+
it "is not valid without an id" do
|
15
|
+
should validate_presence_of :id
|
16
|
+
end
|
17
|
+
it "is not valid without a type code" do
|
18
|
+
should validate_presence_of :li
|
19
|
+
end
|
20
|
+
it "is not valid without a text of the type's PanLex expression" do
|
21
|
+
should validate_presence_of :pl
|
22
|
+
end
|
23
|
+
it "has many approvers (ap)" do
|
24
|
+
should have_many :aps
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Av, "Approver variety" do
|
5
|
+
it "has a property approver (ap)" do
|
6
|
+
should have_property :ap
|
7
|
+
end
|
8
|
+
it "has a property variety (lv)" do
|
9
|
+
should have_property :lv
|
10
|
+
end
|
11
|
+
it "is not valid without an approver" do
|
12
|
+
should validate_presence_of :ap
|
13
|
+
end
|
14
|
+
it "is not valid without a variety" do
|
15
|
+
should validate_presence_of :lv
|
16
|
+
end
|
17
|
+
it "belongs to an approver (ap)" do
|
18
|
+
should belong_to :ap
|
19
|
+
end
|
20
|
+
it "belongs to a language variety (lv)" do
|
21
|
+
should belong_to :lv
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Cp, "Approved characters" do
|
5
|
+
it "has a property variety (lv)" do
|
6
|
+
should have_property :lv
|
7
|
+
end
|
8
|
+
it "has a property start of character range (c0)" do
|
9
|
+
should have_property :c0
|
10
|
+
end
|
11
|
+
it "has a property end of character range (c1)" do
|
12
|
+
should have_property :c1
|
13
|
+
end
|
14
|
+
it "is not valid without a variety" do
|
15
|
+
should validate_presence_of :lv
|
16
|
+
end
|
17
|
+
it "is not valid without a start of character range" do
|
18
|
+
should validate_presence_of :c0
|
19
|
+
end
|
20
|
+
it "is not valid without an end of character range" do
|
21
|
+
should validate_presence_of :c1
|
22
|
+
end
|
23
|
+
it "belongs to a language variety (lv)" do
|
24
|
+
should belong_to :lv
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Cu, "Exemplar characters" do
|
5
|
+
it "has a property variety (lv)" do
|
6
|
+
should have_property :lv
|
7
|
+
end
|
8
|
+
it "has a property start of character range (c0)" do
|
9
|
+
should have_property :c0
|
10
|
+
end
|
11
|
+
it "has a property end of character range (c1)" do
|
12
|
+
should have_property :c1
|
13
|
+
end
|
14
|
+
it "has a property locale (loc)" do
|
15
|
+
should have_property :loc
|
16
|
+
end
|
17
|
+
it "has a property variable (vb)" do
|
18
|
+
should have_property :vb
|
19
|
+
end
|
20
|
+
it "is not valid without a variety" do
|
21
|
+
should validate_presence_of :lv
|
22
|
+
end
|
23
|
+
it "is not valid without a start of character range" do
|
24
|
+
should validate_presence_of :c0
|
25
|
+
end
|
26
|
+
it "is not valid without an end of character range" do
|
27
|
+
should validate_presence_of :c1
|
28
|
+
end
|
29
|
+
it "is not valid without a variable" do
|
30
|
+
should validate_presence_of :vb
|
31
|
+
end
|
32
|
+
it "belongs to a language variety (lv)" do
|
33
|
+
should belong_to :lv
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Df, "Definition" do
|
5
|
+
it "has a property id (df)" do
|
6
|
+
should have_property :df
|
7
|
+
end
|
8
|
+
it "has a property meaning (mn)" do
|
9
|
+
should have_property :mn
|
10
|
+
end
|
11
|
+
it "has a property variety of the text (lv)" do
|
12
|
+
should have_property :lv
|
13
|
+
end
|
14
|
+
it "has a property text (tt)" do
|
15
|
+
should have_property :tt
|
16
|
+
end
|
17
|
+
it "is not valid without an id" do
|
18
|
+
should validate_presence_of :df
|
19
|
+
end
|
20
|
+
it "is not valid without a meaning" do
|
21
|
+
should validate_presence_of :mn
|
22
|
+
end
|
23
|
+
it "is not valid without a variety of the text" do
|
24
|
+
should validate_presence_of :lv
|
25
|
+
end
|
26
|
+
it "is not valid without a text" do
|
27
|
+
should validate_presence_of :tt
|
28
|
+
end
|
29
|
+
it "belongs to a language variety (lv)" do
|
30
|
+
should belong_to :lv
|
31
|
+
end
|
32
|
+
it "belongs to a meaning (mn)" do
|
33
|
+
should belong_to :mn
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Dm_Panlex
|
4
|
+
describe Dm, "Domain descriptors" do
|
5
|
+
it "has a property id (dm)" do
|
6
|
+
should have_property :dm
|
7
|
+
end
|
8
|
+
it "has a property meaning (mn)" do
|
9
|
+
should have_property :mn
|
10
|
+
end
|
11
|
+
it "has a property expression (ex)" do
|
12
|
+
should have_property :ex
|
13
|
+
end
|
14
|
+
it "is not valid without an id" do
|
15
|
+
should validate_presence_of :dm
|
16
|
+
end
|
17
|
+
it "is not valid without a meaning" do
|
18
|
+
should validate_presence_of :mn
|
19
|
+
end
|
20
|
+
it "is not valid without an expression" do
|
21
|
+
should validate_presence_of :ex
|
22
|
+
end
|
23
|
+
it "belongs to an expression (ex)" do
|
24
|
+
should belong_to :ex
|
25
|
+
end
|
26
|
+
it "belongs to a meaning (mn)" do
|
27
|
+
should belong_to :mn
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|