triannon 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/triannon/graph.rb +28 -25
- data/lib/triannon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba1a1f91829594f2fbeb8e4bd61922cc8c97bd25
|
4
|
+
data.tar.gz: a9adfc5f66aa751fd7772b3e94e2eeb7bcc448ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d1fa8358fad5e023fd4996830b9c08fe249a86c3df56a8cd81f8957acd69dfdf2f7082f60cece97dc0677abc6f9a3c25326dc7ac233d46405b86ba517d39ec
|
7
|
+
data.tar.gz: 66ec8e8824ce0c734d6e025625f8ed86c0749848bd00f895c5a7c0a44d631320ac2267c9319e1b8b7be6700c8811bd265b8e6a17ac3dd47d0f75af010cfcd74b
|
data/lib/triannon/graph.rb
CHANGED
@@ -54,37 +54,40 @@ module Triannon
|
|
54
54
|
# @return [Hash] a hash to be written to Solr, populated appropriately
|
55
55
|
def solr_hash
|
56
56
|
doc_hash = {}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
+
# use short strings for motivation field
|
65
|
+
doc_hash[:motivation] = motivated_by.map { |m| m.sub(RDF::OpenAnnotation.to_s, "") }
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
72
75
|
end
|
73
|
-
|
74
|
-
# doc_hash[:annotated_by_stem] # not yet implemented
|
76
|
+
#doc_hash[:annotated_by_stem] # not yet implemented
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
86
88
|
|
87
|
-
|
89
|
+
doc_hash[:anno_jsonld] = jsonld_oa
|
90
|
+
end
|
88
91
|
doc_hash
|
89
92
|
end
|
90
93
|
|
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.5.
|
4
|
+
version: 0.5.2
|
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-02-
|
13
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|