iqvoc 4.7.0 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/Gemfile +11 -11
  4. data/Gemfile.lock +178 -122
  5. data/README.md +39 -24
  6. data/{test/performance/browsing_test.rb → app/aides/inline_data_helper.rb} +23 -6
  7. data/app/aides/maker.rb +139 -0
  8. data/{lib → app/aides}/multi_logger.rb +0 -0
  9. data/app/aides/origin.rb +47 -0
  10. data/app/aides/rdfapi.rb +59 -0
  11. data/app/aides/skos_exporter.rb +151 -0
  12. data/app/aides/skos_importer.rb +348 -0
  13. data/app/assets/javascripts/iqvoc/entityselect.js.erb +7 -9
  14. data/app/controllers/application_controller.rb +1 -3
  15. data/app/controllers/collections/versions_controller.rb +1 -3
  16. data/app/controllers/concepts/versions_controller.rb +9 -3
  17. data/app/controllers/concerns/controller_extensions.rb +109 -0
  18. data/app/{concerns → controllers/concerns}/reverse_match_errors.rb +0 -0
  19. data/app/controllers/hierarchy_controller.rb +7 -3
  20. data/app/controllers/instance_configuration_controller.rb +1 -1
  21. data/app/controllers/pages_controller.rb +10 -0
  22. data/app/controllers/search_results_controller.rb +2 -2
  23. data/app/controllers/triplestore_sync_controller.rb +2 -4
  24. data/app/helpers/application_helper.rb +1 -1
  25. data/app/helpers/widget_helper.rb +3 -3
  26. data/app/jobs/export_job.rb +1 -3
  27. data/app/jobs/import_job.rb +1 -3
  28. data/app/models/ability.rb +59 -0
  29. data/app/models/abstract_user.rb +1 -1
  30. data/app/models/collection/base.rb +12 -3
  31. data/app/models/collection/member/skos/base.rb +1 -1
  32. data/app/models/concept/base.rb +15 -8
  33. data/app/models/concept/relation/base.rb +1 -1
  34. data/app/models/concept/relation/skos/base.rb +1 -1
  35. data/app/models/concept/skos/scheme.rb +1 -1
  36. data/app/models/concept/validations.rb +1 -1
  37. data/app/models/concerns/deep_cloning.rb +92 -0
  38. data/app/models/concerns/first_level_object_scopes.rb +9 -0
  39. data/app/{concerns → models/concerns}/first_level_object_validations.rb +9 -2
  40. data/app/models/concerns/rankable.rb +31 -0
  41. data/app/models/{search_extension.rb → concerns/search_extension.rb} +0 -0
  42. data/app/{concerns → models/concerns}/versioning.rb +0 -6
  43. data/app/models/configuration_setting.rb +1 -1
  44. data/app/models/labeling/skos/base.rb +2 -2
  45. data/app/models/match/skos/base.rb +2 -2
  46. data/app/models/note/skos/base.rb +7 -6
  47. data/app/models/note/skos/change_note.rb +1 -1
  48. data/{lib/iqvoc/rdf_sync.rb → app/services/rdf_sync_service.rb} +3 -3
  49. data/app/view_models/concept_view.rb +1 -1
  50. data/app/views/collections/_form.html.erb +2 -2
  51. data/app/views/concepts/scheme/edit.html.erb +1 -1
  52. data/app/views/pages/components.html.erb +45 -0
  53. data/app/views/pages/version.html.erb +6 -0
  54. data/app/views/partials/concept/_reverse_match_notice.html.erb +0 -1
  55. data/app/views/search_results/_sidebar.html.erb +3 -3
  56. data/config/application.rb +4 -1
  57. data/config/boot.rb +1 -2
  58. data/config/database.yml.postgresql +23 -0
  59. data/config/engine.rb +0 -2
  60. data/config/environments/heroku.rb +1 -1
  61. data/config/initializers/inflections.rb +9 -3
  62. data/config/initializers/iqvoc.rb +1 -7
  63. data/config/initializers/mime_types.rb +0 -1
  64. data/config/locales/de.yml +2 -1
  65. data/config/locales/en.yml +11 -10
  66. data/config/routes.rb +2 -0
  67. data/config/travis/database.yml.mysql +9 -0
  68. data/config/travis/database.yml.postgresql +7 -0
  69. data/config/travis/database.yml.sqlite +5 -0
  70. data/db/migrate/20141204151558_add_foreign_key_constraints.rb +23 -0
  71. data/iqvoc.gemspec +2 -2
  72. data/lib/generators/app/template.rb +15 -7
  73. data/lib/iqvoc.rb +2 -1
  74. data/lib/iqvoc/configuration/core.rb +18 -4
  75. data/lib/iqvoc/configuration/instance_configuration.rb +125 -0
  76. data/lib/iqvoc/configuration/navigation.rb +63 -0
  77. data/lib/iqvoc/environments/development.rb +4 -0
  78. data/lib/iqvoc/environments/production.rb +11 -12
  79. data/lib/iqvoc/environments/test.rb +4 -1
  80. data/lib/iqvoc/version.rb +2 -2
  81. data/lib/tasks/exporter.rake +1 -4
  82. data/lib/tasks/importer.rake +1 -5
  83. data/lib/tasks/sync.rake +1 -2
  84. data/test/controllers/concept_movement_test.rb +11 -11
  85. data/test/controllers/hierarchy_test.rb +83 -79
  86. data/test/controllers/reverse_match_test.rb +2 -2
  87. data/test/integration/alphabetical_test.rb +2 -3
  88. data/test/integration/browse_concepts_and_labels_test.rb +2 -2
  89. data/test/integration/collection_circularity_test.rb +6 -6
  90. data/test/integration/concept_scheme_browsing_test.rb +2 -2
  91. data/test/integration/edit_concepts_test.rb +1 -1
  92. data/test/integration/export_test.rb +5 -3
  93. data/test/integration/import_test.rb +4 -1
  94. data/test/integration/instance_configuration_browsing_test.rb +2 -2
  95. data/test/integration/navigation_test.rb +2 -2
  96. data/test/integration/note_annotations_test.rb +12 -11
  97. data/test/integration/reverse_match_job_test.rb +19 -10
  98. data/test/integration/search_test.rb +6 -6
  99. data/test/integration/tree_test.rb +3 -3
  100. data/test/integration/untranslated_test.rb +1 -1
  101. data/test/models/concept_test.rb +13 -14
  102. data/test/models/inline_data_test.rb +9 -9
  103. data/test/models/instance_configuration_test.rb +7 -3
  104. data/test/models/origin_test.rb +9 -59
  105. data/test/models/rdf_sync_test.rb +2 -4
  106. data/test/models/rdfapi_test.rb +0 -2
  107. data/test/models/skos_collection_import_test.rb +3 -4
  108. data/test/models/skos_export_test.rb +3 -5
  109. data/test/models/skos_import_test.rb +12 -10
  110. data/test/test_helper.rb +0 -1
  111. data/vendor/assets/stylesheets/{jquery-ui.css.scss → jquery-ui.scss} +0 -0
  112. data/vendor/assets/stylesheets/{jquery-ui.structure.css.scss → jquery-ui.structure.scss} +0 -0
  113. data/vendor/assets/stylesheets/{jquery-ui.theme.css.scss → jquery-ui.theme.scss} +0 -0
  114. metadata +34 -28
  115. data/lib/iqvoc/ability.rb +0 -60
  116. data/lib/iqvoc/controller_extensions.rb +0 -111
  117. data/lib/iqvoc/deep_cloning.rb +0 -90
  118. data/lib/iqvoc/inline_data_helper.rb +0 -45
  119. data/lib/iqvoc/instance_configuration.rb +0 -123
  120. data/lib/iqvoc/maker.rb +0 -141
  121. data/lib/iqvoc/navigation.rb +0 -61
  122. data/lib/iqvoc/origin.rb +0 -111
  123. data/lib/iqvoc/rankable.rb +0 -33
  124. data/lib/iqvoc/rdfapi.rb +0 -60
  125. data/lib/iqvoc/skos_exporter.rb +0 -153
  126. data/lib/iqvoc/skos_importer.rb +0 -337
