iqvoc_similar_terms 2.7.0 → 2.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +67 -0
  3. data/.gitignore +7 -0
  4. data/Gemfile +14 -15
  5. data/Gemfile.lock +483 -314
  6. data/README.md +5 -6
  7. data/app/assets/javascripts/manifest.js +2 -0
  8. data/app/assets/stylesheets/manifest.scss +3 -0
  9. data/app/controllers/similar_terms_controller.rb +27 -11
  10. data/app/models/services/similar_terms_service.rb +141 -0
  11. data/app/views/similar_terms/_form.html.erb +21 -0
  12. data/app/views/similar_terms/new.html.erb +21 -0
  13. data/app/views/similar_terms/show.html.erb +32 -28
  14. data/bin/bundle +3 -0
  15. data/bin/rails +3 -9
  16. data/bin/rake +3 -6
  17. data/bin/setup +33 -0
  18. data/bin/update +31 -0
  19. data/bin/yarn +17 -0
  20. data/config/application.rb +30 -48
  21. data/config/boot.rb +3 -5
  22. data/config/cable.yml +10 -0
  23. data/config/database.yml.postgresql +26 -0
  24. data/config/environment.rb +4 -4
  25. data/config/initializers/content_security_policy.rb +25 -0
  26. data/config/initializers/filter_parameter_logging.rb +8 -0
  27. data/config/initializers/inflections.rb +16 -0
  28. data/config/initializers/iqvoc.rb +5 -4
  29. data/config/initializers/new_framework_defaults_6_1.rb +67 -0
  30. data/config/initializers/permissions_policy.rb +11 -0
  31. data/config/locales/de.yml +6 -0
  32. data/config/locales/en.yml +6 -0
  33. data/config/routes.rb +2 -2
  34. data/config/storage.yml +34 -0
  35. data/config.ru +4 -2
  36. data/faucet.config.js +46 -0
  37. data/iqvoc_similar_terms.gemspec +1 -1
  38. data/lib/iqvoc/similar_terms/version.rb +1 -1
  39. data/lib/iqvoc/similar_terms.rb +12 -97
  40. data/lib/iqvoc_similar_terms.rb +1 -0
  41. data/package-lock.json +1486 -0
  42. data/package.json +29 -0
  43. data/test/concept_test.nt +5 -0
  44. data/test/concept_test.ttl +8 -1
  45. data/test/controllers/similar_terms_controller_test.rb +167 -0
  46. data/test/models/entity_resolution_test.rb +6 -6
  47. data/test/models/results_test.rb +43 -17
  48. metadata +31 -23
  49. data/.travis.yml +0 -30
  50. data/bin/spring +0 -18
  51. data/config/initializers/iqvoc_similiar_terms.rb +0 -1
  52. data/config/initializers/wrap_parameters.rb +0 -14
  53. data/test/controllers/api_test.rb +0 -58
  54. data/test/controllers/onebox_test.rb +0 -37
data/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "iqvoc_similar_terms",
3
+ "version": "2.11.3",
4
+ "description": "SimilarTerms extension for iQvoc",
5
+ "scripts": {
6
+ "watch": "faucet --watch",
7
+ "compile": "faucet --compact --fingerprint"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/innoq/iqvoc_similar_terms.git"
12
+ },
13
+ "author": "",
14
+ "license": "Apache License 2.0",
15
+ "bugs": {
16
+ "url": "https://github.com/innoq/iqvoc_similar_terms/issues"
17
+ },
18
+ "homepage": "https://github.com/innoq/iqvoc_similar_terms#readme",
19
+ "devDependencies": {
20
+ "faucet-pipeline-js": "^2.1.7",
21
+ "faucet-pipeline-jsmin": "^2.1.7",
22
+ "faucet-pipeline-sass": "^1.6.0",
23
+ "faucet-pipeline-static": "^1.2.0"
24
+ },
25
+ "dependencies": {
26
+ "es6-promise": "^4.2.8",
27
+ "iqvoc": "github:innoq/iqvoc"
28
+ }
29
+ }
data/test/concept_test.nt CHANGED
@@ -1,3 +1,7 @@
1
+ <http://localhost:3000/related_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
2
+ <http://localhost:3000/related_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "related"@en .
3
+ <http://localhost:3000/related> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
4
+ <http://localhost:3000/related> <http://www.w3.org/2008/05/skos-xl#prefLabel> <http://localhost:3000/related_label> .
1
5
  <http://localhost:3000/water_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
