cocina-models 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +5 -0
- data/.rubocop_todo.yml +1 -6
- data/.travis.yml +16 -4
- data/README.md +5 -0
- data/Rakefile +4 -1
- data/cocina-models.gemspec +2 -1
- data/docs/cocina-base.jsonld +24 -0
- data/docs/maps/File.json +4 -0
- data/lib/cocina/models/admin_policy.rb +3 -1
- data/lib/cocina/models/collection.rb +7 -5
- data/lib/cocina/models/dro.rb +21 -16
- data/lib/cocina/models/file.rb +2 -2
- data/lib/cocina/models/file_set.rb +2 -2
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models/vocab.rb +115 -0
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e7900ad5ccfc3731276f0fbe6e27d77094b72b309e461206c46f41ff9b9a09d
|
4
|
+
data.tar.gz: d5b1fbbd90d37daa1ac3538be417ae5ea61a8c7ec130ddbae842bb6d541fa806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc52de4683d5e72207fe93902ecf207b2dea375be47d32599f69d2b11b9147cb27287032f6d1d7e87af991471c0680c23cc59927baa70cc62cc04cfb03ff8c3
|
7
|
+
data.tar.gz: 173b81c88469efcc665af88943389a155e4c98f5de726c5087c8f44e59e313a26f5f3be22848d65ffdb269337ef987b91be328a2fd7107e1ccc16c5637b750de
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-01-13 15:35:17 -0800 using RuboCop version 0.74.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -10,11 +10,6 @@
|
|
10
10
|
Metrics/AbcSize:
|
11
11
|
Max: 18
|
12
12
|
|
13
|
-
# Offense count: 1
|
14
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
-
Metrics/MethodLength:
|
16
|
-
Max: 14
|
17
|
-
|
18
13
|
# Offense count: 2
|
19
14
|
# Configuration parameters: Max.
|
20
15
|
RSpec/ExampleLength:
|
data/.travis.yml
CHANGED
@@ -4,8 +4,20 @@ language: ruby
|
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
6
|
- 2.5.3
|
7
|
-
|
7
|
+
- 2.6.4
|
8
|
+
before_install: gem install bundler -v 2.1.4
|
8
9
|
|
9
|
-
|
10
|
-
-
|
11
|
-
-
|
10
|
+
before_script:
|
11
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
12
|
+
- chmod +x ./cc-test-reporter
|
13
|
+
- ./cc-test-reporter before-build
|
14
|
+
|
15
|
+
after_script:
|
16
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
17
|
+
|
18
|
+
notifications:
|
19
|
+
email: false
|
20
|
+
|
21
|
+
env:
|
22
|
+
global:
|
23
|
+
- CC_TEST_REPORTER_ID=882e943342bed5285a6078be9a41b7738ae7ebd17458c08414581cbece99b8e6
|
data/README.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
[![Build Status](https://travis-ci.com/sul-dlss/cocina-models.svg?branch=master)](https://travis-ci.com/sul-dlss/cocina-models)
|
2
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/472273351516ac01dce1/test_coverage)](https://codeclimate.com/github/sul-dlss/cocina-models/test_coverage)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/472273351516ac01dce1/maintainability)](https://codeclimate.com/github/sul-dlss/cocina-models/maintainability)
|
1
4
|
[![Gem Version](https://badge.fury.io/rb/cocina-models.svg)](https://badge.fury.io/rb/cocina-models)
|
2
5
|
|
3
6
|
# Cocina::Models
|
4
7
|
|
5
8
|
This is a Ruby implementation of the SDR data model (named "COCINA"). The data being modeled includes digital repository objects.
|
6
9
|
|
10
|
+
It provides a way for consumers to validate objects against models using dry-struct and dry-types gems.
|
11
|
+
|
7
12
|
This is a work in progress that will ultimately implement the full [COCINA data model](http://sul-dlss.github.io/cocina-models/). See also [architecture documentation](https://sul-dlss.github.io/taco-truck/COCINA.html#cocina-data-models--shapes).
|
data/Rakefile
CHANGED
data/cocina-models.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.summary = 'Data models for the SDR'
|
14
14
|
spec.description = 'SDR data models that can be validated'
|
15
|
-
spec.homepage = 'https://github.com/sul-dlss
|
15
|
+
spec.homepage = 'https://github.com/sul-dlss/cocina-models'
|
16
16
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
18
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
33
|
spec.add_development_dependency 'rubocop', '~> 0.74.0'
|
34
34
|
spec.add_development_dependency 'rubocop-rspec'
|
35
|
+
spec.add_development_dependency 'simplecov'
|
35
36
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"type": "@type",
|
4
|
+
"id": "@id",
|
5
|
+
"@vocab": "http://cocina.sul.stanford.edu/contexts/cocina-base.jsonld",
|
6
|
+
"cocina": "http://cocina.sul.stanford.edu/models/",
|
7
|
+
"Book": {"@id": "cocina:Book"}
|
8
|
+
"3D": {"@id": "cocina:3D"}
|
9
|
+
"Agreement": {"@id": "cocina:Agreement"}
|
10
|
+
"Document": {"@id": "cocina:Document"}
|
11
|
+
"Collection": {"@id": "cocina:Collection"}
|
12
|
+
"Fileset": {"@id": "cocina:Fileset"}
|
13
|
+
"Geo": {"@id": "cocina:Geo"}
|
14
|
+
"Image": {"@id": "cocina:Image"}
|
15
|
+
"Page": {"@id": "cocina:Page"}
|
16
|
+
"Photograph": {"@id": "cocina:Photograph"}
|
17
|
+
"Manuscript": {"@id": "cocina:Manuscript"}
|
18
|
+
"Map": {"@id": "cocina:Map"}
|
19
|
+
"Media": {"@id": "cocina:Media"}
|
20
|
+
"Track": {"@id": "cocina:Track"}
|
21
|
+
"WebarchiveBinary": {"@id": "cocina:WebarchiveBinary"}
|
22
|
+
"WebarchiveSeed": {"@id": "cocina:WebarchiveSeed"}
|
23
|
+
}
|
24
|
+
}
|
data/docs/maps/File.json
CHANGED
@@ -144,6 +144,10 @@
|
|
144
144
|
"description": "If this resource should be sent to Preservation.",
|
145
145
|
"type": "boolean"
|
146
146
|
},
|
147
|
+
"shelve": {
|
148
|
+
"description": "If this resource should be sent to Stacks.",
|
149
|
+
"type": "boolean"
|
150
|
+
},
|
147
151
|
"remediatedBy": {
|
148
152
|
"description": "The Agent (User, Group, Application, Department, other) that remediated this File in SDR.",
|
149
153
|
"type": "array",
|
@@ -6,7 +6,9 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# An admin policy object.
|
8
8
|
class AdminPolicy < Dry::Struct
|
9
|
-
TYPES =
|
9
|
+
TYPES = [
|
10
|
+
Vocab.admin_policy
|
11
|
+
].freeze
|
10
12
|
|
11
13
|
# Subschema for access concerns
|
12
14
|
class Access < Dry::Struct
|
@@ -6,11 +6,13 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# A digital repository collection. See http://sul-dlss.github.io/cocina-models/maps/Collection.json
|
8
8
|
class Collection < Dry::Struct
|
9
|
-
TYPES =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
TYPES = [
|
10
|
+
Vocab.collection,
|
11
|
+
Vocab.curated_collection,
|
12
|
+
Vocab.user_collection,
|
13
|
+
Vocab.exhibit,
|
14
|
+
Vocab.series
|
15
|
+
].freeze
|
14
16
|
|
15
17
|
# Subschema for access concerns
|
16
18
|
class Access < Dry::Struct
|
data/lib/cocina/models/dro.rb
CHANGED
@@ -6,23 +6,24 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# A digital repository object. See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
8
8
|
class DRO < Dry::Struct
|
9
|
-
TYPES =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
9
|
+
TYPES = [
|
10
|
+
Vocab.object,
|
11
|
+
Vocab.three_dimensional,
|
12
|
+
Vocab.agreement,
|
13
|
+
Vocab.book,
|
14
|
+
Vocab.document,
|
15
|
+
Vocab.geo,
|
16
|
+
Vocab.image,
|
17
|
+
Vocab.page,
|
18
|
+
Vocab.photograph,
|
19
|
+
Vocab.manuscript,
|
20
|
+
Vocab.map,
|
21
|
+
Vocab.media,
|
22
|
+
Vocab.track,
|
23
|
+
Vocab.webarchive_binary,
|
24
|
+
Vocab.webarchive_seed
|
25
25
|
].freeze
|
26
|
+
|
26
27
|
# Subschema for release tags
|
27
28
|
class ReleaseTag < Dry::Struct
|
28
29
|
attribute :to, Types::Strict::String
|
@@ -104,6 +105,10 @@ module Cocina
|
|
104
105
|
def self.from_json(json)
|
105
106
|
from_dynamic(JSON.parse(json))
|
106
107
|
end
|
108
|
+
|
109
|
+
def image?
|
110
|
+
type == Vocab.image
|
111
|
+
end
|
107
112
|
end
|
108
113
|
end
|
109
114
|
end
|
data/lib/cocina/models/file.rb
CHANGED
@@ -6,8 +6,8 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# Metadata for a file. See http://sul-dlss.github.io/cocina-models/maps/File.json
|
8
8
|
class File < Dry::Struct
|
9
|
-
TYPES =
|
10
|
-
|
9
|
+
TYPES = [
|
10
|
+
Vocab.file
|
11
11
|
].freeze
|
12
12
|
|
13
13
|
class Identification < Dry::Struct
|
@@ -6,8 +6,8 @@ module Cocina
|
|
6
6
|
module Models
|
7
7
|
# Metadata for a File Set. See http://sul-dlss.github.io/cocina-models/maps/Fileset.json
|
8
8
|
class FileSet < Dry::Struct
|
9
|
-
TYPES =
|
10
|
-
|
9
|
+
TYPES = [
|
10
|
+
Vocab.fileset
|
11
11
|
].freeze
|
12
12
|
|
13
13
|
class Identification < Dry::Struct
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
# A digital repository object. See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
6
|
+
class Vocab
|
7
|
+
ROOT = 'http://cocina.sul.stanford.edu/models/'
|
8
|
+
|
9
|
+
### Object types ###
|
10
|
+
|
11
|
+
# This is the most generic type
|
12
|
+
def self.object
|
13
|
+
"#{ROOT}object.jsonld"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.agreement
|
17
|
+
"#{ROOT}agreement.jsonld"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.document
|
21
|
+
"#{ROOT}document.jsonld"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.geo
|
25
|
+
"#{ROOT}geo.jsonld"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.page
|
29
|
+
"#{ROOT}page.jsonld"
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.photograph
|
33
|
+
"#{ROOT}photograph.jsonld"
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.manuscript
|
37
|
+
"#{ROOT}manuscript.jsonld"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.map
|
41
|
+
"#{ROOT}map.jsonld"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.track
|
45
|
+
"#{ROOT}track.jsonld"
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.webarchive_binary
|
49
|
+
"#{ROOT}webarchive-binary.jsonld"
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.webarchive_seed
|
53
|
+
"#{ROOT}webarchive-seed.jsonld"
|
54
|
+
end
|
55
|
+
|
56
|
+
# For time based media
|
57
|
+
def self.media
|
58
|
+
"#{ROOT}media.jsonld"
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.image
|
62
|
+
"#{ROOT}image.jsonld"
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.book
|
66
|
+
"#{ROOT}book.jsonld"
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.three_dimensional
|
70
|
+
"#{ROOT}3d.jsonld"
|
71
|
+
end
|
72
|
+
|
73
|
+
### File type ###
|
74
|
+
|
75
|
+
def self.file
|
76
|
+
"#{ROOT}file.jsonld"
|
77
|
+
end
|
78
|
+
|
79
|
+
### Fileset type ###
|
80
|
+
|
81
|
+
def self.fileset
|
82
|
+
"#{ROOT}fileset.jsonld"
|
83
|
+
end
|
84
|
+
|
85
|
+
### Collection types ###
|
86
|
+
|
87
|
+
# The most generic type of collection
|
88
|
+
def self.collection
|
89
|
+
"#{ROOT}collection.jsonld"
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.curated_collection
|
93
|
+
"#{ROOT}curated-collection.jsonld"
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.user_collection
|
97
|
+
"#{ROOT}user-collection.jsonld"
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.exhibit
|
101
|
+
"#{ROOT}exhibit.jsonld"
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.series
|
105
|
+
"#{ROOT}series.jsonld"
|
106
|
+
end
|
107
|
+
|
108
|
+
### Admin Policy type ###
|
109
|
+
|
110
|
+
def self.admin_policy
|
111
|
+
"#{ROOT}admin_policy.jsonld"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocina-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: SDR data models that can be validated
|
126
140
|
email:
|
127
141
|
- jcoyne@justincoyne.com
|
@@ -129,6 +143,7 @@ executables: []
|
|
129
143
|
extensions: []
|
130
144
|
extra_rdoc_files: []
|
131
145
|
files:
|
146
|
+
- ".github/pull_request_template.md"
|
132
147
|
- ".gitignore"
|
133
148
|
- ".rspec"
|
134
149
|
- ".rubocop.yml"
|
@@ -142,6 +157,7 @@ files:
|
|
142
157
|
- cocina-models.gemspec
|
143
158
|
- docs/README.md
|
144
159
|
- docs/_config.yml
|
160
|
+
- docs/cocina-base.jsonld
|
145
161
|
- docs/maps/Agent.json
|
146
162
|
- docs/maps/Collection.json
|
147
163
|
- docs/maps/DRO.json
|
@@ -161,7 +177,8 @@ files:
|
|
161
177
|
- lib/cocina/models/file_set.rb
|
162
178
|
- lib/cocina/models/types.rb
|
163
179
|
- lib/cocina/models/version.rb
|
164
|
-
|
180
|
+
- lib/cocina/models/vocab.rb
|
181
|
+
homepage: https://github.com/sul-dlss/cocina-models
|
165
182
|
licenses: []
|
166
183
|
metadata: {}
|
167
184
|
post_install_message:
|
@@ -179,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
196
|
- !ruby/object:Gem::Version
|
180
197
|
version: '0'
|
181
198
|
requirements: []
|
182
|
-
rubygems_version: 3.0.
|
199
|
+
rubygems_version: 3.0.6
|
183
200
|
signing_key:
|
184
201
|
specification_version: 4
|
185
202
|
summary: Data models for the SDR
|