triannon 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ae63ca110852324bb003e0a856033579b02cb62
|
4
|
+
data.tar.gz: ee6310ea307c6c25b33b5ddaa93f9f7a2a21aef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831eed11793f83aca689bde7eca9ef841615028b04cfa6806393390d072e31392a1d4c1af94a010b210e5f580c11564e4e070eb83261112db6098f329e6e3899
|
7
|
+
data.tar.gz: 3cb48b9ac9990ba2650b5753d6c9d6db9659c7409b3d5c8ee890b8ca14d61eeee2c44448c1d09396b3d254a204c5a9b3708a5f154433cc0260552b2b6a25e75c
|
@@ -42,7 +42,7 @@ module Triannon
|
|
42
42
|
|
43
43
|
# POST /annotations/annotations
|
44
44
|
def create
|
45
|
-
@annotation = Annotation.new(
|
45
|
+
@annotation = Annotation.new(:data => request.body.read)
|
46
46
|
|
47
47
|
if @annotation.save
|
48
48
|
redirect_to @annotation, notice: 'Annotation was successfully created.'
|
@@ -72,11 +72,6 @@ module Triannon
|
|
72
72
|
@annotation = Annotation.find(params[:id])
|
73
73
|
end
|
74
74
|
|
75
|
-
# Only allow a trusted parameter "white list" through.
|
76
|
-
def annotation_params
|
77
|
-
params.require(:annotation).permit(:data)
|
78
|
-
end
|
79
|
-
|
80
75
|
def default_format_jsonld
|
81
76
|
if ((!request.accept || request.accept.empty?) && (!params[:format] || params[:format].empty?))
|
82
77
|
request.format = "jsonld"
|
@@ -96,7 +91,7 @@ module Triannon
|
|
96
91
|
end
|
97
92
|
end
|
98
93
|
end
|
99
|
-
|
94
|
+
|
100
95
|
# handle Triannon::ExternalReferenceError
|
101
96
|
def ext_ref_error(exception)
|
102
97
|
render plain: exception.message, status: 403
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -255,7 +255,6 @@ files:
|
|
255
255
|
- app/helpers/triannon/application_helper.rb
|
256
256
|
- app/models/triannon/annotation.rb
|
257
257
|
- app/models/triannon/annotation_ldp.rb
|
258
|
-
- app/models/triannon/graph_validator.rb
|
259
258
|
- app/services/triannon/ldp_creator.rb
|
260
259
|
- app/services/triannon/ldp_destroyer.rb
|
261
260
|
- app/services/triannon/ldp_loader.rb
|
@@ -299,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
298
|
version: '0'
|
300
299
|
requirements: []
|
301
300
|
rubyforge_project:
|
302
|
-
rubygems_version: 2.4.
|
301
|
+
rubygems_version: 2.4.2
|
303
302
|
signing_key:
|
304
303
|
specification_version: 4
|
305
304
|
summary: Rails engine for working with storage of OpenAnnotations stored in Fedora4
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Triannon
|
2
|
-
class GraphValidator < ActiveModel::Validator
|
3
|
-
|
4
|
-
def validate(anno)
|
5
|
-
graph_exists? anno
|
6
|
-
graph = anno.graph
|
7
|
-
basic_solution = graph.query(self.basic_query)
|
8
|
-
unless basic_solution && basic_solution.size == 1
|
9
|
-
anno.errors[:data] << 'The oa:Annotation class MUST be associated with each Annotation.'
|
10
|
-
anno.errors[:data] << 'each Annotation MUST have at least one target'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def graph_exists?(anno)
|
15
|
-
graph = anno.graph
|
16
|
-
unless graph && graph.size > 0
|
17
|
-
anno.errors[:data] << 'Unable to create non-null graph'
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# query for a subject with
|
22
|
-
# predicate RDF::OpenAnnotation.hasTarget
|
23
|
-
# type of RDF::OpenAnnotation.Annotation
|
24
|
-
def self.basic_query
|
25
|
-
@@basic_query ||= begin
|
26
|
-
RDF::Query.new
|
27
|
-
basic_query << [:s, RDF.type, RDF::URI("http://www.w3.org/ns/oa#Annotation")]
|
28
|
-
basic_query << [:s, RDF::OpenAnnotation.hasTarget, nil]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|