2
6
  <http://localhost:3000/water_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "water"@en .
3
7
  <http://localhost:3000/real_water_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
@@ -5,6 +9,7 @@
5
9
  <http://localhost:3000/water> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
6
10
  <http://localhost:3000/water> <http://www.w3.org/2008/05/skos-xl#prefLabel> <http://localhost:3000/water_label> .
7
11
  <http://localhost:3000/water> <http://www.w3.org/2008/05/skos-xl#altLabel> <http://localhost:3000/real_water_label> .
12
+ <http://localhost:3000/water> <http://www.w3.org/2004/02/skos/core#related> <http://localhost:3000/related> .
8
13
  <http://localhost:3000/used_water_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
9
14
  <http://localhost:3000/used_water_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "used water"@en .
10
15
  <http://localhost:3000/no_water_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
@@ -2,13 +2,20 @@
2
2
  @prefix skos: <http://www.w3.org/2004/02/skos/core#>.
3
3
  @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
4
4
 
5
+
6
+ :related_label a skosxl:Label;
7
+ skosxl:literalForm "related"@en.
8
+ :related a skos:Concept;
9
+ skosxl:prefLabel :related_label.
10
+
5
11
  :water_label a skosxl:Label;
6
12
  skosxl:literalForm "water"@en.
7
13
  :real_water_label a skosxl:Label;
8
14
  skosxl:literalForm "real water"@en.
9
15
  :water a skos:Concept;
10
16
  skosxl:prefLabel :water_label;
11
- skosxl:altLabel :real_water_label.
17
+ skosxl:altLabel :real_water_label;
18
+ skos:related :related.
12
19
 
13
20
  :used_water_label a skosxl:Label;
14
21
  skosxl:literalForm "used water"@en.
