triannon 0.5.6 → 0.6.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 +4 -4
- data/README.md +25 -1
- data/Rakefile +40 -10
- data/app/models/triannon/annotation.rb +3 -18
- data/app/services/triannon/ldp_to_oa_mapper.rb +6 -6
- data/app/services/triannon/solr_writer.rb +59 -4
- data/lib/generators/triannon/install_generator.rb +14 -0
- data/lib/generators/triannon/templates/rest_client.rb +7 -0
- data/lib/triannon/graph.rb +1 -44
- data/lib/triannon/jsonld_context.rb +2 -10
- data/lib/triannon/version.rb +1 -1
- metadata +60 -5
- data/app/helpers/triannon/annotations_helper.rb +0 -4
- data/lib/triannon/iiif_presentation_2_context.json +0 -72
- data/lib/triannon/oa_context_20130208.json +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56a7669bd9da9a9b2606b8e69581aefa06ba3758
|
4
|
+
data.tar.gz: 647d6a29caedcec5c4050d6fa2fcb52024e07248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1a31dcf5fd7f41d9cd07a5b516c6fda3f3c90c8ae9eeffbbdd4ee50dba79d0cedc9bc27e6af741ac7834186d8a7bc930824e508ab4cad8eafae635abd0a8f29
|
7
|
+
data.tar.gz: 646d9abc0b152ab17e852295f3e0e7c8a58d0343572f5be6de8b596be10540fb1664e27eed4881be2af19b2c9ab20306edf2c5e48c9c42baf8c4357e9ab4bcd1
|
data/README.md
CHANGED
@@ -38,12 +38,36 @@ Edit the `config/triannon.yml` file:
|
|
38
38
|
* `solr_url:` Points to the baseurl of Solr instance configured for Triannon
|
39
39
|
* `triannon_base_url:` Used as the base url for all annotations hosted by your Triannon server. Identifiers from the LDP server will be appended to this base-url. Generally something like "https://your-triannon-rails-box/annotations", as "/annotations" is added to the path by the Triannon gem
|
40
40
|
|
41
|
-
Generate the root annotations container on your LDP server
|
41
|
+
Generate the root annotations container on your LDP server:
|
42
42
|
|
43
43
|
```console
|
44
44
|
$ rake triannon:create_root_container
|
45
45
|
```
|
46
46
|
|
47
|
+
Set up caching for jsonld context documents:
|
48
|
+
|
49
|
+
* by using Rack::Cache for RestClient:
|
50
|
+
** add to Gemfile:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
gem 'rest-client', '~> 1.7.2'
|
54
|
+
gem 'rack-cache'
|
55
|
+
gem 'rest-client-components'
|
56
|
+
```
|
57
|
+
*** bundle install
|
58
|
+
** create a config/initializers/rest_client.rb
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'restclient/components'
|
62
|
+
require 'rack/cache'
|
63
|
+
RestClient.enable Rack::Cache,
|
64
|
+
metastore: "file:#{Rails.root}/tmp/rack-cache/meta",
|
65
|
+
entitystore: "file:#{Rails.root}/tmp/rack-cache/body",
|
66
|
+
default_ttl: 86400, # when to recheck, in seconds (daily = 60 x 60 x 24)
|
67
|
+
verbose: false
|
68
|
+
```
|
69
|
+
|
70
|
+
|
47
71
|
## Client Interactions with Triannon
|
48
72
|
|
49
73
|
### Get a list of annos
|
data/Rakefile
CHANGED
@@ -9,16 +9,6 @@ ZIP_URL = "https://github.com/sul-dlss/hydra-jetty/archive/fedora-4/edge.zip"
|
|
9
9
|
require 'active_support/benchmarkable'
|
10
10
|
require 'jettywrapper'
|
11
11
|
|
12
|
-
require 'rdoc/task'
|
13
|
-
|
14
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
15
|
-
rdoc.rdoc_dir = 'rdoc'
|
16
|
-
rdoc.title = 'Triannon'
|
17
|
-
rdoc.options << '--line-numbers'
|
18
|
-
rdoc.rdoc_files.include('README.rdoc')
|
19
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
20
|
-
end
|
21
|
-
|
22
12
|
require 'engine_cart/rake_task'
|
23
13
|
desc 'run the triannon specs'
|
24
14
|
task :ci => ['engine_cart:generate', 'jetty:clean'] do
|
@@ -86,4 +76,44 @@ RSpec::Core::RakeTask.new(:spec)
|
|
86
76
|
|
87
77
|
task :default => :ci
|
88
78
|
|
79
|
+
|
80
|
+
desc "Generate RDoc with YARD"
|
81
|
+
task :doc => ['doc:generate']
|
82
|
+
|
83
|
+
namespace :doc do
|
84
|
+
begin
|
85
|
+
require 'yard'
|
86
|
+
require 'yard/rake/yardoc_task'
|
87
|
+
|
88
|
+
YARD::Rake::YardocTask.new(:generate) do |yt|
|
89
|
+
yt.files = Dir.glob(File.join('app', '**', '*.rb')) +
|
90
|
+
Dir.glob(File.join('lib', '*.rb')) +
|
91
|
+
Dir.glob(File.join('lib', '**', '*.rb'))
|
92
|
+
|
93
|
+
yt.options = ['--output-dir', 'rdoc', '--readme', 'README.md', '--files', 'LICENSE',
|
94
|
+
'--protected', '--private', '--title', 'Triannon', '--exclude', 'triannon_vocab']
|
95
|
+
end
|
96
|
+
rescue LoadError
|
97
|
+
desc "Generate RDoc with YARD"
|
98
|
+
task :generate do
|
99
|
+
abort "Please install the YARD gem to generate rdoc."
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
desc "Remove generated documenation"
|
104
|
+
task :clean do
|
105
|
+
rm_r 'rdoc' if File.exists?('rdoc')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
require 'rdoc/task'
|
110
|
+
|
111
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
112
|
+
rdoc.rdoc_dir = 'rdoc'
|
113
|
+
rdoc.title = 'Triannon'
|
114
|
+
rdoc.options << '--line-numbers'
|
115
|
+
rdoc.rdoc_files.include('README.rdoc')
|
116
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
117
|
+
end
|
118
|
+
|
89
119
|
Bundler::GemHelper.install_tasks
|
@@ -69,7 +69,7 @@ module Triannon
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
# @param either a Triannon::Graph or RDF::Graph object
|
72
|
+
# @param g either a Triannon::Graph or RDF::Graph object
|
73
73
|
def graph= g
|
74
74
|
if g.is_a? Triannon::Graph
|
75
75
|
@graph = g
|
@@ -102,8 +102,7 @@ protected
|
|
102
102
|
|
103
103
|
# Add annotation to Solr as a Solr document
|
104
104
|
def solr_save
|
105
|
-
|
106
|
-
solr_writer.add(solr_hash) if solr_hash && solr_hash.size > 0
|
105
|
+
solr_writer.write(graph) if graph && graph.id_as_url && !graph.id_as_url.empty?
|
107
106
|
end
|
108
107
|
|
109
108
|
# Delete annotation from Solr
|
@@ -157,8 +156,7 @@ private
|
|
157
156
|
# SIDE EFFECT: converts data to turtle for LdpWriter
|
158
157
|
# @return [RDF::Graph] populated RDF::Graph object, or nil
|
159
158
|
def jsonld_to_graph
|
160
|
-
|
161
|
-
g ||= RDF::Graph.new << JSON::LD::API.toRdf(json_ld) if json_ld
|
159
|
+
g ||= RDF::Graph.new.from_jsonld(data)
|
162
160
|
g = nil if g && g.size == 0
|
163
161
|
self.data = g.dump(:ttl) if g # LdpWriter expects ttl
|
164
162
|
g
|
@@ -174,19 +172,6 @@ private
|
|
174
172
|
g
|
175
173
|
end
|
176
174
|
|
177
|
-
# avoid external lookup of jsonld context by putting it inline
|
178
|
-
# @return [Hash] the parsed json after the context is put inline
|
179
|
-
def json_ld
|
180
|
-
if data.match(/"@context"\s*\:\s*"http\:\/\/www\.w3\.org\/ns\/oa-context-20130208\.json"/)
|
181
|
-
data.sub!("\"http://www.w3.org/ns/oa-context-20130208.json\"", Triannon::JsonldContext.oa_context)
|
182
|
-
elsif data.match(/"@context"\s*\:\s*"http\:\/\/www\.w3\.org\/ns\/oa\.jsonld"/)
|
183
|
-
data.sub!("\"http://www.w3.org/ns/oa.jsonld\"", Triannon::JsonldContext.oa_context)
|
184
|
-
elsif data.match(/"@context"\s*\:\s*"http\:\/\/iiif\.io\/api\/presentation\/2\/context\.json"/)
|
185
|
-
data.sub!("\"http://iiif.io/api/presentation/2/context.json\"", Triannon::JsonldContext.iiif_context)
|
186
|
-
end
|
187
|
-
@json_ld ||= JSON.parse(data) rescue nil
|
188
|
-
end
|
189
|
-
|
190
175
|
def graph_exists?
|
191
176
|
graph && graph.size > 0
|
192
177
|
end
|
@@ -64,8 +64,8 @@ module Triannon
|
|
64
64
|
# @param [RDF::URI] uri_obj the object that may have RDF::Triannon.externalReference
|
65
65
|
# @param [RDF::URI] predicate the predicate for [subject_obj, predicate, (ext_url)] statement
|
66
66
|
# to be added to @oa_graph, e.g. RDF::OpenAnnotation.hasTarget
|
67
|
-
# @param [RDF::URI] the subject object to get the predicate statement; defaults to @root_uri
|
68
|
-
# @
|
67
|
+
# @param [RDF::URI] subject_obj the subject object to get the predicate statement; defaults to @root_uri
|
68
|
+
# @return [Boolean] true if it adds statements to @oa_graph, false otherwise
|
69
69
|
def map_external_ref uri_obj, predicate, subject_obj = @root_uri
|
70
70
|
solns = @ldp_anno_graph.query [uri_obj, RDF::Triannon.externalReference, nil]
|
71
71
|
if solns.count > 0
|
@@ -90,8 +90,8 @@ module Triannon
|
|
90
90
|
# @param [RDF::URI] uri_obj the object that may type RDF::Content.ContentAsText
|
91
91
|
# @param [RDF::URI] predicate the predicate for [subject_obj, predicate, (ext_url)] statement
|
92
92
|
# to be added to @oa_graph, e.g. RDF::OpenAnnotation.hasTarget
|
93
|
-
# @param [RDF::URI] the subject object to get the predicate statement; defaults to @root_uri
|
94
|
-
# @
|
93
|
+
# @param [RDF::URI] subject_obj the subject object to get the predicate statement; defaults to @root_uri
|
94
|
+
# @return [Boolean] true if it adds statements to @oa_graph, false otherwise
|
95
95
|
def map_content_as_text uri_obj, predicate, subject_obj = @root_uri
|
96
96
|
solns = @ldp_anno_graph.query [uri_obj, RDF.type, RDF::Content.ContentAsText]
|
97
97
|
if solns.count > 0
|
@@ -117,7 +117,7 @@ module Triannon
|
|
117
117
|
# @param [RDF::URI] uri_obj the object that may have type RDF::OpenAnnotation.SpecificResource
|
118
118
|
# @param [RDF::URI] predicate the predicate for [@root_uri, predicate, (sel_res)] statement
|
119
119
|
# to be added to @oa_graph, e.g. RDF::OpenAnnotation.hasTarget
|
120
|
-
# @
|
120
|
+
# @return [Boolean] true if it adds statements to @oa_graph, false otherwise
|
121
121
|
def map_specific_resource uri_obj, predicate
|
122
122
|
solns = @ldp_anno_graph.query [uri_obj, RDF.type, RDF::OpenAnnotation.SpecificResource]
|
123
123
|
if solns.count > 0
|
@@ -170,7 +170,7 @@ module Triannon
|
|
170
170
|
# @param [RDF::URI] uri_obj the object that may have type RDF::OpenAnnotation.Choice
|
171
171
|
# @param [RDF::URI] predicate the predicate for [@root_uri, predicate, (choice)] statement
|
172
172
|
# to be added to @oa_graph, e.g. RDF::OpenAnnotation.hasTarget
|
173
|
-
# @
|
173
|
+
# @return [Boolean] true if it adds statements to @oa_graph, false otherwise
|
174
174
|
def map_choice uri_obj, predicate
|
175
175
|
solns = @ldp_anno_graph.query [uri_obj, RDF.type, RDF::OpenAnnotation.Choice]
|
176
176
|
if solns.count > 0
|
@@ -1,6 +1,53 @@
|
|
1
1
|
module Triannon
|
2
2
|
class SolrWriter
|
3
|
-
|
3
|
+
|
4
|
+
# DO NOT CALL before anno is stored: the graph should have an assigned url for the
|
5
|
+
# @id of the root; it shouldn't be a blank node
|
6
|
+
#
|
7
|
+
# Convert a Triannon::Graph object into a Hash suitable for writing to Solr.
|
8
|
+
#
|
9
|
+
# @param [Triannon::Graph] triannon_graph a populated Triannon::Graph object for a *stored* anno
|
10
|
+
# @return [Hash] a hash to be written to Solr, populated appropriately
|
11
|
+
def self.solr_hash(triannon_graph)
|
12
|
+
doc_hash = {}
|
13
|
+
triannon_id = triannon_graph.id_as_url
|
14
|
+
if triannon_id
|
15
|
+
# chars in Solr/Lucene query syntax are a big pain in Solr id fields, so we only use
|
16
|
+
# the uuid portion of the Triannon anno id, not the full url
|
17
|
+
solr_id = triannon_id.sub(Triannon.config[:triannon_base_url], "")
|
18
|
+
doc_hash[:id] = solr_id.sub(/^\/*/, "") # remove first char slash(es) if present
|
19
|
+
|
20
|
+
# use short strings for motivation field
|
21
|
+
doc_hash[:motivation] = triannon_graph.motivated_by.map { |m| m.sub(RDF::OpenAnnotation.to_s, "") }
|
22
|
+
|
23
|
+
# date field format: 1995-12-31T23:59:59Z; or w fractional seconds: 1995-12-31T23:59:59.999Z
|
24
|
+
if triannon_graph.annotated_at
|
25
|
+
begin
|
26
|
+
dt = Time.parse(triannon_graph.annotated_at)
|
27
|
+
doc_hash[:annotated_at] = dt.iso8601 if dt
|
28
|
+
rescue ArgumentError
|
29
|
+
# ignore invalid datestamps
|
30
|
+
end
|
31
|
+
end
|
32
|
+
#doc_hash[:annotated_by_stem] # not yet implemented
|
33
|
+
|
34
|
+
doc_hash[:target_url] = triannon_graph.predicate_urls RDF::OpenAnnotation.hasTarget
|
35
|
+
# TODO: recognize more target types
|
36
|
+
doc_hash[:target_type] = ['external_URI'] if doc_hash[:target_url].size > 0
|
37
|
+
|
38
|
+
doc_hash[:body_url] = triannon_graph.predicate_urls RDF::OpenAnnotation.hasBody
|
39
|
+
doc_hash[:body_type] = []
|
40
|
+
doc_hash[:body_type] << 'external_URI' if doc_hash[:body_url].size > 0
|
41
|
+
doc_hash[:body_chars_exact] = triannon_graph.body_chars.map {|bc| bc.strip}
|
42
|
+
doc_hash[:body_type] << 'content_as_text' if doc_hash[:body_chars_exact].size > 0
|
43
|
+
doc_hash[:body_type] << 'no_body' if doc_hash[:body_type].size == 0
|
44
|
+
|
45
|
+
doc_hash[:anno_jsonld] = triannon_graph.jsonld_oa
|
46
|
+
end
|
47
|
+
doc_hash
|
48
|
+
end
|
49
|
+
|
50
|
+
|
4
51
|
def initialize
|
5
52
|
@rsolr_client = RSolr.connect :url => Triannon.config[:solr_url]
|
6
53
|
@logger = Rails.logger
|
@@ -8,10 +55,18 @@ module Triannon
|
|
8
55
|
@base_sleep_seconds = Triannon.config[:base_sleep_seconds] || 1
|
9
56
|
@max_sleep_seconds = Triannon.config[:max_sleep_seconds] || 5
|
10
57
|
end
|
11
|
-
|
58
|
+
|
59
|
+
# Convert the Triannon::Graph to a Solr document hash, then call RSolr.add
|
60
|
+
# with the doc hash
|
61
|
+
# @param [Triannon::Graph] tgraph anno represented as a Triannon::Graph
|
62
|
+
def write(tgraph)
|
63
|
+
doc_hash = self.class.solr_hash(tgraph) if tgraph && !tgraph.id_as_url.empty?
|
64
|
+
add(doc_hash) if doc_hash && !doc_hash.empty?
|
65
|
+
end
|
66
|
+
|
12
67
|
# Add the document to Solr, retrying if an error occurs.
|
13
68
|
# See https://github.com/ooyala/retries for info on with_retries.
|
14
|
-
# @param [Hash] doc a Hash representation of the
|
69
|
+
# @param [Hash] doc a Hash representation of the Solr document to be added
|
15
70
|
def add(doc)
|
16
71
|
id = doc[:id]
|
17
72
|
|
@@ -32,7 +87,7 @@ module Triannon
|
|
32
87
|
|
33
88
|
# Delete the document from Solr, retrying if an error occurs.
|
34
89
|
# See https://github.com/ooyala/retries for info on with_retries.
|
35
|
-
# @param [String] the id of the
|
90
|
+
# @param [String] id the id of the Solr document to be deleted
|
36
91
|
def delete(id)
|
37
92
|
handler = Proc.new do |exception, attempt_cnt, total_delay|
|
38
93
|
@logger.debug "#{exception.inspect} on Solr delete attempt #{attempt_cnt} for #{id}"
|
@@ -2,6 +2,8 @@ require 'rails/generators'
|
|
2
2
|
|
3
3
|
module Triannon
|
4
4
|
class Install < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
5
7
|
def inject_Triannon_routes
|
6
8
|
route "mount Triannon::Engine, at: ''"
|
7
9
|
end
|
@@ -26,5 +28,17 @@ production:
|
|
26
28
|
YML
|
27
29
|
create_file 'config/triannon.yml', default_yml
|
28
30
|
end
|
31
|
+
|
32
|
+
def add_linked_data_caching
|
33
|
+
gem 'rest-client', '~> 1.7.2'
|
34
|
+
gem 'rack-cache'
|
35
|
+
gem 'rest-client-components'
|
36
|
+
|
37
|
+
Bundler.with_clean_env do
|
38
|
+
run "bundle install"
|
39
|
+
end
|
40
|
+
|
41
|
+
copy_file 'rest_client.rb', 'config/initializers/rest_client.rb'
|
42
|
+
end
|
29
43
|
end
|
30
44
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'restclient/components'
|
2
|
+
require 'rack/cache'
|
3
|
+
RestClient.enable Rack::Cache,
|
4
|
+
metastore: "file:#{Rails.root}/tmp/rack-cache/meta",
|
5
|
+
entitystore: "file:#{Rails.root}/tmp/rack-cache/body",
|
6
|
+
default_ttl: 86400, # when to recheck, in seconds (daily = 60 x 60 x 24)
|
7
|
+
verbose: false
|
data/lib/triannon/graph.rb
CHANGED
@@ -47,50 +47,7 @@ module Triannon
|
|
47
47
|
hash_from_json = JSON.parse(inline_context)
|
48
48
|
hash_from_json["@context"] = Triannon::JsonldContext::IIIF_CONTEXT_URL
|
49
49
|
hash_from_json.to_json
|
50
|
-
end
|
51
|
-
|
52
|
-
# DO NOT CALL before anno is stored.
|
53
|
-
# The graph should have an assigned url for the @id of the root; it shouldn't be a blank node
|
54
|
-
# @return [Hash] a hash to be written to Solr, populated appropriately
|
55
|
-
def solr_hash
|
56
|
-
doc_hash = {}
|
57
|
-
triannon_id = id_as_url
|
58
|
-
if triannon_id
|
59
|
-
# chars in Solr/Lucene query syntax are a big pain in Solr id fields, so we only use
|
60
|
-
# the uuid portion of the Triannon anno id, not the full url
|
61
|
-
solr_id = triannon_id.sub(Triannon.config[:triannon_base_url], "")
|
62
|
-
doc_hash[:id] = solr_id.sub(/^\//, "") # remove first char slash if it is there
|
63
|
-
|
64
|
-
# use short strings for motivation field
|
65
|
-
doc_hash[:motivation] = motivated_by.map { |m| m.sub(RDF::OpenAnnotation.to_s, "") }
|
66
|
-
|
67
|
-
# date field format: 1995-12-31T23:59:59Z; or w fractional seconds: 1995-12-31T23:59:59.999Z
|
68
|
-
if annotated_at
|
69
|
-
begin
|
70
|
-
dt = Time.parse(annotated_at)
|
71
|
-
doc_hash[:annotated_at] = dt.iso8601 if dt
|
72
|
-
rescue ArgumentError
|
73
|
-
# ignore invalid datestamps
|
74
|
-
end
|
75
|
-
end
|
76
|
-
#doc_hash[:annotated_by_stem] # not yet implemented
|
77
|
-
|
78
|
-
doc_hash[:target_url] = predicate_urls RDF::OpenAnnotation.hasTarget
|
79
|
-
# TODO: recognize more target types
|
80
|
-
doc_hash[:target_type] = ['external_URI'] if doc_hash[:target_url].size > 0
|
81
|
-
|
82
|
-
doc_hash[:body_url] = predicate_urls RDF::OpenAnnotation.hasBody
|
83
|
-
doc_hash[:body_type] = []
|
84
|
-
doc_hash[:body_type] << 'external_URI' if doc_hash[:body_url].size > 0
|
85
|
-
doc_hash[:body_chars_exact] = body_chars.map {|bc| bc.strip}
|
86
|
-
doc_hash[:body_type] << 'content_as_text' if doc_hash[:body_chars_exact].size > 0
|
87
|
-
doc_hash[:body_type] << 'no_body' if doc_hash[:body_type].size == 0
|
88
|
-
|
89
|
-
doc_hash[:anno_jsonld] = jsonld_oa
|
90
|
-
end
|
91
|
-
doc_hash
|
92
|
-
end
|
93
|
-
|
50
|
+
end
|
94
51
|
|
95
52
|
# Canned Query methods ----------------------------------------------------------------
|
96
53
|
|
@@ -1,21 +1,13 @@
|
|
1
1
|
module Triannon
|
2
2
|
class JsonldContext
|
3
3
|
|
4
|
+
# TODO: perhaps this should no longer be a class -- these could be Triannon constants ...
|
5
|
+
|
4
6
|
OA_CONTEXT_URL = "http://www.w3.org/ns/oa.jsonld"
|
5
7
|
|
6
8
|
OA_DATED_CONTEXT_URL = "http://www.w3.org/ns/oa-context-20130208.json"
|
7
9
|
|
8
10
|
IIIF_CONTEXT_URL = "http://iiif.io/api/presentation/2/context.json"
|
9
|
-
|
10
|
-
# a crude way of locally caching context so we don't hammer w3c server for every jsonld parse
|
11
|
-
def self.oa_context
|
12
|
-
@@oa_context ||= File.read(File.dirname(__FILE__) + "/oa_context_20130208.json")
|
13
|
-
end
|
14
|
-
|
15
|
-
# a crude way of locally caching context so we don't hammer server for every jsonld parse
|
16
|
-
def self.iiif_context
|
17
|
-
@@iiif_context ||= File.read(File.dirname(__FILE__) + "/iiif_presentation_2_context.json")
|
18
|
-
end
|
19
11
|
|
20
12
|
end
|
21
13
|
end
|
data/lib/triannon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triannon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-03-
|
13
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -264,6 +264,62 @@ dependencies:
|
|
264
264
|
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
|
+
- !ruby/object:Gem::Dependency
|
268
|
+
name: yard
|
269
|
+
requirement: !ruby/object:Gem::Requirement
|
270
|
+
requirements:
|
271
|
+
- - ">="
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
version: '0'
|
274
|
+
type: :development
|
275
|
+
prerelease: false
|
276
|
+
version_requirements: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - ">="
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: '0'
|
281
|
+
- !ruby/object:Gem::Dependency
|
282
|
+
name: rest-client
|
283
|
+
requirement: !ruby/object:Gem::Requirement
|
284
|
+
requirements:
|
285
|
+
- - "~>"
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: 1.7.2
|
288
|
+
type: :development
|
289
|
+
prerelease: false
|
290
|
+
version_requirements: !ruby/object:Gem::Requirement
|
291
|
+
requirements:
|
292
|
+
- - "~>"
|
293
|
+
- !ruby/object:Gem::Version
|
294
|
+
version: 1.7.2
|
295
|
+
- !ruby/object:Gem::Dependency
|
296
|
+
name: rest-client-components
|
297
|
+
requirement: !ruby/object:Gem::Requirement
|
298
|
+
requirements:
|
299
|
+
- - ">="
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
302
|
+
type: :development
|
303
|
+
prerelease: false
|
304
|
+
version_requirements: !ruby/object:Gem::Requirement
|
305
|
+
requirements:
|
306
|
+
- - ">="
|
307
|
+
- !ruby/object:Gem::Version
|
308
|
+
version: '0'
|
309
|
+
- !ruby/object:Gem::Dependency
|
310
|
+
name: rack-cache
|
311
|
+
requirement: !ruby/object:Gem::Requirement
|
312
|
+
requirements:
|
313
|
+
- - ">="
|
314
|
+
- !ruby/object:Gem::Version
|
315
|
+
version: '0'
|
316
|
+
type: :development
|
317
|
+
prerelease: false
|
318
|
+
version_requirements: !ruby/object:Gem::Requirement
|
319
|
+
requirements:
|
320
|
+
- - ">="
|
321
|
+
- !ruby/object:Gem::Version
|
322
|
+
version: '0'
|
267
323
|
description:
|
268
324
|
email:
|
269
325
|
- cabeer@stanford.edu
|
@@ -281,7 +337,6 @@ files:
|
|
281
337
|
- app/assets/stylesheets/triannon/application.css.scss
|
282
338
|
- app/controllers/triannon/annotations_controller.rb
|
283
339
|
- app/controllers/triannon/application_controller.rb
|
284
|
-
- app/helpers/triannon/annotations_helper.rb
|
285
340
|
- app/helpers/triannon/application_helper.rb
|
286
341
|
- app/models/triannon/annotation.rb
|
287
342
|
- app/models/triannon/annotation_ldp.rb
|
@@ -303,15 +358,14 @@ files:
|
|
303
358
|
- config/solr/triannon-core/conf/solrconfig.xml
|
304
359
|
- config/triannon.yml
|
305
360
|
- lib/generators/triannon/install_generator.rb
|
361
|
+
- lib/generators/triannon/templates/rest_client.rb
|
306
362
|
- lib/rdf/triannon_vocab.rb
|
307
363
|
- lib/tasks/triannon_tasks.rake
|
308
364
|
- lib/triannon.rb
|
309
365
|
- lib/triannon/engine.rb
|
310
366
|
- lib/triannon/error.rb
|
311
367
|
- lib/triannon/graph.rb
|
312
|
-
- lib/triannon/iiif_presentation_2_context.json
|
313
368
|
- lib/triannon/jsonld_context.rb
|
314
|
-
- lib/triannon/oa_context_20130208.json
|
315
369
|
- lib/triannon/version.rb
|
316
370
|
homepage:
|
317
371
|
licenses:
|
@@ -338,3 +392,4 @@ signing_key:
|
|
338
392
|
specification_version: 4
|
339
393
|
summary: Rails engine for working with OpenAnnotations stored in Fedora4
|
340
394
|
test_files: []
|
395
|
+
has_rdoc:
|
@@ -1,72 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"sc": "http://iiif.io/api/presentation/2#",
|
3
|
-
"iiif": "http://iiif.io/api/image/2#",
|
4
|
-
"exif": "http://www.w3.org/2003/12/exif/ns#",
|
5
|
-
"oa": "http://www.w3.org/ns/oa#",
|
6
|
-
"cnt": "http://www.w3.org/2011/content#",
|
7
|
-
"dc": "http://purl.org/dc/elements/1.1/",
|
8
|
-
"dcterms": "http://purl.org/dc/terms/",
|
9
|
-
"dctypes": "http://purl.org/dc/dcmitype/",
|
10
|
-
"foaf": "http://xmlns.com/foaf/0.1/",
|
11
|
-
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
12
|
-
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
13
|
-
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
14
|
-
"svcs": "http://rdfs.org/sioc/services#",
|
15
|
-
|
16
|
-
"license": {"@type":"@id", "@id":"dcterms:license"},
|
17
|
-
"service": {"@type":"@id", "@id":"svcs:has_service"},
|
18
|
-
"seeAlso": {"@type":"@id", "@id":"foaf:page"},
|
19
|
-
"within": {"@type":"@id", "@id":"dcterms:isPartOf"},
|
20
|
-
"profile": {"@type":"@id", "@id":"dcterms:conformsTo"},
|
21
|
-
"related": {"@type":"@id", "@id":"dcterms:relation"},
|
22
|
-
"logo": {"@type":"@id", "@id":"foaf:logo"},
|
23
|
-
"thumbnail": {"@type":"@id", "@id":"foaf:thumbnail"},
|
24
|
-
"startCanvas": {"@type":"@id", "@id":"sc:hasStartCanvas"},
|
25
|
-
|
26
|
-
"manifests": {"@type":"@id", "@id":"sc:hasManifests", "@container":"@list"},
|
27
|
-
"sequences": {"@type":"@id", "@id":"sc:hasSequences", "@container":"@list"},
|
28
|
-
"canvases": {"@type":"@id", "@id":"sc:hasCanvases", "@container":"@list"},
|
29
|
-
"resources": {"@type":"@id", "@id":"sc:hasAnnotations", "@container":"@list"},
|
30
|
-
"images": {"@type":"@id", "@id":"sc:hasImageAnnotations","@container":"@list"},
|
31
|
-
"otherContent": {"@type":"@id", "@id":"sc:hasLists", "@container":"@list"},
|
32
|
-
"structures": {"@type":"@id", "@id":"sc:hasRanges", "@container":"@list"},
|
33
|
-
"ranges" : {"@type": "@id", "@id": "sc:hasRanges", "@container":"@list"},
|
34
|
-
|
35
|
-
"metadata": {"@type":"@id", "@id":"sc:metadataLabels", "@container":"@list"},
|
36
|
-
|
37
|
-
"description": {"@id": "dc:description"},
|
38
|
-
"attribution": {"@id": "sc:attributionLabel"},
|
39
|
-
"height": {"@type":"xsd:integer", "@id":"exif:height"},
|
40
|
-
"width": {"@type":"xsd:integer", "@id":"exif:width"},
|
41
|
-
"viewingDirection": {"@id": "sc:viewingDirection", "@type":"@id"},
|
42
|
-
"viewingHint": {"@id": "sc:viewingHint", "@type":"@id"},
|
43
|
-
|
44
|
-
"left-to-right": {"@id":"sc:leftToRightDirection", "@type":"sc:ViewingDirection"},
|
45
|
-
"right-to-left": {"@id":"sc:rightToLeftDirection", "@type":"sc:ViewingDirection"},
|
46
|
-
"top-to-bottom": {"@id":"sc:topToBottomDirection", "@type":"sc:ViewingDirection"},
|
47
|
-
"bottom-to-top": {"@id":"sc:bottomToTopDirection", "@type":"sc:ViewingDirection"},
|
48
|
-
|
49
|
-
"paged": {"@id":"sc:pagedHint", "@type":"sc:ViewingHint"},
|
50
|
-
"non-paged": {"@id":"sc:nonPagedHint", "@type":"sc:ViewingHint"},
|
51
|
-
"continuous": {"@id":"sc:continuousHint", "@type":"sc:ViewingHint"},
|
52
|
-
"individuals": {"@id":"sc:individualsHint", "@type":"sc:ViewingHint"},
|
53
|
-
"top": {"@id":"sc:topHint", "@type":"sc:ViewingHint"},
|
54
|
-
|
55
|
-
"motivation": {"@type":"@id", "@id":"oa:motivatedBy"},
|
56
|
-
"resource": {"@type":"@id", "@id":"oa:hasBody"},
|
57
|
-
"on": {"@type":"@id", "@id":"oa:hasTarget"},
|
58
|
-
"full": {"@type":"@id", "@id":"oa:hasSource"},
|
59
|
-
"selector": {"@type":"@id", "@id":"oa:hasSelector"},
|
60
|
-
"stylesheet": {"@type":"@id", "@id":"oa:styledBy"},
|
61
|
-
"style": {"@id":"oa:styleClass"},
|
62
|
-
|
63
|
-
"default": {"@type":"@id", "@id" : "oa:default"},
|
64
|
-
"item": {"@type":"@id", "@id" : "oa:item"},
|
65
|
-
"chars": {"@id": "cnt:chars"},
|
66
|
-
"encoding": {"@id": "cnt:characterEncoding"},
|
67
|
-
"bytes": {"@id": "cnt:bytes"},
|
68
|
-
"format": {"@id": "dc:format"},
|
69
|
-
"language": {"@id": "dc:language"},
|
70
|
-
"value": {"@id": "rdf:value"},
|
71
|
-
"label": {"@id": "rdfs:label"}
|
72
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"oa": "http://www.w3.org/ns/oa#",
|
3
|
-
"cnt": "http://www.w3.org/2011/content#",
|
4
|
-
"dc": "http://purl.org/dc/elements/1.1/",
|
5
|
-
"dcterms": "http://purl.org/dc/terms/",
|
6
|
-
"dctypes": "http://purl.org/dc/dcmitype/",
|
7
|
-
"foaf": "http://xmlns.com/foaf/0.1/",
|
8
|
-
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
9
|
-
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
10
|
-
"skos": "http://www.w3.org/2004/02/skos/core#",
|
11
|
-
"owl": "http://www.w3.org/2002/07/owl#",
|
12
|
-
"prov": "http://www.w3.org/ns/prov#",
|
13
|
-
"trig": "http://www.w3.org/2004/03/trix/rdfg-1/",
|
14
|
-
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
15
|
-
"triannon": " http://triannon.stanford.edu/ns/",
|
16
|
-
|
17
|
-
"hasBody" : {"@type":"@id", "@id" : "oa:hasBody"},
|
18
|
-
"hasTarget" : {"@type":"@id", "@id" : "oa:hasTarget"},
|
19
|
-
"hasSource" : {"@type":"@id", "@id" : "oa:hasSource"},
|
20
|
-
"hasSelector" : {"@type":"@id", "@id" : "oa:hasSelector"},
|
21
|
-
"hasState" : {"@type":"@id", "@id" : "oa:hasState"},
|
22
|
-
"hasScope" : {"@type":"@id", "@id" : "oa:hasScope"},
|
23
|
-
"annotatedBy" : {"@type":"@id", "@id" : "oa:annotatedBy"},
|
24
|
-
"serializedBy" : {"@type":"@id", "@id" : "oa:serializedBy"},
|
25
|
-
"motivatedBy" : {"@type":"@id", "@id" : "oa:motivatedBy"},
|
26
|
-
"equivalentTo" : {"@type":"@id", "@id" : "oa:equivalentTo"},
|
27
|
-
"styledBy" : {"@type":"@id", "@id" : "oa:styledBy"},
|
28
|
-
"cachedSource" : {"@type":"@id", "@id" : "oa:cachedSource"},
|
29
|
-
"conformsTo" : {"@type":"@id", "@id" : "dcterms:conformsTo"},
|
30
|
-
"default" : {"@type":"@id", "@id" : "oa:default"},
|
31
|
-
"item" : {"@type":"@id", "@id" : "oa:item"},
|
32
|
-
"first": {"@type":"@id", "@id" : "rdf:first"},
|
33
|
-
"rest": {"@type":"@id", "@id" : "rdf:rest", "@container" : "@list"},
|
34
|
-
|
35
|
-
"annotatedAt" : { "@type": "xsd:dateTimeStamp", "@id": "oa:annotatedAt" },
|
36
|
-
"end" : { "@type": "xsd:nonNegativeInteger", "@id": "oa:end" },
|
37
|
-
"exact" : "oa:exact",
|
38
|
-
"prefix" : "oa:prefix",
|
39
|
-
"serializedAt" : { "@type": "xsd:dateTimeStamp", "@id": "oa:serializedAt" },
|
40
|
-
"start" : { "@type": "xsd:nonNegativeInteger", "@id": "oa:start" },
|
41
|
-
"styleClass" : "oa:styleClass",
|
42
|
-
"suffix" : "oa:suffix",
|
43
|
-
"when" : { "@type": "xsd:dateTimeStamp", "@id": "oa:when" },
|
44
|
-
|
45
|
-
"chars" : "cnt:chars",
|
46
|
-
"bytes" : "cnt:bytes",
|
47
|
-
"format" : "dc:format",
|
48
|
-
"language" : "dc:language",
|
49
|
-
"value" : "rdf:value",
|
50
|
-
"label" : "rdfs:label",
|
51
|
-
"name" : "foaf:name",
|
52
|
-
"mbox" : "foaf:mbox"
|
53
|
-
}
|