@@ -21,7 +21,7 @@ class BrowseConceptsAndLabelsTest < ActionDispatch::IntegrationTest
21
21
  @concepts = %w("Tree"@en "Forest"@en "Baum"@de "Forst"@de).map do |literal|
22
22
  concept = Concept::SKOS::Base.new.publish
23
23
  concept.save
24
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', literal
24
+ RDFAPI.devour concept, 'skos:prefLabel', literal
25
25
  concept
26
26
  end
27
27
  end
@@ -60,7 +60,7 @@ class BrowseConceptsAndLabelsTest < ActionDispatch::IntegrationTest
60
60
  concept = Concept::SKOS::Base.create! do |c|
61
61
  c.expired_at = 2.days.ago
62
62
  end
63
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', literal
63
+ RDFAPI.devour concept, 'skos:prefLabel', literal
64
64
  concept
65
65
  end
66
66
 
@@ -21,18 +21,18 @@ class CollectionCircularityTest < ActionDispatch::IntegrationTest
21
21
  login('administrator')
22
22
 
23
23
  @coll1 = Iqvoc::Collection.base_class.new.lock_by_user(@user.id).tap { |c| c.save }
24
- Iqvoc::RDFAPI.devour @coll1, 'skos:prefLabel', '"coll1"@en'
24
+ RDFAPI.devour @coll1, 'skos:prefLabel', '"coll1"@en'
25
25
  @coll2 = Iqvoc::Collection.base_class.new.lock_by_user(@user.id).tap { |c| c.save }