@@ -0,0 +1,167 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
4
+
5
+ class SimilarTermsControllerTest < ActionController::TestCase
6
+
7
+ setup do
8
+ load_test_data
9
+ end
10
+
11
+ test "routing" do
12
+ get :create, params: {
13
+ lang: 'en',
14
+ format: 'ttl'
15
+ }
16
+ assert_response 400
17
+
18
+ get :create, params: {
19
+ lang: 'en',
20
+ format: 'ttl',
21
+ terms: 'foo'
22
+ }
23
+ assert_response 200
24
+ assert !@response.body.include?("skosxl:altLabel")
25
+ end
26
+
27
+ test "single RDF representation" do
28
+ get :create, params: {
29
+ lang: 'en',
30
+ format: 'ttl',
31
+ terms: 'forest'
32
+ }
33
+ assert_response :success
34
+ assert @response.body.include?(<<-EOS)
35
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#>.
36
+ EOS
37
+ assert @response.body.include?(<<-EOS)
38
+ @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
39
+ EOS
40
+ assert @response.body.include?(<<-EOS)
41
+ @prefix query: <http://test.host/en/similar.ttl?terms=forest#>.
42
+ EOS
43
+ assert @response.body.include?(<<-EOS.strip)
44
+ query:top skos:altLabel "forest"@en;
45
+ skos:altLabel "woods"@en.
46
+ EOS
47
+ end
48
+
49
+ test "multipe RDF representations" do
50
+ get :create, params: {
51
+ lang: 'en',
52
+ format: 'ttl',
53
+ terms: 'forest,automobile'
54
+ }
55
+ assert_response :success
56
+ assert @response.body.include?(<<-EOS)
57
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#>.
58
+ EOS
59
+ assert @response.body.include?(<<-EOS)
60
+ @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
61
+ EOS
62
+ assert @response.body.include?(<<-EOS)
63
+ @prefix query: <http://test.host/en/similar.ttl?terms=forest%2Cautomobile#>.
64
+ EOS
65
+ assert @response.body.include?(<<-EOS.strip)
66
+ query:top skos:altLabel "automobile"@en;
67
+ skos:altLabel "car"@en;
68
+ skos:altLabel "forest"@en;
69
+ skos:altLabel "woods"@en.
70
+ EOS
71
+ end
72
+
73
+ test "XML representation without results" do
74
+ get :create, params: {
75
+ lang: 'en',
76
+ format: 'xml',
77
+ terms: 'foo'
78
+ }
79
+ assert_response 200
80
+ assert @response.body.starts_with?(<<-EOS.strip)
81
+ <?xml version="1.0" encoding="UTF-8"?>
82
+ <OneBoxResults xmlns:xlink="http://www.w3.org/1999/xlink">
83
+ <resultCode>success</resultCode>
84
+ <totalResults>0</totalResults>
85
+ <urlText>Similar Terms</urlText>
86
+ <urlLink>http://test.host/en/similar.xml?terms=foo#</urlLink>
87
+ EOS
88
+ assert !@response.body.include?("<MODULE_RESULT>")
89
+ end
90
+
91
+ test "XML representation with results" do
92
+ get :create, params: {
93
+ lang: 'en',
94
+ format: 'xml',
95
+ terms: 'forest'
96
+ }
97
+ assert_response 200
98
+ assert @response.body.include?("<totalResults>2</totalResults>")
99
+ assert @response.body.include?(<<-EOS.strip)
100
+ <MODULE_RESULT>
101
+ <title>similar terms for 'forest'</title>
102
+ EOS
103
+ assert @response.body.include? '<Field name="forest">forest</Field>'
104
+ assert @response.body.include? '<Field name="woods">woods</Field>'
105
+ end
106
+
107
+ test "RDF representation with pref labels of narrower and related concepts" do
108
+ SkosImporter.new('test/concept_test.nt', 'http://localhost:3000/').run
109
+ get :create, params: {
110
+ lang: 'en',
111
+ format: 'ttl',
112
+ terms: 'water'
113
+ }
114
+ assert_response :success
115
+ assert @response.body.include?(<<-EOS.strip)
116
+ query:top skos:altLabel "new water"@en;
117
+ skos:altLabel "real water"@en;
118
+ skos:altLabel "related"@en;
119
+ skos:altLabel "used water"@en;
120
+ skos:altLabel "water"@en.
121
+ EOS
122
+ end
123
+
124
+ test "RDF representation with pref labels of narrower and related concepts - case insensitive" do
125
+ SkosImporter.new('test/concept_test.nt', 'http://localhost:3000/').run
126
+ get :create, params: {
127
+ lang: 'en',
128
+ format: 'ttl',
129
+ :terms => 'Water'
130
+ }
131
+ assert_response :success
132
+ assert @response.body.include?(<<-EOS.strip)
133
+ query:top skos:altLabel "new water"@en;
134
+ skos:altLabel "real water"@en;
135
+ skos:altLabel "related"@en;
136
+ skos:altLabel "used water"@en;
137
+ skos:altLabel "water"@en.
138
+ EOS
139
+ end
140
+
141
+ test "Compound Forms in RDF representation" do
142
+ SkosImporter.new('test/compound_forms.nt', 'http://hobbies.com/').run
143
+ get :create, params: {
144
+ lang: 'en',
145
+ format: 'ttl',
146
+ terms: 'Computer'
147
+ }
148
+ assert_response :success
149
+ assert @response.body.include?(<<-EOS.strip)
150
+ query:top skos:altLabel "Computer programming"@en.
151
+ EOS
152
+ end
153
+
154
+ test "Compound Forms in RDF representation - case insensitive" do
155
+ SkosImporter.new('test/compound_forms.nt', 'http://hobbies.com/').run
156
+ get :create, params: {
157
+ lang: 'en',
158
+ format: 'ttl',
159
+ terms: 'computer'
160
+ }
161
+ assert_response :success
162
+ assert @response.body.include?(<<-EOS.strip)
163
+ query:top skos:altLabel "Computer programming"@en.
164
+ EOS
165
+ end
166
+
167
+ end
@@ -9,19 +9,19 @@ class EntityResolutionTest < ActiveSupport::TestCase
9
9
  end
10
10
 
11
11
  test "concept resolution" do
12
- concepts = Iqvoc::SimilarTerms.terms_to_concepts("en", "forest")
12
+ concepts = Services::SimilarTermsService.terms_to_concepts("en", "forest")
13
13
  assert_equal 1, concepts.length
14
14
  assert_equal Iqvoc::Concept.base_class, concepts[0].class
15
15
 
16
- concepts = Iqvoc::SimilarTerms.terms_to_concepts("de", "forest")
16
+ concepts = Services::SimilarTermsService.terms_to_concepts("de", "forest")
17
17
  assert_equal 0, concepts.count
18
18
 
19
- concepts = Iqvoc::SimilarTerms.terms_to_concepts("en", "foo")
19
+ concepts = Services::SimilarTermsService.terms_to_concepts("en", "foo")
20
20
  assert_equal 0, concepts.count
21
21
  end
22
22
 
23
23
  test "label resolution" do
24
- labels = Iqvoc::SimilarTerms.terms_to_labels("en", "forest")
24
+ labels = Services::SimilarTermsService.terms_to_labels("en", "forest")
25
25
  # assert_equal ActiveRecord::Relation, labels.class
26
26
  labels = labels.all
27
27
 
@@ -30,10 +30,10 @@ class EntityResolutionTest < ActiveSupport::TestCase
30
30
  assert_equal "forest", labels[0].value
31
31
  assert_equal "en", labels[0].language
32
32
 
33
- labels = Iqvoc::SimilarTerms.terms_to_labels("de", "forest")
33
+ labels = Services::SimilarTermsService.terms_to_labels("de", "forest")
34
34
  assert_equal 0, labels.count
35
35
 
36
- labels = Iqvoc::SimilarTerms.terms_to_labels("en", "foo")
36
+ labels = Services::SimilarTermsService.terms_to_labels("en", "foo")
37
37
  assert_equal 0, labels.count
38
38
 
39
39
  # TODO: test XLLabel and Inflectional variants
@@ -10,7 +10,7 @@ class ResultsTest < ActiveSupport::TestCase
10
10
  end
11
11
 
12
12
  test "ranked results" do
13
- results = Iqvoc::SimilarTerms.ranked("en", "forest")
13
+ results = Services::SimilarTermsService.ranked("en", {}, "forest")
14
14
  assert_equal 2, results.length
15
15
  assert_equal Iqvoc::XLLabel.base_class, results[0][0].class
16
16
  assert_equal "forest", results[0][0].value
@@ -18,7 +18,7 @@ class ResultsTest < ActiveSupport::TestCase
18
18
  assert_equal "woods", results[1][0].value
19
19
  assert_equal "forest", results[1][1].origin
20
20
 
21
- results = Iqvoc::SimilarTerms.ranked("en", "woods", "car")
21
+ results = Services::SimilarTermsService.ranked("en", {}, "woods", "car")
22
22
  assert_equal 4, results.length
23
23
  assert_equal "forest", results[0][0].value
24
24
  assert_equal "forest", results[0][1].origin
@@ -32,7 +32,7 @@ class ResultsTest < ActiveSupport::TestCase
32
32
  end
33
33
 
34
34
  test "weighted results" do
35
- results = Iqvoc::SimilarTerms.weighted("en", "forest")
35
+ results = Services::SimilarTermsService.weighted("en", {}, "forest")
36
36
  assert_equal 2, results.keys.length
37
37
  expected = { "forest" => 5, "woods" => 2 }
38
38
  results.each do |label, data|
@@ -43,36 +43,62 @@ class ResultsTest < ActiveSupport::TestCase
43
43
  end
44
44
  end
45
45
 
46
- test "inclusion of pref labels of sub concepts" do
47
- results = Iqvoc::SimilarTerms.weighted("en", "water")
48
- assert_equal 4, results.length
46
+ #TODO: add a related concept relation and also test it
47
+ test "inclusion of pref labels of narrower and related concepts" do
48
+ results = Services::SimilarTermsService.weighted("en", {}, "water")
49
+ assert_equal 5, results.length
50
+ assert_equal "water", results.keys.first.value
51
+ assert_equal 5, results[results.keys.first][0]
52
+ assert_equal "real water", results.keys.second.value
53
+ assert_equal 2, results[results.keys.second][0]
54
+ assert_equal "related", results.keys.third.value
55
+ assert_equal 1, results[results.keys.third][0]
56
+ assert_equal "used water", results.keys.fourth.value
57
+ assert_equal 1, results[results.keys.fourth][0]
58
+ assert_equal "new water", results.keys.fifth.value
59
+ assert_equal 1, results[results.keys.fifth][0]
60
+ end
61
+
62
+ test "inclusion of pref labels of narrower and related concepts - case insensitive" do
63
+ results = Services::SimilarTermsService.weighted("en", {}, "Water")
64
+ assert_equal 5, results.length
49
65
  assert_equal "water", results.keys.first.value
50
66
  assert_equal 5, results[results.keys.first][0]
51
- assert_equal "used water", results.keys.second.value
52
- assert_equal 0, results[results.keys.second][0]
53
- assert_equal "new water", results.keys.third.value
54
- assert_equal 0, results[results.keys.third][0]
55
- assert_equal "real water", results.keys.fourth.value
56
- assert_equal 2, results[results.keys.fourth][0]
67
+ assert_equal "real water", results.keys.second.value
68
+ assert_equal 2, results[results.keys.second][0]
69
+ assert_equal "related", results.keys.third.value
70
+ assert_equal 1, results[results.keys.third][0]
71
+ assert_equal "used water", results.keys.fourth.value
72
+ assert_equal 1, results[results.keys.fourth][0]
73
+ assert_equal "new water", results.keys.fifth.value
74
+ assert_equal 1, results[results.keys.fifth][0]
57
75
  end
58
76
 
59
77
  test "no results" do
60
- results = Iqvoc::SimilarTerms.weighted("de", "water")
78
+ results = Services::SimilarTermsService.weighted("de", {}, "water")
61
79
  assert_equal 0, results.length
62
80
  end
63
81
 
82
+ test "compound returns - case insensitive" do
83
+ SkosImporter.new('test/compound_forms.nt', 'http://hobbies.com/').run
84
+ results = Services::SimilarTermsService.weighted("de", {}, "computer")
85
+ assert_equal 1, results.length
86
+ assert_equal "Computer programming", results.keys.first.value
87
+ assert_equal 1, results[results.keys.first][0]
88
+ end
89
+
64
90
  test "compound returns" do
65
91
  SkosImporter.new('test/compound_forms.nt', 'http://hobbies.com/').run
66
- results = Iqvoc::SimilarTerms.weighted("de", "Computer")
92
+ results = Services::SimilarTermsService.weighted("de", {}, "Computer")
67
93
  assert_equal 1, results.length
68
94
  assert_equal "Computer programming", results.keys.first.value
69
- assert_equal 0, results[results.keys.first][0]
95
+ assert_equal 1, results[results.keys.first][0]
70
96
  end
71
97
 
72
98
  test "nothing unpublished" do
73
99
  concept = Iqvoc::XLLabel.base_class.where(value: "forest").first.concepts.first
74
- concept.update_attributes published_at: nil
75
- results = Iqvoc::SimilarTerms.weighted("en", "forest")
100
+ concept.update(published_at: nil)
101
+ results = Services::SimilarTermsService.weighted("en", {}, "forest")
76
102
  assert_equal 0, results.length
77
103
  end
78
104
 
metadata CHANGED
@@ -1,37 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iqvoc_similar_terms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederik Dohr
8
8
  - Robert Glaser
9
9
  - Till Schulte-Coerne
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-07 00:00:00.000000000 Z
13
+ date: 2024-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iqvoc
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
20
- - !ruby/object:Gem::Version
21
- version: 4.4.0
22
19
  - - "~>"
23
20
  - !ruby/object:Gem::Version
24
- version: '4.6'
21
+ version: 4.14.4
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- version: 4.4.0
32
26
  - - "~>"
33
27
  - !ruby/object:Gem::Version
34
- version: '4.6'
28
+ version: 4.14.4
35
29
  description: ''
36
30
  email:
37
31
  - robert.glaser@innoq.com
@@ -39,23 +33,33 @@ executables: []
39
33
  extensions: []
40
34
  extra_rdoc_files: []
41
35
  files:
36
+ - ".github/workflows/ci.yml"
42
37
  - ".gitignore"
43
- - ".travis.yml"
44
38
  - Gemfile
45
39
  - Gemfile.lock
46
40
  - README.md
47
41
  - Rakefile
42
+ - app/assets/javascripts/manifest.js
43
+ - app/assets/stylesheets/manifest.scss
48
44
  - app/controllers/similar_terms_controller.rb
45
+ - app/models/services/similar_terms_service.rb
46
+ - app/views/similar_terms/_form.html.erb
47
+ - app/views/similar_terms/new.html.erb
49
48
  - app/views/similar_terms/show.html.erb
50
49
  - app/views/similar_terms/show.iqrdf
51
50
  - app/views/similar_terms/show.xml.builder
51
+ - bin/bundle
52
52
  - bin/rails
53
53
  - bin/rake
54
- - bin/spring
54
+ - bin/setup
55
+ - bin/update
56
+ - bin/yarn
55
57
  - config.ru
56
58
  - config/application.rb
57
59
  - config/boot.rb
60
+ - config/cable.yml
58
61
  - config/database.yml.mysql
62
+ - config/database.yml.postgresql
59
63
  - config/database.yml.sqlite
60
64
  - config/engine.rb
61
65
  - config/environment.rb
@@ -63,27 +67,33 @@ files:
63
67
  - config/environments/production.rb
64
68
  - config/environments/test.rb
65
69
  - config/initializers/apipie.rb
70
+ - config/initializers/content_security_policy.rb
71
+ - config/initializers/filter_parameter_logging.rb
72
+ - config/initializers/inflections.rb
66
73
  - config/initializers/iqvoc.rb
67
- - config/initializers/iqvoc_similiar_terms.rb
74
+ - config/initializers/new_framework_defaults_6_1.rb
75
+ - config/initializers/permissions_policy.rb
68
76
  - config/initializers/session_store.rb
69
- - config/initializers/wrap_parameters.rb
70
77
  - config/locales/de.yml
71
78
  - config/locales/en.yml
72
79
  - config/routes.rb
73
80
  - config/secrets.yml
81
+ - config/storage.yml
74
82
  - db/.gitkeep
75
83
  - db/migrate/.gitkeep
84
+ - faucet.config.js
76
85
  - iqvoc_similar_terms.gemspec
77
86
  - lib/iqvoc/similar_terms.rb
78
87
  - lib/iqvoc/similar_terms/version.rb
79
88
  - lib/iqvoc_similar_terms.rb
89
+ - package-lock.json
90
+ - package.json
80
91
  - public/.gitkeep
81
92
  - script/rails
82
93
  - test/compound_forms.nt
83
94
  - test/concept_test.nt
84
95
  - test/concept_test.ttl
85
- - test/controllers/api_test.rb
86
- - test/controllers/onebox_test.rb
96
+ - test/controllers/similar_terms_controller_test.rb
87
97
  - test/models/entity_resolution_test.rb
88
98
  - test/models/results_test.rb
89
99
  - test/similar_terms.nt
@@ -92,7 +102,7 @@ files:
92
102
  homepage: ''
93
103
  licenses: []
94
104
  metadata: {}
95
- post_install_message:
105
+ post_install_message:
96
106
  rdoc_options: []
97
107
  require_paths:
98
108
  - lib
@@ -107,17 +117,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
117
  - !ruby/object:Gem::Version
108
118
  version: '0'
109
119
  requirements: []
110
- rubyforge_project: iqvoc_similar_terms
111
- rubygems_version: 2.4.5.1
112
- signing_key:
120
+ rubygems_version: 3.4.10
121
+ signing_key:
113
122
  specification_version: 4
114
123
  summary: ''
115
124
  test_files:
116
125
  - test/compound_forms.nt
117
126
  - test/concept_test.nt
118
127
  - test/concept_test.ttl
119
- - test/controllers/api_test.rb
120
- - test/controllers/onebox_test.rb
128
+ - test/controllers/similar_terms_controller_test.rb
121
129
  - test/models/entity_resolution_test.rb
122
130
  - test/models/results_test.rb
123
131
  - test/similar_terms.nt
data/.travis.yml DELETED
@@ -1,30 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- bundler_args: "--without production heroku --retry 3"
4
- rvm:
5
- - 2.0
6
- - 2.1
7
- - 2.2
8
- - 2.3
9
- env:
10
- - DB=sqlite
11
- - DB=mysql
12
- before_install: cp config/database.yml.$DB config/database.yml
13
- before_script:
14
- - bundle exec rake db:drop RAILS_ENV=test
15
- - bundle exec rake db:create RAILS_ENV=test
16
- - bundle exec rake db:migrate RAILS_ENV=test
17
- branches:
18
- only:
19
- - master
20
- notifications:
21
- email:
22
- - iqvoc@innoq.com
23
- deploy:
24
- provider: rubygems
25
- api_key:
26
- secure: gaKVohEtHR8ZVVTirZIJNr64gkFq9jS89OziQYddAvHMmg4LCfY3PFLLt9GPbOal6OBx/NWx8nPWXoaEoCpxKtusTVv4GPygrE1RXILXY4A1YDHk1p+NYp5IDyCMQrwJzP05qS+LWcEJFM0zJChFXiHqflVhTKTLSyIk+bc+QZc=
27
- gem: iqvoc_similar_terms
28
- on:
29
- tags: true
30
- repo: innoq/iqvoc_similar_terms
data/bin/spring DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads spring without using Bundler, in order to be fast
4
- # It gets overwritten when you run the `spring binstub` command
5
-
6
- unless defined?(Spring)
7
- require "rubygems"
8
- require "bundler"
9
-
10
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
11
- ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
- ENV["GEM_HOME"] = ""
13
- Gem.paths = ENV
14
-
15
- gem "spring", match[1]
16
- require "spring/binstub"
17
- end
18
- end
@@ -1 +0,0 @@
1
- require 'iqvoc/similar_terms'
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
@@ -1,58 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
4
-
5
- class SimilarTermsTest < ActionController::TestCase
6
-
7
- setup do
8
- @controller = SimilarTermsController.new
9
-
10
- load_test_data
11
- end
12
-
13
- test "routing" do
14
- get :show, :lang => "en", :format => "ttl"
15
- assert_response 400
16
-
17
- get :show, :lang => "en", :format => "ttl", :terms => "foo"
18
- assert_response 200
19
- assert !@response.body.include?("skosxl:altLabel")
20
- end
21
-
22
- test "RDF representations" do
23
- get :show, :lang => "en", :format => "ttl", :terms => "forest"
24
- assert_response :success
25
- assert @response.body.include?(<<-EOS)
26
- @prefix skos: <http://www.w3.org/2004/02/skos/core#>.
27
- EOS
28
- assert @response.body.include?(<<-EOS)
29
- @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
30
- EOS
31
- assert @response.body.include?(<<-EOS)
32
- @prefix query: <http://test.host/en/similar.ttl?terms=forest#>.
33
- EOS
34
- assert @response.body.include?(<<-EOS.strip)
35
- query:top skos:altLabel "forest"@en;
36
- skos:altLabel "woods"@en.
37
- EOS
38
-
39
- get :show, :lang => "en", :format => "ttl", :terms => "forest,automobile"
40
- assert_response :success
41
- assert @response.body.include?(<<-EOS)
42
- @prefix skos: <http://www.w3.org/2004/02/skos/core#>.
43
- EOS
44
- assert @response.body.include?(<<-EOS)
45
- @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
46
- EOS
47
- assert @response.body.include?(<<-EOS)
48
- @prefix query: <http://test.host/en/similar.ttl?terms=forest%2Cautomobile#>.
49
- EOS
50
- assert @response.body.include?(<<-EOS.strip)
51
- query:top skos:altLabel "automobile"@en;
52
- skos:altLabel "car"@en;
53
- skos:altLabel "forest"@en;
54
- skos:altLabel "woods"@en.
55
- EOS
56
- end
57
-
58
- end