krikri 0.7.4 → 0.7.5

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: fdc840aa3b072d42d490d1af0928d16f3a35f579
4
- data.tar.gz: 749a43956d886a5c44ff38e7017b40d7888b521d
3
+ metadata.gz: 312dac3d8fca2156e749a365f55d5b49d7cc0f03
4
+ data.tar.gz: 3c41cf1762291dcec6e25fd1b62d66ef0359b81a
5
5
  SHA512:
6
- metadata.gz: 2d7ecdd65c3e6e97eb754c82215f1fd91f9eadb0411418f78fd30a304c5c3d02dd55477cb716cb55cf2a064c25cf08512a255cc040735af1359447b52c23e756
7
- data.tar.gz: 638d208479bf59c34ee72db05cf97896888cee223e5e5b015e0fe5a7f65555b3b5ea658297e48458557bae33eaf4bb39b886381be9d61a5ad2cb6dac30aef2e8
6
+ metadata.gz: 2dffe7c155cdb6256b5f3d6521db608a22dfb0211ec88646e0a0bc46ff1e1906698030a77a8a73834bd3d59bda6537127ea26be637747f63cc1b7a4b1b1e337e
7
+ data.tar.gz: c6e5280a113ec27ca7e43a93543b0c8a2dc09459963ec0f5f045b13caee00426b2aa0458f7a33e06f0d27832154fc96a6fde3fad1bb94c9d5c67b4f77b21f8b6
@@ -110,8 +110,11 @@ module Krikri::Enrichments
110
110
  match = match_iso(label.to_s)
111
111
  match = match_label(label.to_s) if match.node?
112
112
 
113
- node.exactMatch = match unless match.node?
113
+ # if match is still a node, we didn't find anything
114
+ return node if match.node?
114
115
 
116
+ node.exactMatch = match
117
+ node.prefLabel = RDF::ISO_639_3[match.rdf_subject.qname[1]].label.last
115
118
  node
116
119
  end
117
120
 
@@ -25,7 +25,7 @@ module Krikri
25
25
  def render_enriched_record(document)
26
26
  agg = document.aggregation
27
27
  return error_msg('Aggregation not found.') unless agg.present?
28
- JSON.pretty_generate(agg.to_jsonld)
28
+ JSON.pretty_generate(agg.to_jsonld['@graph'])
29
29
  end
30
30
 
31
31
  # Render original record for view
@@ -1,3 +1,3 @@
1
1
  module Krikri
2
- VERSION = '0.7.4'.freeze
2
+ VERSION = '0.7.5'.freeze
3
3
  end
@@ -30,6 +30,11 @@ describe Krikri::RecordsHelper, :type => :helper do
30
30
  result = helper.render_enriched_record(document)
31
31
  expect { JSON.parse(result) }.not_to raise_error
32
32
  end
33
+
34
+ it 'does not include context' do
35
+ expect(helper.render_enriched_record(document))
36
+ .not_to include '@context'
37
+ end
33
38
  end
34
39
 
35
40
  context 'without existing aggregation' do
@@ -35,6 +35,11 @@ describe Krikri::Enrichments::LanguageToLexvo do
35
35
  expect(subject.enrich_value('finnish')).to be_node
36
36
  end
37
37
 
38
+ it 'adds a prefLabel' do
39
+ expect(subject.enrich_value('finnish').prefLabel)
40
+ .to contain_exactly 'Finnish'
41
+ end
42
+
38
43
  context 'and no match' do
39
44
  it 'gives a language' do
40
45
  expect(subject.enrich_value('INVALID'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krikri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Audrey Altman
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-07-24 00:00:00.000000000 Z
14
+ date: 2015-07-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails