annotations2triannon 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env_example +8 -1
- data/.travis.yml +1 -2
- data/LICENSE +10 -199
- data/annotations2triannon.gemspec +16 -12
- data/bin/dms.rb +103 -48
- data/bin/dms_count_annotations.sh +3 -0
- data/lib/annotations2triannon/annotation_list.rb +2 -2
- data/lib/annotations2triannon/configuration.rb +40 -8
- data/lib/annotations2triannon/iiif_collection.rb +2 -2
- data/lib/annotations2triannon/manifest.rb +4 -4
- data/lib/annotations2triannon/open_annotation.rb +26 -11
- data/lib/annotations2triannon/open_annotation_harvest.rb +15 -19
- data/lib/requires.rb +3 -3
- metadata +68 -43
- data/bin/console +0 -5
- data/bin/ctags.rb +0 -8
- data/lib/rdf/vocab/Content.rb +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be627ca60bec60df86a137d16aed45a25eec9ae1
|
4
|
+
data.tar.gz: ca5c4ff884b7b1f4e9776ae714ddc0b8bd298bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327eafd4f8dbe39604c0d64335c7478fc27e84cdf34e271e4678dc4bc080962f1cc7bd787bc2fa6e768e013ef0aabe663ee8a076d60b8f4da5e9f9db8ce1298f
|
7
|
+
data.tar.gz: 74ab40714d94deb562fdf3756b1598c094e857bd53dbbc3ed25174d616e8c10825d32b1a8341dd26d537bceb185300e01772cfc45f6056ad86df182022de1c89
|
data/.env_example
CHANGED
@@ -30,6 +30,7 @@ export TRIANNON_LOG_FILE='log/triannon_client.log'
|
|
30
30
|
export TRIANNON_HOST='triannon.example.org'
|
31
31
|
export TRIANNON_USER=''
|
32
32
|
export TRIANNON_PASS=''
|
33
|
+
export TRIANNON_CONTAINER='/annotations/'
|
33
34
|
|
34
35
|
# Configure the revs database for annotations and users
|
35
36
|
export REVS_ENABLED=false
|
@@ -41,4 +42,10 @@ export REVS_DB_USER='revs'
|
|
41
42
|
export REVS_DB_PASSWORD=''
|
42
43
|
export REVS_DB_DATABASE='revs'
|
43
44
|
|
44
|
-
|
45
|
+
# Redis Persistence - based on https://github.com/redis/redis-rb
|
46
|
+
# export REDIS_ENABLED=true # enable redis persistence (default = false)
|
47
|
+
export REDIS_ENABLED=false
|
48
|
+
# Set the REDIS_URL for a custom redis configuration.
|
49
|
+
# export REDIS_URL="redis://{user}:{password}@{host}:{port}/{db}"
|
50
|
+
# Leave commented to use default: 'redis://127.0.0.1:6379/0'
|
51
|
+
#export REDIS_URL=localhost
|
data/.travis.yml
CHANGED
data/LICENSE
CHANGED
@@ -1,202 +1,13 @@
|
|
1
|
-
|
2
|
-
Version 2.0, January 2004
|
3
|
-
http://www.apache.org/licenses/
|
1
|
+
Copyright 2015 The Board of Trustees of the Leland Stanford Junior University.
|
4
2
|
|
5
|
-
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
-
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
-
the copyright owner that is granting the License.
|
14
|
-
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright {yyyy} {name of copyright owner}
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
202
8
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'annotations2triannon'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.2.0'
|
6
6
|
s.licenses = ['Apache-2.0']
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
s.authors = ['Darren Weber',]
|
10
|
-
s.email = ['
|
10
|
+
s.email = ['triannon-commits@lists.stanford.edu']
|
11
11
|
|
12
|
-
s.homepage = 'https://github.com/sul-dlss/
|
12
|
+
s.homepage = 'https://github.com/sul-dlss/annotations2triannon'
|
13
13
|
s.summary = 'bulk load annotations into triannon'
|
14
14
|
s.description = 'Utilities for bulk loading annotations into triannon'
|
15
15
|
|
@@ -23,23 +23,27 @@ Gem::Specification.new do |s|
|
|
23
23
|
# Use ENV for config
|
24
24
|
s.add_dependency 'dotenv'
|
25
25
|
# RDF linked data
|
26
|
-
s.add_dependency 'addressable'
|
27
|
-
s.add_dependency 'linkeddata'
|
28
|
-
s.add_dependency 'rdf-iiif'
|
29
|
-
s.add_dependency 'rdf-vocab', '~> 0.5'
|
26
|
+
s.add_dependency 'addressable'
|
27
|
+
s.add_dependency 'linkeddata'
|
30
28
|
# HTTP client and rack cache components
|
31
29
|
s.add_dependency 'triannon-client'
|
32
|
-
s.add_dependency 'rest-client'
|
33
|
-
s.add_dependency 'rest-client-components'
|
34
|
-
s.add_dependency 'rack-cache'
|
30
|
+
s.add_dependency 'rest-client'
|
31
|
+
s.add_dependency 'rest-client-components'
|
32
|
+
s.add_dependency 'rack-cache'
|
33
|
+
# Concurrent HTTP requests
|
34
|
+
s.add_dependency 'parallel'
|
35
|
+
s.add_dependency 'ruby-progressbar'
|
35
36
|
# dalli is a memcached ruby client
|
36
|
-
s.add_dependency 'dalli'
|
37
|
+
s.add_dependency 'dalli'
|
37
38
|
# Use pry for console and debug config
|
38
39
|
s.add_dependency 'pry'
|
39
40
|
s.add_dependency 'pry-doc'
|
40
41
|
# database gems
|
41
42
|
s.add_dependency 'mysql2'
|
42
43
|
s.add_dependency 'sequel'
|
44
|
+
# cache simple RDF on redis
|
45
|
+
s.add_dependency 'hiredis'
|
46
|
+
s.add_dependency 'redis'
|
43
47
|
|
44
48
|
s.add_development_dependency 'coveralls'
|
45
49
|
s.add_development_dependency 'guard'
|
@@ -48,7 +52,7 @@ Gem::Specification.new do |s|
|
|
48
52
|
s.add_development_dependency 'rspec'
|
49
53
|
|
50
54
|
s.files = `git ls-files`.split($/)
|
51
|
-
dev_files = %w(.gitignore bin/setup.sh bin/test.sh)
|
55
|
+
dev_files = %w(.gitignore bin/console bin/ctags.rb bin/setup.sh bin/test.sh)
|
52
56
|
dev_files.each {|f| s.files.delete f }
|
53
57
|
|
54
58
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
data/bin/dms.rb
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
require 'annotations2triannon'
|
3
3
|
CONFIG = Annotations2triannon.configuration
|
4
4
|
|
5
|
+
tc = TriannonClient::TriannonClient.new
|
6
|
+
|
7
|
+
# TODO: add CLI interface for arguments to modify:
|
8
|
+
# - reporting annotation counts (default=true)
|
9
|
+
# - posting annotations to triannon (default=true)
|
10
|
+
|
11
|
+
# TODO: Abstract this DMS script into a generic CLI that takes an
|
12
|
+
# additional set of arguments to process any of the following:
|
13
|
+
# - IIIF collection URI
|
14
|
+
# - IIIF manifest URI
|
15
|
+
# - IIIF annotation list URI
|
16
|
+
|
17
|
+
|
5
18
|
|
6
19
|
# https://jirasul.stanford.edu/jira/browse/DT-5
|
7
20
|
# Annotation lists:
|
@@ -21,6 +34,83 @@ CONFIG = Annotations2triannon.configuration
|
|
21
34
|
# http://sul-reader-test.stanford.edu/m2/#6c45932d-2276-4699-9203-a9133181c2a1
|
22
35
|
|
23
36
|
|
37
|
+
def dump_json(filename, data)
|
38
|
+
File.open(filename,'w') do |f|
|
39
|
+
f.write(JSON.pretty_generate(data))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def report_anno_counts(annos, anno_count_file)
|
44
|
+
anno_count_data = {}
|
45
|
+
annos.each_pair do |m,alists|
|
46
|
+
puts "\n#{m}"
|
47
|
+
anno_count_data[m] = {}
|
48
|
+
alists.each_pair do |alist, oa_arr|
|
49
|
+
puts "\t#{alist}\t=> #{oa_arr.length}"
|
50
|
+
anno_count_data[m][alist] = oa_arr.length
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# persist the anno counts
|
54
|
+
dump_json(anno_count_file, anno_count_data)
|
55
|
+
puts "\nAnnotation counts saved to: #{anno_count_file}"
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# -----------------------------------------------------------------------
|
60
|
+
# Annotation tracking using a file
|
61
|
+
|
62
|
+
ANNO_TRACKING_FILE = File.join(CONFIG.log_path, 'dms_annotation_tracking.json')
|
63
|
+
|
64
|
+
# persist the anno_tracking data to a file
|
65
|
+
# @param anno_data [Hash]
|
66
|
+
def anno_tracking_save(anno_data)
|
67
|
+
dump_json(ANNO_TRACKING_FILE, anno_data)
|
68
|
+
puts "Annotation records updated in: #{ANNO_TRACKING_FILE}"
|
69
|
+
end
|
70
|
+
|
71
|
+
# retrieve the anno_tracking data from a file
|
72
|
+
# @returns anno_data [Hash]
|
73
|
+
def anno_tracking_load
|
74
|
+
if File.exists? ANNO_TRACKING_FILE
|
75
|
+
if File.size(ANNO_TRACKING_FILE).to_i > 0
|
76
|
+
return JSON.parse( File.read(ANNO_TRACKING_FILE) )
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
# -----------------------------------------------------------------------
|
83
|
+
# DELETE previous annotations on triannon
|
84
|
+
|
85
|
+
puts "\nAnnotation cleanup:"
|
86
|
+
anno_tracking = anno_tracking_load
|
87
|
+
anno_uris = []
|
88
|
+
anno_tracking.each_pair do |manifest_uri, anno_lists|
|
89
|
+
anno_lists.each_pair do |anno_list_uri, anno_list|
|
90
|
+
anno_list.each do |anno_data|
|
91
|
+
anno_uris << RDF::URI.new(anno_data['uri'])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
anno_ids = anno_uris.collect {|uri| tc.annotation_id(uri) }
|
96
|
+
unless anno_ids.empty?
|
97
|
+
# Find the intersection of the DMS annotations previously
|
98
|
+
# created in triannon and the current set of annotations in triannon.
|
99
|
+
graph = tc.get_annotations
|
100
|
+
uris = tc.annotation_uris(graph)
|
101
|
+
ids = uris.collect {|uri| tc.annotation_id(uri)}
|
102
|
+
annos_to_remove = anno_ids & ids # intersection of arrays
|
103
|
+
annos_to_remove.each do |id|
|
104
|
+
success = tc.delete_annotation(id)
|
105
|
+
CONFIG.logger.error("FAILURE to delete #{id}") unless success
|
106
|
+
end
|
107
|
+
end
|
108
|
+
# Clear the record of the saved annotations
|
109
|
+
anno_tracking_save({})
|
110
|
+
|
111
|
+
|
112
|
+
# -----------------------------------------------------------------------
|
113
|
+
# Loading IIIF annotations from a collection
|
24
114
|
|
25
115
|
IIIF_COLLECTION='http://dms-data.stanford.edu/data/manifests/collections/collection.json'
|
26
116
|
puts "\nCollection:\n#{IIIF_COLLECTION}"
|
@@ -36,13 +126,9 @@ annotation_lists = iiif_navigator.annotation_lists;
|
|
36
126
|
annotation_lists.each_pair {|m,alist| puts "#{m} => #{alist.length}"}
|
37
127
|
|
38
128
|
puts "\nOpen Annotation counts:"
|
129
|
+
anno_count_file = File.join(CONFIG.log_path, 'dms_annotation_counts.json')
|
39
130
|
open_annotations = iiif_navigator.open_annotations;
|
40
|
-
open_annotations
|
41
|
-
puts "\n#{m}"
|
42
|
-
alists.each_pair do |alist, oa_arr|
|
43
|
-
puts "\t#{alist}\t=> #{oa_arr.length}"
|
44
|
-
end
|
45
|
-
end
|
131
|
+
report_anno_counts(open_annotations, anno_count_file)
|
46
132
|
|
47
133
|
# Find all annotations where the body is text
|
48
134
|
text_annotations = {}
|
@@ -56,6 +142,10 @@ manifest_keys.each do |mk|
|
|
56
142
|
text_annotations[mk][ak] = anno_text_list
|
57
143
|
end
|
58
144
|
end
|
145
|
+
puts "\nOpen Annotations with ContextAsText body:"
|
146
|
+
anno_count_file = File.join(CONFIG.log_path, 'dms_annotation_text_counts.json')
|
147
|
+
report_anno_counts(text_annotations, anno_count_file)
|
148
|
+
|
59
149
|
|
60
150
|
# text_anno_list = text_annotations.values.first.values.first
|
61
151
|
# oa = text_anno_list.sample(1).first
|
@@ -68,32 +158,6 @@ end
|
|
68
158
|
# -----------------------------------------------------------------------
|
69
159
|
# POST annotations to triannon and track the triannon URIs
|
70
160
|
|
71
|
-
tc = TriannonClient::TriannonClient.new
|
72
|
-
|
73
|
-
# cleanup any prior annotations in triannon
|
74
|
-
puts "\nText Annotation cleanup:"
|
75
|
-
anno_tracking_file = File.join(CONFIG.log_path, 'dms_annotation_tracking.json')
|
76
|
-
if File.exists? anno_tracking_file
|
77
|
-
if File.size(anno_tracking_file).to_i > 0
|
78
|
-
anno_tracking = JSON.parse( File.read(anno_tracking_file) )
|
79
|
-
anno_tracking.each_pair do |manifest_uri,anno_lists|
|
80
|
-
puts "\n#{manifest_uri}"
|
81
|
-
anno_lists.each_pair do |anno_list_uri, anno_list|
|
82
|
-
puts "Removing:\t#{anno_list_uri}\t=> #{anno_list.length}"
|
83
|
-
anno_list.each do |anno_data|
|
84
|
-
success = tc.delete_annotation(anno_data['uri'])
|
85
|
-
CONFIG.logger.error("FAILURE to delete #{anno_data['uri']}") unless success
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
else
|
90
|
-
puts "Nothing to delete."
|
91
|
-
end
|
92
|
-
else
|
93
|
-
puts "Nothing to delete."
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
161
|
puts "\nText Annotation posts:"
|
98
162
|
anno_tracking = {}
|
99
163
|
text_annotations.each_pair do |m,anno_lists|
|
@@ -102,21 +166,16 @@ text_annotations.each_pair do |m,anno_lists|
|
|
102
166
|
anno_lists.each_pair do |anno_list_uri, anno_list|
|
103
167
|
puts "Posting:\t#{anno_list_uri}\t=> #{anno_list.length}"
|
104
168
|
anno_tracking[m][anno_list_uri] = []
|
105
|
-
|
169
|
+
# Allow Parallel to automatically determine the optimal concurrency model.
|
170
|
+
Parallel.each(anno_list, :progress => 'Annotations: ') do |oa|
|
106
171
|
response = tc.post_annotation(oa.to_jsonld_oa)
|
107
172
|
# parse the response into an RDF::Graph
|
108
|
-
|
109
|
-
RDF::Reader.for(:rdfxml).new(response) do |reader|
|
110
|
-
reader.each_statement {|s| g << s }
|
111
|
-
end
|
173
|
+
graph = tc.response2graph(response)
|
112
174
|
# query the graph to extract the annotation URI
|
113
|
-
|
114
|
-
|
115
|
-
if uris.length != 1
|
116
|
-
#TODO issue an error
|
117
|
-
else
|
175
|
+
uri = tc.annotation_uris(graph).first
|
176
|
+
if uri
|
118
177
|
anno_data = {
|
119
|
-
uri:
|
178
|
+
uri: uri,
|
120
179
|
chars: oa.body_contentChars.first
|
121
180
|
}
|
122
181
|
anno_tracking[m][anno_list_uri].push(anno_data)
|
@@ -124,12 +183,8 @@ text_annotations.each_pair do |m,anno_lists|
|
|
124
183
|
end
|
125
184
|
end
|
126
185
|
end
|
186
|
+
anno_tracking_save(anno_tracking)
|
127
187
|
|
128
|
-
# persist the anno_tracking data
|
129
|
-
File.open(anno_tracking_file,'w') do |f|
|
130
|
-
f.write(JSON.pretty_generate(anno_tracking))
|
131
|
-
end
|
132
|
-
puts "Annotation records saved to: #{anno_tracking_file}"
|
133
188
|
|
134
189
|
|
135
190
|
# For conversion of IIIF to OA context, see
|
@@ -12,7 +12,7 @@ module Annotations2triannon
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def iiif_annotation_list?
|
15
|
-
iri_type? RDF::
|
15
|
+
iri_type? RDF::Vocab::IIIF.AnnotationList
|
16
16
|
end
|
17
17
|
|
18
18
|
def sc_annotation_list?
|
@@ -22,7 +22,7 @@ module Annotations2triannon
|
|
22
22
|
def open_annotations
|
23
23
|
return @open_annotations unless @open_annotations.nil?
|
24
24
|
begin
|
25
|
-
oa_graphs = collect_open_annotations
|
25
|
+
oa_graphs = collect_open_annotations
|
26
26
|
oa_graphs = oa_graphs.sample(@@config.limit_openannos) if @@config.limit_openannos > 0
|
27
27
|
oa_graphs.collect {|oa| Annotations2triannon::OpenAnnotation.new(oa)}
|
28
28
|
rescue => e
|
@@ -12,15 +12,29 @@ module Annotations2triannon
|
|
12
12
|
attr_accessor :limit_annolists
|
13
13
|
attr_accessor :limit_openannos
|
14
14
|
|
15
|
+
attr_accessor :redis
|
16
|
+
|
15
17
|
def initialize
|
16
18
|
@debug = env_boolean('DEBUG')
|
19
|
+
logger_init
|
17
20
|
|
18
21
|
# In development, enable options for random sampling the data
|
19
|
-
@limit_manifests = ENV['ANNO_LIMIT_MANIFESTS'].to_i
|
20
|
-
@limit_annolists = ENV['ANNO_LIMIT_ANNOLISTS'].to_i
|
21
|
-
@limit_openannos = ENV['ANNO_LIMIT_OPENANNOS'].to_i
|
22
|
+
@limit_manifests = ENV['ANNO_LIMIT_MANIFESTS'].to_i # 0 disables sampling
|
23
|
+
@limit_annolists = ENV['ANNO_LIMIT_ANNOLISTS'].to_i # 0 disables sampling
|
24
|
+
@limit_openannos = ENV['ANNO_LIMIT_OPENANNOS'].to_i # 0 disables sampling
|
25
|
+
|
26
|
+
# Persistence options (TODO: provide options for triple stores)
|
27
|
+
redis_init
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def env_boolean(var)
|
33
|
+
# check if an ENV variable is true, use false as default
|
34
|
+
ENV[var].to_s.upcase == 'TRUE' rescue false
|
35
|
+
end
|
22
36
|
|
23
|
-
|
37
|
+
def logger_init
|
24
38
|
log_file = ENV['ANNO_LOG_FILE'] || 'annotations2triannon.log'
|
25
39
|
log_file = File.absolute_path log_file
|
26
40
|
@log_file = log_file
|
@@ -38,12 +52,30 @@ module Annotations2triannon
|
|
38
52
|
log_dev.sync = true if @debug # skip IO buffering in debug mode
|
39
53
|
@logger = Logger.new(log_dev, 'monthly')
|
40
54
|
@logger.level = @debug ? Logger::DEBUG : Logger::INFO
|
41
|
-
|
42
55
|
end
|
43
56
|
|
44
|
-
def
|
45
|
-
#
|
46
|
-
|
57
|
+
def redis_init
|
58
|
+
# https://github.com/redis/redis-rb
|
59
|
+
# storing objects in redis:
|
60
|
+
#redis.set "foo", [1, 2, 3].to_json
|
61
|
+
#JSON.parse(redis.get("foo"))
|
62
|
+
@redis = nil
|
63
|
+
@redis_url = nil
|
64
|
+
redis_enabled = env_boolean('REDIS_ENABLED')
|
65
|
+
if redis_enabled
|
66
|
+
@redis_url = ENV['REDIS_URL']
|
67
|
+
require 'hiredis'
|
68
|
+
require 'redis'
|
69
|
+
if @redis_url
|
70
|
+
# redis url takes the form "redis://{user}:{password}@{host}:{port}/{db}"
|
71
|
+
@redis = Redis.new(:url => @redis_url)
|
72
|
+
@redis.ping || puts('failed to init redis')
|
73
|
+
else
|
74
|
+
# default is 'redis://127.0.0.1:6379/0'
|
75
|
+
@redis = Redis.new
|
76
|
+
@redis.ping || puts('failed to init redis')
|
77
|
+
end
|
78
|
+
end
|
47
79
|
end
|
48
80
|
|
49
81
|
end
|
@@ -8,7 +8,7 @@ module Annotations2triannon
|
|
8
8
|
attr_reader :sc_manifests
|
9
9
|
|
10
10
|
def collection?
|
11
|
-
iri_type? RDF::
|
11
|
+
iri_type? RDF::Vocab::IIIF.Collection
|
12
12
|
end
|
13
13
|
|
14
14
|
def manifests
|
@@ -43,7 +43,7 @@ module Annotations2triannon
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def query_iiif_manifests
|
46
|
-
[nil, RDF.type, RDF::
|
46
|
+
[nil, RDF.type, RDF::Vocab::IIIF.Manifest]
|
47
47
|
end
|
48
48
|
|
49
49
|
def query_sc_manifests
|
@@ -13,7 +13,7 @@ module Annotations2triannon
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def iiif_manifest?
|
16
|
-
iri_type? RDF::
|
16
|
+
iri_type? RDF::Vocab::IIIF.Manifest
|
17
17
|
end
|
18
18
|
|
19
19
|
def sc_manifest?
|
@@ -52,7 +52,7 @@ module Annotations2triannon
|
|
52
52
|
def open_annotations
|
53
53
|
return @open_annotations unless @open_annotations.nil?
|
54
54
|
begin
|
55
|
-
oa_graphs = collect_open_annotations
|
55
|
+
oa_graphs = collect_open_annotations
|
56
56
|
oa_graphs = oa_graphs.sample(@@config.limit_openannos) if @@config.limit_openannos > 0
|
57
57
|
oa_graphs
|
58
58
|
rescue => e
|
@@ -69,9 +69,9 @@ module Annotations2triannon
|
|
69
69
|
[nil, RDF.type, RDF::SC.AnnotationList]
|
70
70
|
end
|
71
71
|
|
72
|
-
# @return a query triple to find RDF::
|
72
|
+
# @return a query triple to find RDF::Vocab::IIIF.AnnotationList
|
73
73
|
def query_iiif_annotation_list
|
74
|
-
[nil, RDF.type, RDF::
|
74
|
+
[nil, RDF.type, RDF::Vocab::IIIF.AnnotationList]
|
75
75
|
end
|
76
76
|
|
77
77
|
def collect_annotation_list_uris(q)
|
@@ -5,6 +5,7 @@ module Annotations2triannon
|
|
5
5
|
# class OpenAnnotation < Resource
|
6
6
|
class OpenAnnotation
|
7
7
|
|
8
|
+
CONTENT = RDF::Vocab::CNT
|
8
9
|
OA = RDF::Vocab::OA
|
9
10
|
OA_CONTEXT = 'http://www.w3.org/ns/oa.jsonld'
|
10
11
|
IIIF_CONTEXT = 'http://iiif.io/api/presentation/2/context.json'
|
@@ -17,7 +18,7 @@ module Annotations2triannon
|
|
17
18
|
# @param id [UUID|URI|String] to identify an open annotation
|
18
19
|
def initialize(graph=RDF::Graph.new, id=nil)
|
19
20
|
@@agent ||= Annotations2triannon::AGENT
|
20
|
-
raise
|
21
|
+
raise ArgumentError, 'graph must be RDF::Graph instance' unless graph.instance_of? RDF::Graph
|
21
22
|
if graph.empty?
|
22
23
|
# create a new open annotation
|
23
24
|
@graph = graph
|
@@ -25,7 +26,7 @@ module Annotations2triannon
|
|
25
26
|
insert_annotation
|
26
27
|
else
|
27
28
|
@graph = graph
|
28
|
-
raise
|
29
|
+
raise ArgumentError, 'graph must be an open annotation' unless is_annotation?
|
29
30
|
if id.nil?
|
30
31
|
@id = get_id
|
31
32
|
else
|
@@ -91,8 +92,26 @@ module Annotations2triannon
|
|
91
92
|
hasBody.length > 0
|
92
93
|
end
|
93
94
|
|
95
|
+
def body_graph
|
96
|
+
return @body_graph unless @body_graph.nil?
|
97
|
+
g = RDF::Graph.new
|
98
|
+
hasBody.each do |b|
|
99
|
+
@graph.query( [b, :p, :o] ).each_statement {|s| g << s}
|
100
|
+
# if b.uri?
|
101
|
+
# begin
|
102
|
+
# b_resource = Resource.new(b)
|
103
|
+
# b_resource.rdf.each_statement {|s| g << s}
|
104
|
+
# rescue
|
105
|
+
# # Nothing to be done here; the Resource#rdf method
|
106
|
+
# # will log errors in RDF retrieval
|
107
|
+
# end
|
108
|
+
# end
|
109
|
+
end
|
110
|
+
@body_graph = g
|
111
|
+
end
|
112
|
+
|
94
113
|
def body_contentAsText
|
95
|
-
body_type
|
114
|
+
body_type CONTENT.ContentAsText
|
96
115
|
end
|
97
116
|
|
98
117
|
def body_contentAsText?
|
@@ -103,10 +122,9 @@ module Annotations2triannon
|
|
103
122
|
# @return [Array<String>] body chars as Strings, in an Array (one element for each contentAsText body)
|
104
123
|
def body_contentChars
|
105
124
|
q = RDF::Query.new
|
106
|
-
q << [
|
107
|
-
q << [:body,
|
108
|
-
q
|
109
|
-
@graph.query(q).collect {|s| s.body_chars.value }
|
125
|
+
q << [:body, RDF.type, CONTENT.ContentAsText]
|
126
|
+
q << [:body, CONTENT.chars, :body_chars]
|
127
|
+
body_graph.query(q).collect {|s| s.body_chars.value }
|
110
128
|
end
|
111
129
|
|
112
130
|
def body_semanticTag
|
@@ -119,10 +137,7 @@ module Annotations2triannon
|
|
119
137
|
|
120
138
|
def body_type(uri=nil)
|
121
139
|
uri = RDF::URI.parse(uri) unless uri.nil?
|
122
|
-
|
123
|
-
q << [nil, OA.hasBody, :body]
|
124
|
-
q << [:body, RDF.type, uri]
|
125
|
-
@graph.query(q)
|
140
|
+
body_graph.query([:body, RDF.type, uri])
|
126
141
|
end
|
127
142
|
|
128
143
|
# Insert an ?o for [id, OA.motivatedBy, ?o] where ?o is 'motivation'
|
@@ -1,34 +1,30 @@
|
|
1
|
-
require 'rdf'
|
2
|
-
require 'rdf-vocab'
|
3
1
|
|
4
2
|
# Module designed to be a mixin for manifest and annotation list.
|
3
|
+
# The methods assume that the class including this module contains
|
4
|
+
# an #rdf method to access and RDF::Graph object.
|
5
5
|
module OpenAnnotationHarvest
|
6
6
|
|
7
|
-
#
|
7
|
+
# Searches rdf graph to find RDF::Vocab::OA.Annotation
|
8
8
|
# @return [Array<RDF::Graph>] for graphs of type RDF::Vocab::OA.Annotation
|
9
|
-
def collect_open_annotations
|
9
|
+
def collect_open_annotations
|
10
10
|
oa_graphs = []
|
11
11
|
q = [nil, RDF.type, RDF::Vocab::OA.Annotation]
|
12
|
-
rdf
|
13
|
-
|
14
|
-
|
15
|
-
g << [s,p,o]
|
16
|
-
g << rdf_expand_blank_nodes(o) if o.node?
|
17
|
-
end
|
18
|
-
oa_graphs << g
|
12
|
+
# 'rdf' must be a method to access an RDF::Graph object
|
13
|
+
rdf.query(q).each_subject do |s|
|
14
|
+
oa_graphs << rdf_subject_graph(s)
|
19
15
|
end
|
20
16
|
oa_graphs
|
21
17
|
end
|
22
18
|
|
23
|
-
# @param
|
24
|
-
# @return [RDF::Graph] graph
|
25
|
-
def
|
19
|
+
# @param subject [RDF::Resource] An RDF::Resource
|
20
|
+
# @return [RDF::Graph] graph for 'subject' as the ?s in ?s ?p ?o
|
21
|
+
def rdf_subject_graph(subject)
|
26
22
|
g = RDF::Graph.new
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
# 'rdf' must be a method to access an RDF::Graph object
|
24
|
+
rdf.query([subject, nil, nil]) do |s,p,o|
|
25
|
+
g << [s,p,o]
|
26
|
+
g << rdf_subject_graph(o) if o.node?
|
27
|
+
g << rdf_subject_graph(o) if o.uri?
|
32
28
|
end
|
33
29
|
g
|
34
30
|
end
|
data/lib/requires.rb
CHANGED
@@ -39,10 +39,10 @@ require 'addressable/uri'
|
|
39
39
|
require 'json'
|
40
40
|
require 'uuid'
|
41
41
|
|
42
|
+
require 'ruby-progressbar'
|
43
|
+
require 'parallel'
|
44
|
+
|
42
45
|
require 'linkeddata'
|
43
|
-
require 'rdf/iiif'
|
44
|
-
require 'rdf-vocab'
|
45
|
-
require_relative 'rdf/vocab/Content.rb'
|
46
46
|
require_relative 'rdf/vocab/sc.rb'
|
47
47
|
|
48
48
|
require 'triannon-client'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: annotations2triannon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Weber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -56,32 +56,32 @@ dependencies:
|
|
56
56
|
name: addressable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: linkeddata
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: triannon-client
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,21 +95,21 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rest-client
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
103
|
+
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rest-client-components
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,61 +123,61 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rack-cache
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: parallel
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: ruby-progressbar
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: dalli
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: '0'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: pry
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,6 +234,34 @@ dependencies:
|
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: hiredis
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: redis
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
237
265
|
- !ruby/object:Gem::Dependency
|
238
266
|
name: coveralls
|
239
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -306,11 +334,10 @@ dependencies:
|
|
306
334
|
version: '0'
|
307
335
|
description: Utilities for bulk loading annotations into triannon
|
308
336
|
email:
|
309
|
-
-
|
337
|
+
- triannon-commits@lists.stanford.edu
|
310
338
|
executables:
|
311
|
-
- console
|
312
|
-
- ctags.rb
|
313
339
|
- dms.rb
|
340
|
+
- dms_count_annotations.sh
|
314
341
|
- revs.rb
|
315
342
|
- revs_annotations2csv.sh
|
316
343
|
extensions: []
|
@@ -325,9 +352,8 @@ files:
|
|
325
352
|
- README.md
|
326
353
|
- Rakefile
|
327
354
|
- annotations2triannon.gemspec
|
328
|
-
- bin/console
|
329
|
-
- bin/ctags.rb
|
330
355
|
- bin/dms.rb
|
356
|
+
- bin/dms_count_annotations.sh
|
331
357
|
- bin/revs.rb
|
332
358
|
- bin/revs_annotations2csv.sh
|
333
359
|
- lib/annotations2triannon.rb
|
@@ -345,7 +371,6 @@ files:
|
|
345
371
|
- lib/annotations2triannon/revs_db.rb
|
346
372
|
- lib/annotations2triannon/shared_canvas_annotation_list.rb
|
347
373
|
- lib/annotations2triannon/shared_canvas_manifest.rb
|
348
|
-
- lib/rdf/vocab/Content.rb
|
349
374
|
- lib/rdf/vocab/sc.rb
|
350
375
|
- lib/requires.rb
|
351
376
|
- log/.gitignore
|
@@ -354,7 +379,7 @@ files:
|
|
354
379
|
- spec/lib/annotations2triannon/resource_spec.rb
|
355
380
|
- spec/lib/annotations2triannon_spec.rb
|
356
381
|
- spec/spec_helper.rb
|
357
|
-
homepage: https://github.com/sul-dlss/
|
382
|
+
homepage: https://github.com/sul-dlss/annotations2triannon
|
358
383
|
licenses:
|
359
384
|
- Apache-2.0
|
360
385
|
metadata: {}
|
data/bin/console
DELETED
data/bin/ctags.rb
DELETED
data/lib/rdf/vocab/Content.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
# This file generated automatically using vocab-fetch from http://www.w3.org/2011/content
|
3
|
-
require 'rdf'
|
4
|
-
module RDF
|
5
|
-
class CONTENT < RDF::StrictVocabulary("http://www.w3.org/2011/content#")
|
6
|
-
|
7
|
-
# Class definitions
|
8
|
-
term :Content,
|
9
|
-
comment: %(The content.).freeze,
|
10
|
-
label: "Content".freeze,
|
11
|
-
type: ["rdfs:Class".freeze, "owl:Class".freeze]
|
12
|
-
term :ContentAsBase64,
|
13
|
-
comment: %(The base64 encoded content \(can be used for binary content\).).freeze,
|
14
|
-
label: "Base64 content".freeze,
|
15
|
-
subClassOf: "http://www.w3.org/2011/content#Content".freeze,
|
16
|
-
type: ["rdfs:Class".freeze, "owl:Class".freeze]
|
17
|
-
term :ContentAsText,
|
18
|
-
comment: %(The text content \(can be used for text content\).).freeze,
|
19
|
-
label: "Text content".freeze,
|
20
|
-
subClassOf: "http://www.w3.org/2011/content#Content".freeze,
|
21
|
-
type: ["rdfs:Class".freeze, "owl:Class".freeze]
|
22
|
-
term :ContentAsXML,
|
23
|
-
comment: %(The XML content \(can only be used for XML-wellformed content\).).freeze,
|
24
|
-
label: "XML content".freeze,
|
25
|
-
subClassOf: "http://www.w3.org/2011/content#Content".freeze,
|
26
|
-
type: ["rdfs:Class".freeze, "owl:Class".freeze]
|
27
|
-
term :DoctypeDecl,
|
28
|
-
comment: %(The document type declaration.).freeze,
|
29
|
-
label: "Document type declaration".freeze,
|
30
|
-
type: ["rdfs:Class".freeze, "owl:Class".freeze]
|
31
|
-
|
32
|
-
# Property definitions
|
33
|
-
property :bytes,
|
34
|
-
comment: %(The Base64 encoded byte sequence of the content.).freeze,
|
35
|
-
domain: "http://www.w3.org/2011/content#ContentAsBase64".freeze,
|
36
|
-
label: "Base64 encoded byte sequence".freeze,
|
37
|
-
range: "xsd:base64Binary".freeze,
|
38
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
39
|
-
property :characterEncoding,
|
40
|
-
comment: %(The character encoding used to create a character sequence from a byte sequence or vice versa.).freeze,
|
41
|
-
domain: "http://www.w3.org/2011/content#Content".freeze,
|
42
|
-
label: "Character encoding".freeze,
|
43
|
-
range: "rdfs:Literal".freeze,
|
44
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
45
|
-
property :chars,
|
46
|
-
comment: %(The character sequence of the text content.).freeze,
|
47
|
-
domain: "http://www.w3.org/2011/content#ContentAsText".freeze,
|
48
|
-
label: "Character sequence".freeze,
|
49
|
-
range: "rdfs:Literal".freeze,
|
50
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
51
|
-
property :declaredEncoding,
|
52
|
-
comment: %(The character encoding declared in the XML declaration.).freeze,
|
53
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
54
|
-
label: "XML character encoding".freeze,
|
55
|
-
range: "rdfs:Literal".freeze,
|
56
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
57
|
-
property :doctypeName,
|
58
|
-
comment: %(The document type name.).freeze,
|
59
|
-
domain: "http://www.w3.org/2011/content#DoctypeDecl".freeze,
|
60
|
-
label: "Document type name".freeze,
|
61
|
-
range: "rdfs:Literal".freeze,
|
62
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
63
|
-
property :dtDecl,
|
64
|
-
comment: %(The document type declaration.).freeze,
|
65
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
66
|
-
label: "Document type declaration".freeze,
|
67
|
-
range: "http://www.w3.org/2011/content#DoctypeDecl".freeze,
|
68
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
69
|
-
property :internalSubset,
|
70
|
-
comment: %(The internal document type definition subset within the document type declarations.).freeze,
|
71
|
-
domain: "http://www.w3.org/2011/content#DoctypeDecl".freeze,
|
72
|
-
label: "Internal DTD subset".freeze,
|
73
|
-
range: "rdfs:Literal".freeze,
|
74
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
75
|
-
property :leadingMisc,
|
76
|
-
comment: %(The XML content preceding the document type declaration.).freeze,
|
77
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
78
|
-
label: "XML leading misc".freeze,
|
79
|
-
range: "rdfs:XMLLiteral".freeze,
|
80
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
81
|
-
property :publicId,
|
82
|
-
comment: %(The document type declarations's public identifier.).freeze,
|
83
|
-
domain: "http://www.w3.org/2011/content#DoctypeDecl".freeze,
|
84
|
-
label: "Public ID".freeze,
|
85
|
-
range: "rdfs:Literal".freeze,
|
86
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
87
|
-
property :rest,
|
88
|
-
comment: %(The XML content following the document type declaration.).freeze,
|
89
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
90
|
-
label: "XML rest".freeze,
|
91
|
-
range: "rdfs:XMLLiteral".freeze,
|
92
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
93
|
-
property :standalone,
|
94
|
-
comment: %(The standalone declaration in the XML declaration.).freeze,
|
95
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
96
|
-
label: "XML standalone document declaration".freeze,
|
97
|
-
range: "rdfs:Literal".freeze,
|
98
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
99
|
-
property :systemId,
|
100
|
-
comment: %(The document type declarations's system identifier \(typed: xsd:anyURI\)).freeze,
|
101
|
-
domain: "http://www.w3.org/2011/content#DoctypeDecl".freeze,
|
102
|
-
label: "System ID".freeze,
|
103
|
-
range: "xsd:anyURI".freeze,
|
104
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
105
|
-
property :version,
|
106
|
-
comment: %(The XML version declared in the XML declaration.).freeze,
|
107
|
-
domain: "http://www.w3.org/2011/content#ContentAsXML".freeze,
|
108
|
-
label: "XML version".freeze,
|
109
|
-
range: "rdfs:Literal".freeze,
|
110
|
-
type: ["rdf:Property".freeze, "owl:ObjectProperty".freeze]
|
111
|
-
end
|
112
|
-
end
|