26
- Iqvoc::RDFAPI.devour @coll2, 'skos:prefLabel', '"coll2"@en'
26
+ RDFAPI.devour @coll2, 'skos:prefLabel', '"coll2"@en'
27
27
  @coll3 = Iqvoc::Collection.base_class.new.lock_by_user(@user.id).tap { |c| c.save }
28
- Iqvoc::RDFAPI.devour @coll3, 'skos:prefLabel', '"coll3"@en'
28
+ RDFAPI.devour @coll3, 'skos:prefLabel', '"coll3"@en'
29
29
 
30
30
  @concept1 = Concept::SKOS::Base.new.publish.tap { |c| c.save }
31
- Iqvoc::RDFAPI.devour @concept1, 'skos:prefLabel', '"concept1"@en'
31
+ RDFAPI.devour @concept1, 'skos:prefLabel', '"concept1"@en'
32
32
  @concept2 = Concept::SKOS::Base.new.publish.tap { |c| c.save }
33
- Iqvoc::RDFAPI.devour @concept2, 'skos:prefLabel', '"concept2"@en'
33
+ RDFAPI.devour @concept2, 'skos:prefLabel', '"concept2"@en'
34
34
  @concept3 = Concept::SKOS::Base.new.publish.tap { |c| c.save }
35
- Iqvoc::RDFAPI.devour @concept3, 'skos:prefLabel', '"concept3"@en'
35
+ RDFAPI.devour @concept3, 'skos:prefLabel', '"concept3"@en'
36
36
  end
37
37
 
38
38
  test 'inline assignments are persisted' do
@@ -50,9 +50,9 @@ class ConceptSchemeBrowsingTest < ActionDispatch::IntegrationTest
50
50
  assert !page.has_link?('Tree 2', href: 'http://www.example.com/en/concepts/foo_2.html')
51
51
 
52
52
  concept1 = Concept::SKOS::Base.new(origin: 'foo_1', top_term: false).publish.tap { |c| c.save }
53
- Iqvoc::RDFAPI.devour concept1, 'skos:prefLabel', '"Tree 2"@en'
53
+ RDFAPI.devour concept1, 'skos:prefLabel', '"Tree 2"@en'
54
54
  concept2 = Concept::SKOS::Base.new(origin: 'foo_2', top_term: false).publish.tap { |c| c.save }
55
- Iqvoc::RDFAPI.devour concept2, 'skos:prefLabel', '"Tree 2"@en'
55
+ RDFAPI.devour concept2, 'skos:prefLabel', '"Tree 2"@en'
56
56
 
57
57
  login 'administrator'
58
58
  visit edit_scheme_path(lang: :en, format: :html)
@@ -19,7 +19,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
19
19
  class EditConceptsTest < ActionDispatch::IntegrationTest
20
20
  setup do
21
21
  @concept = Concept::SKOS::Base.new.tap do |c|
22
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"foo"@en'
22
+ RDFAPI.devour c, 'skos:prefLabel', '"foo"@en'
23
23
  c.publish
24
24
  c.save
25
25
  end
@@ -15,12 +15,13 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
- require 'iqvoc/skos_importer'
19
18
 
20
19
  class ExportTest < ActionDispatch::IntegrationTest
21
20
  setup do
22
21
  @testdata = File.read(Rails.root.join('test','models', 'testdata.nt')).split("\n")
23
- Iqvoc::SkosImporter.new(@testdata, 'http://www.example.com/').run
22
+ SkosImporter.new(@testdata, 'http://www.example.com/').run
23
+
24
+ @worker = Delayed::Worker.new
24
25
  end
25
26
 
26
27
  test 'export privileges' do
@@ -51,7 +52,8 @@ class ExportTest < ActionDispatch::IntegrationTest
51
52
  click_link_or_button 'Request Export'
52
53
  assert page.has_content? 'Export job was created. Reload page to see current processing status.'
53
54
 
54
- Delayed::Worker.new.work_off
55
+ job = Delayed::Job.last
56
+ @worker.run(job)
55
57
 
56
58
  visit exports_path(lang: 'en')
57
59
  click_link_or_button 'Download'
@@ -19,6 +19,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
19
19
  class ImportTest < ActionDispatch::IntegrationTest
20
20
  setup do
21
21
  @file = Rails.root.join('data/hobbies.nt')
22
+ @worker = Delayed::Worker.new
22
23
  end
23
24
 
24
25
  test 'import privileges' do
@@ -49,7 +50,9 @@ class ImportTest < ActionDispatch::IntegrationTest
49
50
  click_button('Import')
50
51
  assert page.has_content? 'Import job was created. Reload page to see current processing status.'
51
52
 
52
- Delayed::Worker.new.work_off
53
+ job = Delayed::Job.last
54
+ @worker.run(job)
55
+
53
56
  visit imports_path(lang: 'en')
54
57
  page.find('table tbody tr[1] td[1] a').click
55
58
 
@@ -14,8 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require 'test_helper'
18
- require 'integration_test_helper'
17
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
19
18
 
20
19
  class InstanceConfigurationTest < ActionDispatch::IntegrationTest
21
20
  test 'configuration privileges' do
@@ -44,6 +43,7 @@ class InstanceConfigurationTest < ActionDispatch::IntegrationTest
44
43
  end
45
44
 
46
45
  test 'modify and persist configuration' do
46
+ visit root_url
47
47
  assert page.find('.navbar-brand').has_content? 'iQvoc'
48
48
 
49
49
  login 'administrator'
@@ -18,12 +18,12 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
18
18
 
19
19
  class NavigationTest < ActionDispatch::IntegrationTest
20
20
  test 'extend navigation on root level' do
