hydra-works 0.16.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +59 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +2 -6
- data/.rubocop_todo.yml +5 -0
- data/.solr_wrapper +1 -0
- data/CHANGELOG.md +621 -0
- data/CODE_OF_CONDUCT.md +36 -0
- data/CONTRIBUTING.md +23 -21
- data/Gemfile +11 -3
- data/LICENSE +14 -16
- data/README.md +54 -12
- data/SUPPORT.md +5 -0
- data/hydra-works.gemspec +15 -13
- data/lib/hydra/works/characterization.rb +5 -4
- data/lib/hydra/works/characterization/fits_document.rb +348 -144
- data/lib/hydra/works/characterization/schema/audio_schema.rb +2 -0
- data/lib/hydra/works/characterization/schema/video_schema.rb +2 -0
- data/lib/hydra/works/models/concerns/collection_behavior.rb +44 -0
- data/lib/hydra/works/models/concerns/file_set_behavior.rb +20 -0
- data/lib/hydra/works/models/concerns/work_behavior.rb +54 -0
- data/lib/hydra/works/services/add_external_file_to_file_set.rb +1 -1
- data/lib/hydra/works/services/add_file_to_file_set.rb +1 -1
- data/lib/hydra/works/services/characterization_service.rb +5 -0
- data/lib/hydra/works/services/determine_original_name.rb +1 -1
- data/lib/hydra/works/version.rb +1 -1
- data/lib/hydra/works/virus_scanner.rb +18 -2
- data/spec/fixtures/fits_0.8.5_tiff.xml +78 -0
- data/spec/fixtures/fits_1.2.0_avi.xml +83 -0
- data/spec/fixtures/fits_1.2.0_jpg.xml +76 -0
- data/spec/fixtures/fits_1.2.0_mp3.xml +51 -0
- data/spec/fixtures/fits_1.2.0_mp4.xml +88 -0
- data/spec/fixtures/fits_netcdf_two_mimetypes.xml +35 -0
- data/spec/hydra/works/characterization_spec.rb +12 -5
- data/spec/hydra/works/models/collection_spec.rb +162 -0
- data/spec/hydra/works/models/concerns/file_set/contained_files_spec.rb +3 -16
- data/spec/hydra/works/models/file_set_spec.rb +47 -0
- data/spec/hydra/works/models/work_spec.rb +213 -7
- data/spec/hydra/works/services/characterization_service_spec.rb +90 -27
- data/spec/hydra/works/services/persist_derivatives_spec.rb +6 -6
- data/spec/hydra/works/virus_scanner_spec.rb +31 -0
- data/use-cases/princeton_book_use_case.md +1 -1
- metadata +77 -67
- data/.travis.yml +0 -15
- data/lib/hydra/works/characterization/fits_mapper.rb +0 -0
- data/solr/config/_rest_managed.json +0 -3
- data/solr/config/admin-extra.html +0 -31
- data/solr/config/elevate.xml +0 -36
- data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/config/protwords.txt +0 -21
- data/solr/config/schema.xml +0 -372
- data/solr/config/scripts.conf +0 -24
- data/solr/config/solrconfig.xml +0 -419
- data/solr/config/spellings.txt +0 -2
- data/solr/config/stopwords.txt +0 -58
- data/solr/config/stopwords_en.txt +0 -58
- data/solr/config/synonyms.txt +0 -31
- data/solr/config/xslt/example.xsl +0 -132
- data/solr/config/xslt/example_atom.xsl +0 -67
- data/solr/config/xslt/example_rss.xsl +0 -66
- data/solr/config/xslt/luke.xsl +0 -337
- data/spec/fixtures/eicar.txt +0 -1
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
The Samvera community is dedicated to providing a welcoming and
|
2
|
+
positive experience for all its members, whether they are at a formal
|
3
|
+
gathering, in a social setting, or taking part in activities online.
|
4
|
+
The Samvera community welcomes participation from people all over the
|
5
|
+
world and these members bring with them a wide variety of
|
6
|
+
professional, personal and social backgrounds; whatever these may be,
|
7
|
+
we treat colleagues with dignity and respect.
|
8
|
+
|
9
|
+
Community members communicate primarily in English, though for many of
|
10
|
+
them this is not their native language. We therefore strive to express
|
11
|
+
ourselves simply and clearly remembering that unnecessary use of
|
12
|
+
jargon and slang will be a barrier to understanding for many of our
|
13
|
+
colleagues. We are sensitive to the fact that the international
|
14
|
+
nature of the community means that we span many different social norms
|
15
|
+
around language and behaviour and we strive to conduct ourselves,
|
16
|
+
online and in person, in ways that are unlikely to cause offence.
|
17
|
+
|
18
|
+
Samvera conversations are often information-rich and intended to
|
19
|
+
generate discussion and debate. We discuss ideas from a standpoint of
|
20
|
+
mutual respect and reasoned argument.
|
21
|
+
|
22
|
+
Community members work together to promote a respectful and safe
|
23
|
+
community. In the event that someone’s conduct is causing offence or
|
24
|
+
distress, Samvera has a detailed
|
25
|
+
[Anti-Harassment Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
26
|
+
which can be applied to address the problem. The first step in dealing
|
27
|
+
with any serious misconduct is to contact a local meeting organizer,
|
28
|
+
the
|
29
|
+
[Samvera community helpers](https://wiki.duraspace.org/display/samvera/Samvera+Community+Helpers)
|
30
|
+
([email](mailto:helpers@samvera.org)), a community member you
|
31
|
+
trust, or the
|
32
|
+
[Samvera Steering Group](https://wiki.duraspace.org/display/samvera/Samvera+Steering+Group+membership)
|
33
|
+
immediately; at Samvera events, these people can be identified by
|
34
|
+
distinctive name badges. The
|
35
|
+
[Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
36
|
+
should be consulted for fuller details.
|
data/CONTRIBUTING.md
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
# How to Contribute
|
2
2
|
|
3
|
-
We want your help to make
|
4
|
-
|
3
|
+
We want your help to make the Samvera community great. There are a few guidelines
|
4
|
+
that we need contributors to follow so that we can have a chance of
|
5
|
+
keeping on top of things.
|
5
6
|
|
6
7
|
## Code of Conduct
|
7
8
|
|
8
|
-
The
|
9
|
-
members, whether they are at a formal gathering, in
|
10
|
-
online.
|
11
|
-
for more information.
|
9
|
+
The Samvera Community is dedicated to providing a welcoming and positive
|
10
|
+
experience for all its members, whether they are at a formal gathering, in
|
11
|
+
a social setting, or taking part in activities online. Please see our
|
12
|
+
[Code of Conduct](CODE_OF_CONDUCT.md) for more information.
|
12
13
|
|
13
|
-
##
|
14
|
+
## Samvera Community Intellectual Property Licensing and Ownership
|
14
15
|
|
15
|
-
All code contributors must have an Individual Contributor License Agreement
|
16
|
-
|
16
|
+
All code contributors must have an Individual Contributor License Agreement
|
17
|
+
(iCLA) on file with the Samvera Steering Group. If the contributor works for
|
18
|
+
an institution, the institution must have a Corporate Contributor License
|
19
|
+
Agreement (cCLA) on file.
|
17
20
|
|
18
|
-
https://wiki.duraspace.org/display/
|
21
|
+
https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
|
19
22
|
|
20
23
|
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
21
24
|
|
@@ -31,7 +34,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
31
34
|
### Reporting Issues
|
32
35
|
|
33
36
|
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
34
|
-
* Submit a [Github issue](
|
37
|
+
* Submit a [Github issue](https://github.com/samvera/hydra-works/issues/) by:
|
35
38
|
* Clearly describing the issue
|
36
39
|
* Provide a descriptive summary
|
37
40
|
* Explain the expected behavior
|
@@ -48,7 +51,7 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
48
51
|
* Please avoid working directly on the `master` branch.
|
49
52
|
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
50
53
|
* Make sure you have added sufficient tests and documentation for your changes.
|
51
|
-
* Test functionality with RSpec;
|
54
|
+
* Test functionality with RSpec; Test features / UI with Capybara.
|
52
55
|
* Run _all_ the tests to assure nothing else was accidentally broken.
|
53
56
|
|
54
57
|
### Documenting Code
|
@@ -60,15 +63,11 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
60
63
|
* If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
|
61
64
|
* This work greatly increases the usability of the code base and supports the on-ramping of new committers.
|
62
65
|
* We will all be understanding of one another's time constraints in this area.
|
63
|
-
* YARD examples:
|
64
|
-
* [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
|
65
|
-
* [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
|
66
66
|
* [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
|
67
67
|
|
68
68
|
### Committing changes
|
69
69
|
|
70
70
|
* Make commits of logical units.
|
71
|
-
* Your commit should include a high level description of your work in HISTORY.textile
|
72
71
|
* Check for unnecessary whitespace with `git diff --check` before committing.
|
73
72
|
* Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
74
73
|
* If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
|
@@ -103,6 +102,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
|
|
103
102
|
long to fit in 72 characters
|
104
103
|
```
|
105
104
|
|
105
|
+
* Make sure you have added the necessary tests for your changes.
|
106
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
107
|
+
* When you are ready to submit a pull request
|
108
|
+
|
106
109
|
### Submitting Changes
|
107
110
|
|
108
111
|
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
@@ -125,9 +128,7 @@ We adopted [Github's Pull Request Review](https://help.github.com/articles/about
|
|
125
128
|
Common checks that may occur in our repositories:
|
126
129
|
|
127
130
|
1. Travis CI - where our automated tests are running
|
128
|
-
2.
|
129
|
-
3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
130
|
-
4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
|
131
|
+
2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
|
131
132
|
|
132
133
|
If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
|
133
134
|
|
@@ -144,16 +145,17 @@ First, the person contributing the code is putting themselves out there. Be mind
|
|
144
145
|
This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
|
145
146
|
|
146
147
|
* Does the commit message explain what is going on?
|
147
|
-
* Does the code changes have tests? _Not all changes need new tests, some changes are
|
148
|
+
* Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
|
148
149
|
* Do new or changed methods, modules, and classes have documentation?
|
149
150
|
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
150
151
|
* Does the description of the new/changed specs match your understanding of what the spec is doing?
|
152
|
+
* Did the Travis tests complete successfully?
|
151
153
|
|
152
154
|
If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
|
153
155
|
|
154
156
|
# Additional Resources
|
155
157
|
|
156
158
|
* [General GitHub documentation](http://help.github.com/)
|
157
|
-
* [GitHub pull request documentation](
|
159
|
+
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
|
158
160
|
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
159
161
|
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/Gemfile
CHANGED
@@ -6,8 +6,16 @@ gemspec
|
|
6
6
|
gem 'slop', '~> 3.6' # For byebug
|
7
7
|
|
8
8
|
group :development, :test do
|
9
|
-
gem '
|
10
|
-
gem 'rubocop-rspec', require: false
|
11
|
-
gem 'pry' unless ENV['CI']
|
9
|
+
gem 'clamby'
|
12
10
|
gem 'pry-byebug' unless ENV['CI']
|
11
|
+
gem 'rubocop', require: false
|
12
|
+
gem 'rubocop-rspec', require: false
|
13
|
+
end
|
14
|
+
|
15
|
+
if ENV['RAILS_VERSION']
|
16
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
17
|
+
gem 'rails', github: 'rails/rails'
|
18
|
+
else
|
19
|
+
gem 'rails', ENV['RAILS_VERSION']
|
20
|
+
end
|
13
21
|
end
|
data/LICENSE
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
1
|
+
Copyright 2014 University of Notre Dame, Northwestern University, and Data Curation Experts
|
2
|
+
Additional copyright may be held by others, as reflected in the commit history.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,14 +1,34 @@
|
|
1
1
|
# Hydra::Works
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/hydra-works)
|
4
|
-
[](https://circleci.com/gh/samvera/hydra-works)
|
5
|
+
[](https://coveralls.io/r/samvera/hydra-works?branch=master)
|
6
|
+
[](https://codeclimate.com/github/samvera/hydra-works)
|
7
7
|
[](./LICENSE)
|
8
8
|
[](./CONTRIBUTING.md)
|
9
9
|
[](http://rubydoc.info/gems/hydra-works)
|
10
10
|
|
11
|
-
|
11
|
+
Jump in: [](http://slack.samvera.org/)
|
12
|
+
|
13
|
+
# What is hydra-works?
|
14
|
+
The Hydra::Works gem implements the [PCDM](https://github.com/duraspace/pcdm/wiki) [Works](https://github.com/duraspace/pcdm/blob/master/pcdm-ext/works.rdf) data model using ActiveFedora-based models. In addition to the models, Hydra::Works includes associated behaviors around the broad concept of describable "works" or intellectual entities, the need for which was expressed by a variety of [Samvera community use cases](https://github.com/samvera/hydra-works/tree/master/use-cases).
|
15
|
+
|
16
|
+
## Product Owner & Maintenance
|
17
|
+
|
18
|
+
hydra-works is a Core Component of the Samvera community. The documentation for
|
19
|
+
what this means can be found
|
20
|
+
[here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
21
|
+
|
22
|
+
### Product Owner
|
23
|
+
|
24
|
+
[mark-dce](https://github.com/mark-dce)
|
25
|
+
|
26
|
+
# Help
|
27
|
+
|
28
|
+
The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
|
29
|
+
|
30
|
+
# Getting Started
|
31
|
+
The PCDM Works domain model includes the following high-level entities:
|
12
32
|
|
13
33
|
* **Collection**: a *pcdm:Collection* that indirectly contains zero or more **Works** and zero or more **Collection**s
|
14
34
|
* **Work**: a *pcdm:Object* that holds zero or more **FileSets** and zero or more **Works**
|
@@ -23,7 +43,19 @@ Behaviors included in the model include:
|
|
23
43
|
* Virus checking of original files
|
24
44
|
* Full-text extraction from original files
|
25
45
|
|
26
|
-
|
46
|
+
## Dependencies
|
47
|
+
|
48
|
+
Check out the [Hydra::Derivatives README](https://github.com/samvera/hydra-derivatives#dependencies) for dependencies.
|
49
|
+
|
50
|
+
## Additional dependencies required for specs
|
51
|
+
|
52
|
+
#### ClamAV
|
53
|
+
* Mac installation
|
54
|
+
```
|
55
|
+
$ brew install clamav
|
56
|
+
$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf
|
57
|
+
$ freshclam
|
58
|
+
```
|
27
59
|
|
28
60
|
## Installation
|
29
61
|
|
@@ -73,9 +105,11 @@ page.save
|
|
73
105
|
|
74
106
|
## Virus Detection
|
75
107
|
|
76
|
-
To turn on virus detection, install clamav on your system and add the `
|
108
|
+
To turn on virus detection, install [ClamAV](https://www.clamav.net/documents/installing-clamav) on your system and add the `clamby` gem to your Gemfile
|
77
109
|
|
78
|
-
|
110
|
+
```ruby
|
111
|
+
gem 'clamby'
|
112
|
+
```
|
79
113
|
|
80
114
|
Then include the `VirusCheck` module in your `FileSet` class:
|
81
115
|
|
@@ -88,7 +122,7 @@ end
|
|
88
122
|
|
89
123
|
## Access controls
|
90
124
|
|
91
|
-
We are using [Web ACL](http://www.w3.org/wiki/WebAccessControl) as implemented by [hydra-access-controls](https://github.com/
|
125
|
+
We are using [Web ACL](http://www.w3.org/wiki/WebAccessControl) as implemented by [hydra-access-controls](https://github.com/samvera/hydra-head/tree/master/hydra-access-controls).
|
92
126
|
|
93
127
|
## How to contribute
|
94
128
|
|
@@ -108,21 +142,29 @@ rake
|
|
108
142
|
|
109
143
|
### Testing manually
|
110
144
|
|
111
|
-
If you want to run the tests manually,
|
145
|
+
If you want to run the tests manually, first run solr and FCRepo. To start solr:
|
112
146
|
|
113
147
|
```bash
|
114
|
-
solr_wrapper -d solr/config/
|
148
|
+
solr_wrapper -v -d solr/config/ -n hydra-test -p 8985
|
115
149
|
```
|
116
150
|
|
117
151
|
To start FCRepo, open another shell and run:
|
118
152
|
|
119
153
|
```bash
|
120
|
-
fcrepo_wrapper -p
|
154
|
+
fcrepo_wrapper -v -p 8986 --no-jms
|
121
155
|
```
|
156
|
+
Note you won't find these ports mentioned in this codebase, as testing behavior is inherited from ActiveFedora.
|
122
157
|
|
123
158
|
Now you’re ready to run the tests. In the directory where hydra-works
|
124
159
|
is installed, run:
|
125
160
|
|
126
161
|
```bash
|
127
|
-
rake spec
|
162
|
+
rake works:spec
|
128
163
|
```
|
164
|
+
|
165
|
+
# Acknowledgments
|
166
|
+
|
167
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the
|
168
|
+
[Samvera website](http://samvera.org/).
|
169
|
+
|
170
|
+

|
data/SUPPORT.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
If you would like to report an issue, first search [the list of issues](https://github.com/samvera/hydra-works/issues/) to see if someone else has already reported it, and then feel free to [create a new issue](https://github.com/samvera/hydra-works/issues/new).
|
2
|
+
i
|
3
|
+
If you have questions or need help, please email [the Samvera community tech list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev channel in [the Samvera community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
|
4
|
+
|
5
|
+
You can learn more about the various Samvera communication channels on the [Get in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391) wiki page.
|
data/hydra-works.gemspec
CHANGED
@@ -2,33 +2,35 @@
|
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'hydra/works/version'
|
5
|
+
DO_NOT_SHIP = ['spec/fixtures/eicar.txt']
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'hydra-works'
|
8
9
|
spec.version = Hydra::Works::VERSION
|
9
10
|
spec.authors = ['Justin Coyne']
|
10
11
|
spec.email = ['justin@curationexperts.com']
|
11
|
-
spec.summary = %q{Fundamental repository data model for
|
12
|
-
spec.description = %q{Using this data model should enable easy collaboration amongst
|
13
|
-
spec.homepage = 'https://github.com/
|
12
|
+
spec.summary = %q{Fundamental repository data model for Samvera applications}
|
13
|
+
spec.description = %q{Using this data model should enable easy collaboration amongst Samvera projects.}
|
14
|
+
spec.homepage = 'https://github.com/samvera/hydra-works'
|
14
15
|
spec.license = 'APACHE2'
|
15
16
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.files = `git ls-files -z`.split("\x0") - DO_NOT_SHIP
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
22
|
+
spec.add_dependency 'activesupport', '>= 5.2', '< 7.0'
|
23
|
+
spec.add_dependency 'hydra-derivatives', '~> 3.6'
|
24
|
+
spec.add_dependency 'hydra-file_characterization', '~> 1.0'
|
21
25
|
spec.add_dependency 'hydra-pcdm', '>= 0.9'
|
22
|
-
spec.add_dependency 'hydra-derivatives', '~> 3.0'
|
23
|
-
spec.add_dependency 'hydra-file_characterization', '~> 0.3', '>= 0.3.3'
|
24
|
-
spec.add_dependency 'om', '~> 3.1'
|
25
26
|
|
26
|
-
spec.add_development_dependency 'bundler', '
|
27
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
-
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
29
|
-
spec.add_development_dependency 'sqlite3'
|
30
|
-
spec.add_development_dependency 'solr_wrapper', '~> 0.4'
|
31
|
-
spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
|
27
|
+
spec.add_development_dependency 'bundler', '>= 1.7'
|
32
28
|
spec.add_development_dependency 'coveralls'
|
29
|
+
spec.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
|
30
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
33
31
|
spec.add_development_dependency 'rspec'
|
32
|
+
spec.add_development_dependency 'rspec-rails'
|
33
|
+
spec.add_development_dependency 'solr_wrapper', '~> 2.0'
|
34
|
+
spec.add_development_dependency 'sqlite3'
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
34
36
|
end
|
@@ -9,10 +9,11 @@ module Hydra::Works
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def mapper_defaults
|
12
|
-
{
|
13
|
-
|
14
|
-
video_audio_sample_rate: :sample_rate,
|
15
|
-
video_sample_rate: :sample_rate,
|
12
|
+
{ file_author: :creator, file_language: :language, file_mime_type: :mime_type,
|
13
|
+
audio_duration: :duration, audio_sample_rate: :sample_rate, audio_bit_rate: :bit_rate,
|
14
|
+
video_audio_sample_rate: :sample_rate, track_frame_rate: :frame_rate,
|
15
|
+
video_duration: :duration, video_sample_rate: :sample_rate, video_bit_rate: :bit_rate,
|
16
|
+
video_width: :width, video_track_width: :width, video_height: :height, video_track_height: :height }
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
@@ -1,149 +1,353 @@
|
|
1
|
-
require 'om'
|
2
|
-
|
3
1
|
module Hydra::Works::Characterization
|
4
2
|
class FitsDocument
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
3
|
+
attr_accessor :ng_xml
|
4
|
+
|
5
|
+
PROXIED_TERMS = %i(
|
6
|
+
fits_version format_label file_mime_type exif_tool_version file_size
|
7
|
+
date_modified filename original_checksum date_created rights_basis
|
8
|
+
copyright_basis copyright_note well_formed valid filestatus_message
|
9
|
+
file_title file_author page_count file_language word_count
|
10
|
+
character_count paragraph_count line_count table_count graphics_count
|
11
|
+
byte_order compression width video_width video_track_width height
|
12
|
+
video_height video_track_height color_space profile_name profile_version
|
13
|
+
orientation color_map image_producer capture_device scanning_software
|
14
|
+
exif_version gps_timestamp latitude longitude character_set markup_basis
|
15
|
+
markup_language audio_duration video_duration bit_depth audio_sample_rate
|
16
|
+
video_sample_rate video_audio_sample_rate channels data_format offset
|
17
|
+
frame_rate audio_bit_rate video_bit_rate track_frame_rate aspect_ratio
|
18
|
+
).freeze
|
19
|
+
|
20
|
+
def proxied_term_hash
|
21
|
+
PROXIED_TERMS.map { |t| [t, send(t)] }.to_h
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.terminology
|
25
|
+
struct = Struct.new(:proxied_term).new
|
26
|
+
terminology = Struct.new(:terms)
|
27
|
+
terminology.new(PROXIED_TERMS.map { |t| [t, struct] }.to_h)
|
28
|
+
end
|
29
|
+
|
30
|
+
# t.fits_version(proxy: [:fits, :fits_v])
|
31
|
+
def fits_version
|
32
|
+
ng_xml.css("fits").map { |n| n['version'].text }
|
33
|
+
end
|
34
|
+
|
35
|
+
# t.format_label(proxy: [:identification, :identity, :format_label])
|
36
|
+
def format_label
|
37
|
+
ng_xml.css("fits > identification > identity").map { |n| n['format'] }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Can't use .mime_type because it's already defined for this document so method missing won't work.
|
41
|
+
# t.file_mime_type(proxy: [:identification, :identity, :mime_type])
|
42
|
+
def file_mime_type
|
43
|
+
# Sometimes, FITS reports the mimetype attribute as a comma-separated string.
|
44
|
+
# All terms are arrays and, in this case, there is only one element, so scan the first.
|
45
|
+
ng_xml.css("fits > identification > identity").map { |n| n['mimetype'].split(',').first }
|
46
|
+
end
|
47
|
+
|
48
|
+
# t.exif_tool_version(proxy: [:identification, :identity, :tool, :exif_tool_version])
|
49
|
+
def exif_tool_version
|
50
|
+
ng_xml.css("fits > identification > identity > tool[toolname='Exiftool']").map { |n| n['toolversion'] }
|
51
|
+
end
|
52
|
+
|
53
|
+
# t.file_size(proxy: [:fileinfo, :file_size])
|
54
|
+
def file_size
|
55
|
+
ng_xml.css("fits > fileinfo > size").map(&:text)
|
56
|
+
end
|
57
|
+
|
58
|
+
# t.date_modified(proxy: [:fileinfo, :last_modified])
|
59
|
+
def date_modified
|
60
|
+
ng_xml.css("fits > fileinfo > lastmodified[toolname='Exiftool']").map(&:text)
|
61
|
+
end
|
62
|
+
|
63
|
+
# t.filename(proxy: [:fileinfo, :filename])
|
64
|
+
def filename
|
65
|
+
ng_xml.css("fits > fileinfo > filename").map(&:text)
|
66
|
+
end
|
67
|
+
|
68
|
+
# t.original_checksum(proxy: [:fileinfo, :original_checksum])
|
69
|
+
def original_checksum
|
70
|
+
ng_xml.css("fits > fileinfo > md5checksum").map(&:text)
|
71
|
+
end
|
72
|
+
|
73
|
+
# t.date_created(proxy: [:fileinfo, :date_created])
|
74
|
+
def date_created
|
75
|
+
ng_xml.css("fits > fileinfo > created[toolname='Exiftool']").map(&:text)
|
76
|
+
end
|
77
|
+
|
78
|
+
# t.rights_basis(proxy: [:fileinfo, :rights_basis])
|
79
|
+
def rights_basis
|
80
|
+
ng_xml.css("fits > fileinfo > rightsBasis").map(&:text)
|
81
|
+
end
|
82
|
+
|
83
|
+
# t.copyright_basis(proxy: [:fileinfo, :copyright_basis])
|
84
|
+
def copyright_basis
|
85
|
+
ng_xml.css("fits > fileinfo > copyrightBasis").map(&:text)
|
86
|
+
end
|
87
|
+
|
88
|
+
# t.copyright_basis(proxy: [:fileinfo, :copyright_note])
|
89
|
+
def copyright_note
|
90
|
+
ng_xml.css("fits > fileinfo > copyrightNote").map(&:text)
|
91
|
+
end
|
92
|
+
|
93
|
+
# t.well_formed(proxy: [:filestatus, :well_formed])
|
94
|
+
def well_formed
|
95
|
+
ng_xml.css("fits > filestatus > well-formed").map(&:text)
|
96
|
+
end
|
97
|
+
|
98
|
+
# t.valid(proxy: [:filestatus, :valid])
|
99
|
+
def valid
|
100
|
+
ng_xml.css("fits > filestatus > valid").map(&:text)
|
101
|
+
end
|
102
|
+
|
103
|
+
# t.filestatus_message(proxy: [:filestatus, :status_message])
|
104
|
+
def filestatus_message
|
105
|
+
ng_xml.css("fits > filestatus > message").map(&:text)
|
106
|
+
end
|
107
|
+
|
108
|
+
# t.file_title(proxy: [:metadata, :document, :file_title])
|
109
|
+
def file_title
|
110
|
+
ng_xml.css("fits > metadata > document > title").map(&:text)
|
111
|
+
end
|
112
|
+
|
113
|
+
# t.file_author(proxy: [:metadata, :document, :file_author])
|
114
|
+
def file_author
|
115
|
+
ng_xml.css("fits > metadata > document > author").map(&:text)
|
116
|
+
end
|
117
|
+
|
118
|
+
# t.file_language(proxy: [:metadata, :document, :file_language])
|
119
|
+
def file_language
|
120
|
+
ng_xml.css("fits > metadata > document > language").map(&:text)
|
121
|
+
end
|
122
|
+
|
123
|
+
# t.page_count(proxy: [:metadata, :document, :page_count])
|
124
|
+
def page_count
|
125
|
+
ng_xml.css("fits > metadata > document > pageCount").map(&:text)
|
126
|
+
end
|
127
|
+
|
128
|
+
# t.word_count(proxy: [:metadata, :document, :word_count])
|
129
|
+
def word_count
|
130
|
+
ng_xml.css("fits > metadata > document > wordCount").map(&:text)
|
131
|
+
end
|
132
|
+
|
133
|
+
# t.character_count(proxy: [:metadata, :document, :character_count])
|
134
|
+
def character_count
|
135
|
+
ng_xml.css("fits > metadata > document > characterCount").map(&:text)
|
136
|
+
end
|
137
|
+
|
138
|
+
# t.paragraph_count(proxy: [:metadata, :document, :paragraph_count])
|
139
|
+
def paragraph_count
|
140
|
+
ng_xml.css("fits > metadata > document > paragraphCount").map(&:text)
|
141
|
+
end
|
142
|
+
|
143
|
+
# t.line_count(proxy: [:metadata, :document, :line_count])
|
144
|
+
def line_count
|
145
|
+
ng_xml.css("fits > metadata > document > lineCount").map(&:text)
|
146
|
+
end
|
147
|
+
|
148
|
+
# t.table_count(proxy: [:metadata, :document, :table_count])
|
149
|
+
def table_count
|
150
|
+
ng_xml.css("fits > metadata > document > tableCount").map(&:text)
|
151
|
+
end
|
152
|
+
|
153
|
+
# t.graphics_count(proxy: [:metadata, :document, :graphics_count])
|
154
|
+
def graphics_count
|
155
|
+
ng_xml.css("fits > metadata > document > graphicsCount").map(&:text)
|
156
|
+
end
|
157
|
+
|
158
|
+
# t.byte_order(proxy: [:metadata, :image, :byte_order])
|
159
|
+
def byte_order
|
160
|
+
ng_xml.css("fits > metadata > image > byteOrder").map(&:text)
|
161
|
+
end
|
162
|
+
|
163
|
+
# t.compression(proxy: [:metadata, :image, :compression])
|
164
|
+
def compression
|
165
|
+
ng_xml.css("fits > metadata > image > compressionScheme").map(&:text)
|
166
|
+
end
|
167
|
+
|
168
|
+
# t.width(proxy: [:metadata, :image, :width])
|
169
|
+
def width
|
170
|
+
ng_xml.css("fits > metadata > image > imageWidth").map(&:text)
|
171
|
+
end
|
172
|
+
|
173
|
+
# t.height(proxy: [:metadata, :image, :height])
|
174
|
+
def height
|
175
|
+
ng_xml.css("fits > metadata > image > imageHeight").map(&:text)
|
176
|
+
end
|
177
|
+
|
178
|
+
# t.video_width(proxy: [:metadata, :video, :width])
|
179
|
+
def video_width
|
180
|
+
ng_xml.css("fits > metadata > video > imageWidth").map(&:text)
|
181
|
+
end
|
182
|
+
|
183
|
+
# t.video_height(proxy: [:metadata, :video, :height])
|
184
|
+
def video_height
|
185
|
+
ng_xml.css("fits > metadata > video > imageHeight").map(&:text)
|
186
|
+
end
|
187
|
+
|
188
|
+
# for fits 1
|
189
|
+
# t.video_track_width(proxy: [:metadata, :video, :track, :width])
|
190
|
+
def video_track_width
|
191
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > width").map(&:text)
|
192
|
+
end
|
193
|
+
|
194
|
+
# for fits 1
|
195
|
+
# t.video_track_height(proxy: [:metadata, :video, :track, :height])
|
196
|
+
def video_track_height
|
197
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > height").map(&:text)
|
198
|
+
end
|
199
|
+
|
200
|
+
# t.color_space(proxy: [:metadata, :image, :color_space])
|
201
|
+
def color_space
|
202
|
+
ng_xml.css("fits > metadata > image > colorSpace").map(&:text)
|
203
|
+
end
|
204
|
+
|
205
|
+
# t.profile_name(proxy: [:metadata, :image, :profile_name])
|
206
|
+
def profile_name
|
207
|
+
ng_xml.css("fits > metadata > image > iccProfileName").map(&:text)
|
208
|
+
end
|
209
|
+
|
210
|
+
# t.profile_version(proxy: [:metadata, :image, :profile_version])
|
211
|
+
def profile_version
|
212
|
+
ng_xml.css("fits > metadata > image > iccProfileVersion").map(&:text)
|
213
|
+
end
|
214
|
+
|
215
|
+
# t.orientation(proxy: [:metadata, :image, :orientation])
|
216
|
+
def orientation
|
217
|
+
ng_xml.css("fits > metadata > image > orientation").map(&:text)
|
218
|
+
end
|
219
|
+
|
220
|
+
# t.color_map(proxy: [:metadata, :image, :color_map])
|
221
|
+
def color_map
|
222
|
+
ng_xml.css("fits > metadata > image > colorMap").map(&:text)
|
223
|
+
end
|
224
|
+
|
225
|
+
# t.image_producer(proxy: [:metadata, :image, :image_producer])
|
226
|
+
def image_producer
|
227
|
+
ng_xml.css("fits > metadata > image > imageProducer").map(&:text)
|
228
|
+
end
|
229
|
+
|
230
|
+
# t.capture_device(proxy: [:metadata, :image, :capture_device])
|
231
|
+
def capture_device
|
232
|
+
ng_xml.css("fits > metadata > image > captureDevice").map(&:text)
|
233
|
+
end
|
234
|
+
|
235
|
+
# t.scanning_software(proxy: [:metadata, :image, :scanning_software])
|
236
|
+
def scanning_software
|
237
|
+
ng_xml.css("fits > metadata > image > scanningSoftwareName").map(&:text)
|
238
|
+
end
|
239
|
+
|
240
|
+
# t.exif_version(proxy: [:metadata, :image, :exif_version])
|
241
|
+
def exif_version
|
242
|
+
ng_xml.css("fits > metadata > image > exifVersion[toolname='Exiftool']").map(&:text)
|
243
|
+
end
|
244
|
+
|
245
|
+
# t.gps_timestamp(proxy: [:metadata, :image, :gps_timestamp])
|
246
|
+
def gps_timestamp
|
247
|
+
ng_xml.css("fits > metadata > image > gpsTimeStamp").map(&:text)
|
248
|
+
end
|
249
|
+
|
250
|
+
# t.latitude(proxy: [:metadata, :image, :latitude])
|
251
|
+
def latitude
|
252
|
+
ng_xml.css("fits > metadata > image > gpsDestLatitude").map(&:text)
|
253
|
+
end
|
254
|
+
|
255
|
+
# t.longitude(proxy: [:metadata, :image, :longitude])
|
256
|
+
def longitude
|
257
|
+
ng_xml.css("fits > metadata > image > gpsDestLongitude").map(&:text)
|
258
|
+
end
|
259
|
+
|
260
|
+
# t.character_set(proxy: [:metadata, :text, :character_set])
|
261
|
+
def character_set
|
262
|
+
ng_xml.css("fits > metadata > text > charset").map(&:text)
|
263
|
+
end
|
264
|
+
|
265
|
+
# t.markup_basis(proxy: [:metadata, :text, :markup_basis])
|
266
|
+
def markup_basis
|
267
|
+
ng_xml.css("fits > metadata > text > markupBasis").map(&:text)
|
268
|
+
end
|
269
|
+
|
270
|
+
# t.markup_language(proxy: [:metadata, :text, :markup_language])
|
271
|
+
def markup_language
|
272
|
+
ng_xml.css("fits > metadata > text > markupLanguage").map(&:text)
|
273
|
+
end
|
274
|
+
|
275
|
+
# t.audio_duration(proxy: [:metadata, :audio, :duration])
|
276
|
+
def audio_duration
|
277
|
+
ng_xml.css("fits > metadata > audio > duration").map(&:text)
|
278
|
+
end
|
279
|
+
|
280
|
+
# t.bit_depth(proxy: [:metadata, :audio, :bit_depth])
|
281
|
+
def bit_depth
|
282
|
+
ng_xml.css("fits > metadata > audio > bitDepth").map(&:text)
|
283
|
+
end
|
284
|
+
|
285
|
+
# t.audio_sample_rate(proxy: [:metadata, :audio, :sample_rate])
|
286
|
+
def audio_sample_rate
|
287
|
+
ng_xml.css("fits > metadata > audio > sampleRate").map(&:text)
|
288
|
+
end
|
289
|
+
|
290
|
+
# t.channels(proxy: [:metadata, :audio, :channels])
|
291
|
+
def channels
|
292
|
+
ng_xml.css("fits > metadata > audio > channels").map(&:text)
|
293
|
+
end
|
294
|
+
|
295
|
+
# t.data_format(proxy: [:metadata, :audio, :data_format])
|
296
|
+
def data_format
|
297
|
+
ng_xml.css("fits > metadata > audio > dataFormatType").map(&:text)
|
298
|
+
end
|
299
|
+
|
300
|
+
# t.offset(proxy: [:metadata, :audio, :offset])
|
301
|
+
def offset
|
302
|
+
ng_xml.css("fits > metadata > audio > offset").map(&:text)
|
303
|
+
end
|
304
|
+
|
305
|
+
# t.audio_bit_rate(proxy: [:metadata, :audio, :bit_rate])
|
306
|
+
def audio_bit_rate
|
307
|
+
ng_xml.css("fits > metadata > audio > bitRate").map(&:text)
|
308
|
+
end
|
309
|
+
|
310
|
+
# t.video_duration(proxy: [:metadata, :video, :duration])
|
311
|
+
def video_duration
|
312
|
+
ng_xml.css("fits > metadata > video > duration").map(&:text)
|
313
|
+
end
|
314
|
+
|
315
|
+
# t.video_sample_rate(proxy: [:metadata, :video, :sample_rate])
|
316
|
+
def video_sample_rate
|
317
|
+
ng_xml.css("fits > metadata > video > sampleRate").map(&:text)
|
318
|
+
end
|
319
|
+
|
320
|
+
# t.video_audio_sample_rate(proxy: [:metadata, :video, :audio_sample_rate])
|
321
|
+
def video_audio_sample_rate
|
322
|
+
ng_xml.css("fits > metadata > video > audioSampleRate").map(&:text)
|
323
|
+
end
|
324
|
+
|
325
|
+
# t.frame_rate(proxy: [:metadata, :video, :frame_rate])
|
326
|
+
def frame_rate
|
327
|
+
ng_xml.css("fits > metadata > video > frameRate").map(&:text)
|
328
|
+
end
|
329
|
+
|
330
|
+
# t.video_bit_rate(proxy: [:metadata, :video, :bit_rate])
|
331
|
+
def video_bit_rate
|
332
|
+
ng_xml.css("fits > metadata > video > bitRate").map(&:text)
|
333
|
+
end
|
334
|
+
|
335
|
+
# t.track_frame_rate(proxy: [:metadata, :video, :track, :frame_rate])
|
336
|
+
def track_frame_rate
|
337
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > frameRate").map(&:text)
|
338
|
+
end
|
339
|
+
|
340
|
+
# t.aspect_ratio(proxy: [:metadata, :video, :track, :aspect_ratio])
|
341
|
+
def aspect_ratio
|
342
|
+
ng_xml.css("fits > metadata > video > track[type='video'] > aspectRatio").map(&:text)
|
343
|
+
end
|
344
|
+
|
345
|
+
# Cleanup phase; ugly name to avoid collisions.
|
346
|
+
# The send construct here is required to fix up values because the setters
|
347
|
+
# are not defined, but rather applied with method_missing.
|
348
|
+
def __cleanup__
|
349
|
+
# Add any other scrubbers here; don't return any particular value
|
350
|
+
nil
|
147
351
|
end
|
148
352
|
|
149
353
|
def self.xml_template
|