21
- Iqvoc::Navigation.add({
21
+ Iqvoc::Configuration::Navigation.add({
22
22
  text: 'root element 1',
23
23
  href: 'http://foo.local/'
24
24
  })
25
25
 
26
- Iqvoc::Navigation.add_grouped({
26
+ Iqvoc::Configuration::Navigation.add_grouped({
27
27
  text: 'extension 1',
28
28
  href: 'http://foo.local/'
29
29
  })
@@ -15,7 +15,6 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
- require 'iqvoc/rdfapi'
19
18
 
20
19
  class NoteAnnotationsTest < ActionDispatch::IntegrationTest
21
20
  test 'creating and retrieving change notes' do
@@ -54,14 +53,16 @@ class NoteAnnotationsTest < ActionDispatch::IntegrationTest
54
53
  gsub(/^ *| *$/, ''). # ignore indentation
55
54
  gsub(/\d/, '#'). # neutralize timestamps
56
55
  gsub(/#\+#/, '#-#') # neutralize eventually positive timezone shifts (server time)
56
+
57
57
  assert ttl.include?("skos:changeNote [\n" +
58
58
  "rdfs:comment \"lorem ipsum\"@en\n" +
59
- ']')
59
+ ']'), "can't find changeNote 'lorem ipsum'"
60
+
60
61
  assert ttl.include?("skos:changeNote [\n" +
61
62
  "rdfs:comment \"dolor sit amet\"@en;\n" +
62
63
  "dct:creator \"Test User\";\n" +
63
64
  "dct:modified \"####-##-##T##:##:##-##:##\"\n" +
64
- ']')
65
+ ']'), "can't find changeNote 'dolor sit amet'"
65
66
 
66
67
  visit xml_uri
67
68
  xml = page.source.
@@ -83,7 +84,7 @@ class NoteAnnotationsTest < ActionDispatch::IntegrationTest
83
84
  end
84
85
 
85
86
  test 'rdf for localized note annotations' do
86
- rdfapi = Iqvoc::RDFAPI
87
+ rdfapi = RDFAPI
87
88
 
88
89
  concept = rdfapi.devour *%w(foobar a skos:Concept)
89
90
  concept.publish
@@ -97,14 +98,14 @@ class NoteAnnotationsTest < ActionDispatch::IntegrationTest
97
98
 
98
99
  visit "/#{concept.origin}.ttl"
99
100
 
100
- ttl = <<RDF
101
- rdfs:seeAlso [
102
- rdfs:comment "foo"@en;
103
- dct:title "Foo Bar"@en;
104
- foaf:page <http://google.de/>
101
+ expected_ttl = <<RDF
102
+ rdfs:seeAlso [
103
+ rdfs:comment "foo"@en;
104
+ dct:title "Foo Bar"@en;
105
+ foaf:page <http://google.de/>
105
106
  ].
106
107
  RDF
107
-
108
- assert page.body.include?(ttl)
108
+ ttl = page.source.gsub(/^ *| *$/, '') # ignore indentation
109
+ assert ttl.include?(expected_ttl), "can't find changeNote 'Foo Bar'"
109
110
  end
110
111
  end
@@ -22,13 +22,13 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
22
22
 
23
23
  setup do
24
24
  @achievement_hobbies = Concept::SKOS::Base.new.tap do |c|
25
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
25
+ RDFAPI.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
26
26
  c.publish
27
27
  c.save
28
28
  end
29
29
 
30
30
  @airsoft = Concept::SKOS::Base.new(origin: 'airsoft').tap do |c|
31
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Airsoft"@en'
31
+ RDFAPI.devour c, 'skos:prefLabel', '"Airsoft"@en'
32
32
  c.publish
33
33
  c.save
34
34
  end
@@ -45,6 +45,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
45
45
  .with(:headers => {'Accept' => 'application/json', 'User-Agent' => 'Faraday v0.9.0'})
46
46
  .to_return(status: 200, body: body, headers: {})
47
47
 
48
+ @worker = Delayed::Worker.new
48
49
  DatabaseCleaner.start
49
50
  end
50
51
 
@@ -61,8 +62,10 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
61
62
  job = @reverse_match_service.build_job(:add_match, 'airsoft', 'http://try.iqvoc.com', 'Match::SKOS::BroadMatch')
62
63
  @reverse_match_service.add(job)
63
64
 
64
- Delayed::Worker.new.work_off
65
- assert_equal 0, @airsoft.jobs.size
65
+ job = Delayed::Job.last
66
+ @worker.run(job)
67
+
68
+ assert_equal 0, @airsoft.job_relations.size
66
69
  end
67
70
 
68
71
  test 'job timeout' do
@@ -72,8 +75,10 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
72
75
  job = @reverse_match_service.build_job(:add_match, 'airsoft', 'http://try.iqvoc.com', 'Match::SKOS::BroadMatch')
73
76
  @reverse_match_service.add(job)
74
77
 
75
- Delayed::Worker.new.work_off
76
- assert_equal 1, @airsoft.jobs.size
78
+ job = Delayed::Job.last
79
+ @worker.run(job)
80
+
81
+ assert_equal 1, @airsoft.job_relations.size
77
82
 
78
83
  job_relation = @airsoft.job_relations.first
79
84
  assert_equal 'timeout_error', job_relation.response_error
@@ -86,8 +91,10 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
86
91
  job = @reverse_match_service.build_job(:add_match, 'airsoft', 'http://try.iqvoc.com', 'Match::SKOS::BroadMatch')
87
92
  @reverse_match_service.add(job)
88
93
 
89
- Delayed::Worker.new.work_off
90
- assert_equal 1, @airsoft.jobs.size
94
+ job = Delayed::Job.last
95
+ @worker.run(job)
96
+
97
+ assert_equal 1, @airsoft.job_relations.size
91
98
 
92
99
  job_relation = @airsoft.job_relations.first
93
100
  assert_equal 'resource_not_found', job_relation.response_error
@@ -102,8 +109,10 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
102
109
  job = @reverse_match_service.build_job(:add_match, 'airsoft', 'http://try.iqvoc.com', 'Match::SKOS::BroadMatch')
103
110
  @reverse_match_service.add(job)
104
111
 
105
- Delayed::Worker.new.work_off
106
- assert_equal 1, @airsoft.jobs.size
112
+ job = Delayed::Job.last
113
+ @worker.run(job)
114
+
115
+ assert_equal 1, @airsoft.job_relations.size
107
116
 
108
117
  job_relation = @airsoft.job_relations.first
109
118
  assert_equal 'unknown_match', job_relation.response_error
@@ -21,21 +21,21 @@ class SearchTest < ActionDispatch::IntegrationTest
21
21
 
22
22
  @concepts = %w("Tree"@en "Forest"@en).map do |literal|
23
23
  Concept::SKOS::Base.new.tap do |c|
24
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', literal
24
+ RDFAPI.devour c, 'skos:prefLabel', literal
25
25
  c.publish
26
26
  c.save
27
27
  end
28
28
  end
29
29
 
30
30
  @collection = Collection::SKOS::Unordered.new.tap do |c|
31
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Alpha"@en'
31
+ RDFAPI.devour c, 'skos:prefLabel', '"Alpha"@en'
32
32
  c.publish
33
33
  c.save
34
34
  end
35
35
 
36
36
  # assign concepts to collection
37
37
  @concepts.each do |c|
38
- Iqvoc::RDFAPI.devour @collection, 'skos:member', c
38
+ RDFAPI.devour @collection, 'skos:member', c
39
39
  end
40
40
  end
41
41
 
@@ -124,11 +124,11 @@ class SearchTest < ActionDispatch::IntegrationTest
124
124
 
125
125
  test 'searching specific classes within collections' do
126
126
  concept = Concept::SKOS::Base.new.tap do |c|
127
- Iqvoc::RDFAPI.devour c, 'skos:definition', '"lorem ipsum"@en'
127
+ RDFAPI.devour c, 'skos:definition', '"lorem ipsum"@en'
128
128
  c.publish
129
129
  c.save
130
130
  end
131
- Iqvoc::RDFAPI.devour @collection, 'skos:member', concept
131
+ RDFAPI.devour @collection, 'skos:member', concept
132
132
 
133
133
  visit search_path(lang: 'en', format: 'html')
134
134
 
@@ -172,7 +172,7 @@ class SearchTest < ActionDispatch::IntegrationTest
172
172
  # create a large number of concepts
173
173
  1.upto(12) do |i|
174
174
  Concept::SKOS::Base.new.tap do |c|
175
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', "\"sample_#{sprintf('_%04d', i)}\"@en"
175
+ RDFAPI.devour c, 'skos:prefLabel', "\"sample_#{sprintf('_%04d', i)}\"@en"
176
176
  c.publish
177
177
  c.save
178
178
  end
@@ -19,14 +19,14 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
19
19
  class TreeTest < ActionDispatch::IntegrationTest
20
20
  test 'browse hierarchical concepts tree' do
21
21
  narrower_concept = Concept::SKOS::Base.new.tap do |c|
22
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Narrower"@en'
22
+ RDFAPI.devour c, 'skos:prefLabel', '"Narrower"@en'
23
23
  c.publish
24
24
  c.save
25
25
  end
26
26
 
27
27
  concept = Concept::SKOS::Base.new(top_term: true).tap do |c|
28
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Foo"@en'
29
- Iqvoc::RDFAPI.devour c, 'skos:narrower', narrower_concept
28
+ RDFAPI.devour c, 'skos:prefLabel', '"Foo"@en'
29
+ RDFAPI.devour c, 'skos:narrower', narrower_concept
30
30
  c.publish
31
31
  c.save
32
32
  end
@@ -25,7 +25,7 @@ class UntranslatedConceptsTest < ActionDispatch::IntegrationTest
25
25
  ].each do |hsh|
26
26
  concept = Concept::SKOS::Base.new
27
27
  hsh.each do |lang, value|
28
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', "\"#{value}\"@#{lang}"
28
+ RDFAPI.devour concept, 'skos:prefLabel', "\"#{value}\"@#{lang}"
29
29
  end
30
30
  concept.publish.save
31
31
  end
@@ -15,7 +15,6 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
18
- require 'iqvoc/rdfapi'
19
18
 
20
19
  class ConceptTest < ActiveSupport::TestCase
21
20
  test 'blank concept' do
@@ -42,7 +41,7 @@ class ConceptTest < ActiveSupport::TestCase
42
41
  end
43
42
 
44
43
  test 'concept with no preflabel' do
45
- concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept'
44
+ concept = RDFAPI.devour 'bear', 'a', 'skos:Concept'
46
45
 
47
46
  assert concept.save
48
47
  refute concept.publishable?
@@ -52,15 +51,15 @@ class ConceptTest < ActiveSupport::TestCase
52
51
  end
53
52
 
54
53
  test 'concepts without pref_labels should be saveable but not publishable' do
55
- concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept'
54
+ concept = RDFAPI.devour 'bear', 'a', 'skos:Concept'
56
55
  assert_equal [], concept.pref_labels
57
56
  assert concept.valid?
58
57
  refute concept.publishable?
59
58
  end
60
59
 
61
60
  test 'published concept must have a pref_label of the first pref_label language configured (the main language)' do
62
- concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept'
63
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en'
61
+ concept = RDFAPI.devour 'bear', 'a', 'skos:Concept'
62
+ RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en'
64
63
 
65
64
  assert concept.save
66
65
 
@@ -74,13 +73,13 @@ class ConceptTest < ActiveSupport::TestCase
74
73
 
75
74
  test 'one pref label per language' do
76
75
  concept = Concept::SKOS::Base.new.tap do |c|
77
- Iqvoc::RDFAPI.devour c, 'skos:prefLabel', '"Bear"@en'
76
+ RDFAPI.devour c, 'skos:prefLabel', '"Bear"@en'
78
77
  c.publish
79
78
  c.save
80
79
  end
81
80
 
82
81
  assert concept.valid?
83
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Beaaar"@en'
82
+ RDFAPI.devour concept, 'skos:prefLabel', '"Beaaar"@en'
84
83
  concept.pref_labelings.reload
85
84
  assert_equal 2, concept.pref_labelings.count
86
85
  assert_equal concept.pref_labelings.first.target.language, concept.pref_labelings.second.target.language
@@ -88,23 +87,23 @@ class ConceptTest < ActiveSupport::TestCase
88
87
  end
89
88
 
90
89
  test 'unique pref label' do
91
- bear_one = Iqvoc::RDFAPI.devour 'bear_one', 'a', 'skos:Concept'
92
- Iqvoc::RDFAPI.devour bear_one, 'skos:prefLabel', '"Bear"@en'
90
+ bear_one = RDFAPI.devour 'bear_one', 'a', 'skos:Concept'
91
+ RDFAPI.devour bear_one, 'skos:prefLabel', '"Bear"@en'
93
92
 
94
93
  assert bear_one.save
95
94
  assert bear_one.publishable?
96
95
 
97
- bear_two = Iqvoc::RDFAPI.devour 'bear_two', 'a', 'skos:Concept'
98
- Iqvoc::RDFAPI.devour bear_two, 'skos:prefLabel', '"Bear"@en'
96
+ bear_two = RDFAPI.devour 'bear_two', 'a', 'skos:Concept'
97
+ RDFAPI.devour bear_two, 'skos:prefLabel', '"Bear"@en'
99
98
 
100
99
  bear_two.save!
101
100
  refute bear_two.publishable?
102
101
  end
103
102
 
104
103
  test 'multiple pref labels' do
105
- concept = Iqvoc::RDFAPI.devour 'bear', 'a', 'skos:Concept'
106
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en'
107
- Iqvoc::RDFAPI.devour concept, 'skos:prefLabel', '"Bär"@de'
104
+ concept = RDFAPI.devour 'bear', 'a', 'skos:Concept'
105
+ RDFAPI.devour concept, 'skos:prefLabel', '"Bear"@en'
106
+ RDFAPI.devour concept, 'skos:prefLabel', '"Bär"@de'
108
107
 
109
108
  assert concept.save
110
109
  concept.reload
@@ -20,40 +20,40 @@ class InlineDataTest < ActiveSupport::TestCase
20
20
  test 'serialization' do
21
21
  values = ['foo', 'bar']
22
22
  assert_equal 'foo, bar',
23
- Iqvoc::InlineDataHelper.generate_inline_values(values)
23
+ InlineDataHelper.generate_inline_values(values)
24
24
 
25
25
  values = ['lorem', 'foo, bar', 'ipsum']
26
26
  assert_equal 'lorem, "foo, bar", ipsum',
27
- Iqvoc::InlineDataHelper.generate_inline_values(values)
27
+ InlineDataHelper.generate_inline_values(values)
28
28
  end
29
29
 
30
30
  test 'deserialization' do
31
31
  inline_values = 'foo, bar'
32
32
  assert_equal ['foo', 'bar'],
33
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
33
+ InlineDataHelper.parse_inline_values(inline_values)
34
34
 
35
35
  inline_values = 'lorem, "foo, bar", ipsum'
36
36
  assert_equal ['lorem', 'foo, bar', 'ipsum'],
37
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
37
+ InlineDataHelper.parse_inline_values(inline_values)
38
38
 
39
39
  inline_values = 'lorem,"foo, bar",ipsum'
40
40
  assert_equal ['lorem', 'foo, bar', 'ipsum'],
41
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
41
+ InlineDataHelper.parse_inline_values(inline_values)
42
42
 
43
43
  inline_values = 'foo, bar,baz' # inconsistent whitespace
44
44
  assert_equal ['foo', 'bar', 'baz'],
45
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
45
+ InlineDataHelper.parse_inline_values(inline_values)
46
46
 
47
47
  inline_values = 'lorem,"foo, bar", ipsum' # inconsistent whitespace
48
48
  assert_equal ['lorem', 'foo, bar', 'ipsum'],
49
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
49
+ InlineDataHelper.parse_inline_values(inline_values)
50
50
 
51
51
  inline_values = 'lorem, "foo, bar",ipsum' # inconsistent whitespace
52
52
  assert_raises(CSV::MalformedCSVError) do
53
- Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
53
+ InlineDataHelper.parse_inline_values(inline_values)
54
54
  end
55
55
 
56
56
  inline_values = ''
57
- assert_equal [], Iqvoc::InlineDataHelper.parse_inline_values(inline_values)
57
+ assert_equal [], InlineDataHelper.parse_inline_values(inline_values)
58
58
  end
59
59
  end