iqvoc 4.14.5 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +9 -16
- data/Gemfile.lock +313 -257
- data/README.md +1 -1
- data/app/aides/entity_logger.rb +27 -0
- data/app/aides/maker.rb +1 -1
- data/app/aides/origin.rb +1 -1
- data/app/aides/{rdfapi.rb → rdf_api.rb} +1 -1
- data/app/aides/skos_importer.rb +1 -1
- data/app/assets/javascripts/iqvoc/iqvoc.js +4 -3
- data/app/assets/javascripts/iqvoc/treeview.js +3 -3
- data/app/assets/stylesheets/_framework.scss +1 -1
- data/app/controllers/collections/alphabetical_controller.rb +75 -0
- data/app/controllers/collections/expired_controller.rb +37 -0
- data/app/controllers/collections_controller.rb +22 -28
- data/app/controllers/concepts/alphabetical_controller.rb +4 -6
- data/app/controllers/concepts/expired_controller.rb +1 -1
- data/app/controllers/concepts/hierarchical_controller.rb +18 -15
- data/app/controllers/concepts_controller.rb +0 -3
- data/app/controllers/concepts_movement_controller.rb +1 -1
- data/app/controllers/concerns/controller_extensions.rb +15 -0
- data/app/controllers/dashboard_controller.rb +1 -1
- data/app/controllers/exports_controller.rb +17 -8
- data/app/controllers/rdf_controller.rb +0 -2
- data/app/controllers/remote_labels_controller.rb +0 -2
- data/app/controllers/search_results_controller.rb +59 -43
- data/app/helpers/concepts_helper.rb +2 -2
- data/app/helpers/navigation_helper.rb +7 -7
- data/app/helpers/rdf_helper.rb +2 -0
- data/app/jobs/export_job.rb +4 -7
- data/app/models/collection/base.rb +6 -8
- data/app/models/collection/member/skos/base.rb +2 -2
- data/app/models/collection/skos/base.rb +1 -1
- data/app/models/collection/skos/unordered.rb +1 -1
- data/app/models/collection/unordered.rb +2 -2
- data/app/models/concept/base.rb +2 -10
- data/app/models/concept/relation/base.rb +1 -1
- data/app/models/concept/relation/skos/base.rb +2 -2
- data/app/models/concept/relation/skos/broader/base.rb +2 -2
- data/app/models/concept/relation/skos/broader/mono.rb +1 -1
- data/app/models/concept/relation/skos/broader/poly.rb +1 -1
- data/app/models/concept/relation/skos/narrower/base.rb +1 -1
- data/app/models/concept/relation/skos/related.rb +1 -1
- data/app/models/concept/skos/base.rb +1 -1
- data/app/models/concept/skos/scheme.rb +2 -2
- data/app/models/concept/validations.rb +14 -0
- data/app/models/concerns/expirable.rb +14 -0
- data/app/models/export.rb +21 -9
- data/app/models/label/base.rb +19 -1
- data/app/models/label/skos/base.rb +1 -1
- data/app/models/labeling/base.rb +12 -0
- data/app/models/labeling/skos/alt_label.rb +1 -1
- data/app/models/labeling/skos/base.rb +4 -4
- data/app/models/labeling/skos/hidden_label.rb +1 -1
- data/app/models/labeling/skos/pref_label.rb +1 -1
- data/app/models/match/skos/base.rb +3 -3
- data/app/models/match/skos/broad_match.rb +2 -2
- data/app/models/match/skos/close_match.rb +1 -1
- data/app/models/match/skos/exact_match.rb +1 -1
- data/app/models/match/skos/mapping_relation.rb +1 -1
- data/app/models/match/skos/narrow_match.rb +2 -2
- data/app/models/match/skos/related_match.rb +1 -1
- data/app/models/note/base.rb +2 -2
- data/app/models/note/rdfs/see_also.rb +1 -1
- data/app/models/note/skos/base.rb +4 -4
- data/app/models/note/skos/change_note.rb +2 -2
- data/app/models/note/skos/definition.rb +1 -1
- data/app/models/note/skos/editorial_note.rb +1 -1
- data/app/models/note/skos/example.rb +1 -1
- data/app/models/note/skos/history_note.rb +1 -1
- data/app/models/note/skos/scope_note.rb +1 -1
- data/app/presenters/alphabetical_search_result.rb +2 -2
- data/app/services/rdf_sync_service.rb +1 -1
- data/app/uploaders/base.rb +4 -3
- data/app/view_models/concept_view.rb +1 -1
- data/app/views/collections/_data.html.erb +1 -1
- data/app/views/collections/_form.html.erb +14 -2
- data/app/views/collections/alphabetical/_search_result.html.erb +17 -0
- data/app/views/collections/alphabetical/_search_result_remote.html.erb +14 -0
- data/app/views/collections/alphabetical/index.html.erb +23 -0
- data/app/views/collections/edit.html.erb +1 -1
- data/app/views/collections/expired/index.html.erb +23 -0
- data/app/views/collections/index.html.erb +1 -1
- data/app/views/collections/new.html.erb +1 -1
- data/app/views/collections/show_published.html.erb +1 -1
- data/app/views/collections/show_unpublished.html.erb +1 -1
- data/app/views/collections/sidebars/_plural.html.erb +28 -0
- data/app/views/collections/sidebars/_singular.html.erb +22 -0
- data/app/views/concepts/_form.html.erb +1 -1
- data/app/views/concepts/alphabetical/index.html.erb +1 -1
- data/app/views/concepts/expired/index.html.erb +1 -1
- data/app/views/concepts/glance.html.erb +1 -1
- data/app/views/concepts/scheme/edit.html.erb +1 -1
- data/app/views/concepts/sidebars/_plural.html.erb +1 -1
- data/app/views/concepts/sidebars/_singular.html.erb +1 -1
- data/app/views/dashboard/glance.html.erb +1 -1
- data/app/views/exports/index.html.erb +5 -1
- data/app/views/exports/show.html.erb +1 -1
- data/app/views/partials/collection/_inline_base.html.erb +4 -0
- data/app/views/search_results/_sidebar.html.erb +1 -1
- data/config/application.rb +7 -2
- data/config/ci.rb +20 -0
- data/config/database.yml +15 -21
- data/config/database.yml.postgresql +13 -20
- data/config/engine.rb +1 -0
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +1 -1
- data/config/initializers/content_security_policy.rb +6 -2
- data/config/initializers/filter_parameter_logging.rb +4 -4
- data/config/initializers/new_framework_defaults_7_1.rb +280 -0
- data/config/initializers/new_framework_defaults_8_0.rb +30 -0
- data/config/initializers/new_framework_defaults_8_1.rb +74 -0
- data/config/initializers/permissions_policy.rb +11 -9
- data/config/initializers/zeitwerk.rb +1 -3
- data/config/locales/de.yml +4 -1
- data/config/locales/en.yml +4 -1
- data/config/locales/pt.yml +2 -1
- data/config/puma.rb +34 -35
- data/config/routes.rb +3 -1
- data/db/migrate/20110510162719_use_mono_hierarchy_instead_of_poly_hierarchy.rb +2 -2
- data/db/migrate/20130227145825_fix_collection_type.rb +3 -3
- data/db/migrate/20130502151221_fix_collection_member_types.rb +1 -1
- data/db/migrate/20250218160045_adapt_zeitwerk_naming_to_iqvoc.rb +25 -0
- data/db/migrate/20250326182601_adapt_zeitwerk_skos_naming_to_instance_configuration.rb +11 -0
- data/db/schema.rb +100 -1
- data/iqvoc.gemspec +4 -4
- data/lib/iqvoc/configuration/collection.rb +16 -4
- data/lib/iqvoc/configuration/concept.rb +22 -18
- data/lib/iqvoc/configuration/core.rb +9 -23
- data/lib/iqvoc/configuration/label.rb +1 -1
- data/lib/iqvoc/environments/development.rb +62 -57
- data/lib/iqvoc/environments/production.rb +70 -67
- data/lib/iqvoc/environments/test.rb +44 -38
- data/lib/iqvoc/version.rb +1 -1
- data/test/controllers/concepts_movement_controller_test.rb +14 -14
- data/test/controllers/hierarchy_test.rb +0 -1
- data/test/controllers/reverse_match_test.rb +6 -6
- data/test/integration/alphabetical_test.rb +5 -5
- data/test/integration/browse_concepts_and_labels_test.rb +4 -4
- data/test/integration/client_edit_concept_test.rb +1 -1
- data/test/integration/collection_browsing_test.rb +2 -2
- data/test/integration/collection_circularity_test.rb +10 -10
- data/test/integration/collection_test.rb +79 -0
- data/test/integration/concept_browsing_test.rb +3 -3
- data/test/integration/concept_collection_assignment_test.rb +4 -4
- data/test/integration/concept_scheme_browsing_test.rb +7 -7
- data/test/integration/edit_collections_test.rb +1 -1
- data/test/integration/edit_concepts_test.rb +2 -2
- data/test/integration/instance_configuration_browsing_test.rb +1 -1
- data/test/integration/note_annotations_test.rb +2 -2
- data/test/integration/reverse_match_job_test.rb +9 -9
- data/test/integration/search_test.rb +20 -10
- data/test/integration/tree_test.rb +5 -5
- data/test/integration/untranslated_test.rb +2 -2
- data/test/integration_test_helper.rb +7 -0
- data/test/models/concept_scheme_test.rb +6 -6
- data/test/models/concept_test.rb +38 -38
- data/test/models/deep_cloning_test.rb +6 -6
- data/test/models/note_test.rb +4 -4
- data/test/models/rdf_sync_test.rb +1 -1
- data/test/models/rdfapi_test.rb +24 -24
- data/test/models/skos_collection_import_test.rb +3 -3
- data/test/models/skos_import_test.rb +4 -4
- metadata +44 -32
- data/app/views/collections/_sidebar.html.erb +0 -20
- data/config/environments/heroku.rb +0 -81
- data/config/initializers/heroku.rb +0 -24
- data/config/secrets.yml +0 -35
- /data/{app/helpers → lib}/iqvoc_module_helper.rb +0 -0
- /data/{app/models/concerns → lib}/search_extension.rb +0 -0
|
@@ -18,7 +18,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
|
|
|
18
18
|
|
|
19
19
|
class ConceptSchemeBrowsingTest < ActionDispatch::IntegrationTest
|
|
20
20
|
test 'list top concepts in rdf scheme' do
|
|
21
|
-
@concept = Concept::
|
|
21
|
+
@concept = Concept::Skos::Base.new(top_term: true).publish.tap { |c| c.save }
|
|
22
22
|
|
|
23
23
|
visit '/scheme.ttl'
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ class ConceptSchemeBrowsingTest < ActionDispatch::IntegrationTest
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
test 'top concepts rdf' do
|
|
30
|
-
@concept = Concept::
|
|
30
|
+
@concept = Concept::Skos::Base.new(top_term: true).publish.tap { |c| c.save }
|
|
31
31
|
|
|
32
32
|
visit "/#{@concept.origin}.ttl"
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ class ConceptSchemeBrowsingTest < ActionDispatch::IntegrationTest
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
test 'non-top-concept in scheme' do
|
|
38
|
-
non_top_concept = Concept::
|
|
38
|
+
non_top_concept = Concept::Skos::Base.new(top_term: false).publish.tap { |c| c.save }
|
|
39
39
|
|
|
40
40
|
visit "/#{non_top_concept.origin}.ttl"
|
|
41
41
|
|
|
@@ -49,10 +49,10 @@ class ConceptSchemeBrowsingTest < ActionDispatch::IntegrationTest
|
|
|
49
49
|
assert !page.has_link?('Tree 2', href: 'http://www.example.com/en/concepts/foo_1.html')
|
|
50
50
|
assert !page.has_link?('Tree 2', href: 'http://www.example.com/en/concepts/foo_2.html')
|
|
51
51
|
|
|
52
|
-
concept1 = Concept::
|
|
53
|
-
|
|
54
|
-
concept2 = Concept::
|
|
55
|
-
|
|
52
|
+
concept1 = Concept::Skos::Base.new(origin: 'foo_1', top_term: false).publish.tap { |c| c.save }
|
|
53
|
+
RdfApi.devour concept1, 'skos:prefLabel', '"Tree 2"@en'
|
|
54
|
+
concept2 = Concept::Skos::Base.new(origin: 'foo_2', top_term: false).publish.tap { |c| c.save }
|
|
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)
|
|
@@ -2,7 +2,7 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
|
|
|
2
2
|
|
|
3
3
|
class EditCollectionsTest < ActionDispatch::IntegrationTest
|
|
4
4
|
setup do
|
|
5
|
-
@collection = Collection::
|
|
5
|
+
@collection = Collection::Skos::Unordered.new.publish.tap { |c| c.save }
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
test 'create a new collection version' do
|
|
@@ -18,8 +18,8 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
|
|
|
18
18
|
|
|
19
19
|
class EditConceptsTest < ActionDispatch::IntegrationTest
|
|
20
20
|
setup do
|
|
21
|
-
@concept = Concept::
|
|
22
|
-
|
|
21
|
+
@concept = Concept::Skos::Base.new.tap do |c|
|
|
22
|
+
RdfApi.devour c, 'skos:prefLabel', '"foo"@en'
|
|
23
23
|
c.publish
|
|
24
24
|
c.save
|
|
25
25
|
end
|
|
@@ -36,7 +36,7 @@ class InstanceConfigurationTest < ActionDispatch::IntegrationTest
|
|
|
36
36
|
assert_equal '/en/config.html', page.current_path
|
|
37
37
|
assert page.has_css?('input#config_title')
|
|
38
38
|
assert page.has_selector?(:xpath, '//input[@id="config_languages.pref_labeling"]')
|
|
39
|
-
assert page.has_selector?(:xpath, '//input[@id="config_languages.further_labelings.Labeling::
|
|
39
|
+
assert page.has_selector?(:xpath, '//input[@id="config_languages.further_labelings.Labeling::Skos::AltLabel"]')
|
|
40
40
|
assert page.has_selector?(:xpath, '//input[@id="config_languages.notes"]')
|
|
41
41
|
|
|
42
42
|
# TODO: also test POST
|
|
@@ -93,7 +93,7 @@ class NoteAnnotationsTest < ActionDispatch::IntegrationTest
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
test 'rdf for localized note annotations' do
|
|
96
|
-
rdfapi =
|
|
96
|
+
rdfapi = RdfApi
|
|
97
97
|
|
|
98
98
|
concept = rdfapi.devour *%w(foobar a skos:Concept)
|
|
99
99
|
concept.publish
|
|
@@ -101,7 +101,7 @@ class NoteAnnotationsTest < ActionDispatch::IntegrationTest
|
|
|
101
101
|
|
|
102
102
|
rdfapi.devour concept, 'skos:prefLabel', '"foo"@en'
|
|
103
103
|
|
|
104
|
-
note = Note::
|
|
104
|
+
note = Note::Rdfs::SeeAlso.create owner: concept, value: 'foo', language: 'en', position: 1
|
|
105
105
|
note.annotations.create namespace: 'dct', predicate: 'title', value: 'Foo Bar', language: 'en'
|
|
106
106
|
note.annotations.create namespace: 'foaf', predicate: 'page', value: 'http://google.de/'
|
|
107
107
|
|
|
@@ -21,14 +21,14 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
21
21
|
include ReverseMatchErrors
|
|
22
22
|
|
|
23
23
|
setup do
|
|
24
|
-
@achievement_hobbies = Concept::
|
|
25
|
-
|
|
24
|
+
@achievement_hobbies = Concept::Skos::Base.new.tap do |c|
|
|
25
|
+
RdfApi.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
|
|
26
26
|
c.publish
|
|
27
27
|
c.save
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
@airsoft = Concept::
|
|
31
|
-
|
|
30
|
+
@airsoft = Concept::Skos::Base.new(origin: 'airsoft').tap do |c|
|
|
31
|
+
RdfApi.devour c, 'skos:prefLabel', '"Airsoft"@en'
|
|
32
32
|
c.publish
|
|
33
33
|
c.save
|
|
34
34
|
end
|
|
@@ -68,7 +68,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
68
68
|
})
|
|
69
69
|
.to_return(status: status, body: body.to_json, headers: {})
|
|
70
70
|
|
|
71
|
-
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::
|
|
71
|
+
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::Skos::BroadMatch')
|
|
72
72
|
@reverse_match_service.add(job)
|
|
73
73
|
|
|
74
74
|
job = Delayed::Job.last
|
|
@@ -82,7 +82,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
82
82
|
stub_request(:patch, 'http://0.0.0.0:3000/airsoft/add_match?match_class=match_skos_broadmatch&uri=http://try.iqvoc.com/airsoft')
|
|
83
83
|
.to_timeout
|
|
84
84
|
|
|
85
|
-
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::
|
|
85
|
+
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::Skos::BroadMatch')
|
|
86
86
|
@reverse_match_service.add(job)
|
|
87
87
|
|
|
88
88
|
job = Delayed::Job.last
|
|
@@ -98,7 +98,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
98
98
|
stub_request(:patch, 'http://0.0.0.0:3000/airsoft/add_match?match_class=match_skos_broadmatch&uri=http://try.iqvoc.com/airsoft')
|
|
99
99
|
.to_raise(Errno::ECONNREFUSED)
|
|
100
100
|
|
|
101
|
-
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::
|
|
101
|
+
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::Skos::BroadMatch')
|
|
102
102
|
@reverse_match_service.add(job)
|
|
103
103
|
|
|
104
104
|
job = Delayed::Job.last
|
|
@@ -114,7 +114,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
114
114
|
stub_request(:patch, 'http://0.0.0.0:3000/airsoft/add_match?match_class=match_skos_broadmatch&uri=http://try.iqvoc.com/airsoft')
|
|
115
115
|
.to_return(status: 404)
|
|
116
116
|
|
|
117
|
-
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::
|
|
117
|
+
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::Skos::BroadMatch')
|
|
118
118
|
@reverse_match_service.add(job)
|
|
119
119
|
|
|
120
120
|
job = Delayed::Job.last
|
|
@@ -136,7 +136,7 @@ class ReverseMatchJobTest < ActiveSupport::TestCase
|
|
|
136
136
|
})
|
|
137
137
|
.to_return(status: status, body: body.to_json, headers: {})
|
|
138
138
|
|
|
139
|
-
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::
|
|
139
|
+
job = @reverse_match_service.build_job(:add_match, @airsoft, 'http://try.iqvoc.com', 'Match::Skos::BroadMatch')
|
|
140
140
|
@reverse_match_service.add(job)
|
|
141
141
|
|
|
142
142
|
job = Delayed::Job.last
|
|
@@ -20,22 +20,22 @@ class SearchTest < ActionDispatch::IntegrationTest
|
|
|
20
20
|
Kaminari.config.default_per_page = 5
|
|
21
21
|
|
|
22
22
|
@concepts = %w("Tree"@en "Forest"@en).map do |literal|
|
|
23
|
-
Concept::
|
|
24
|
-
|
|
23
|
+
Concept::Skos::Base.new.tap do |c|
|
|
24
|
+
RdfApi.devour c, 'skos:prefLabel', literal
|
|
25
25
|
c.publish
|
|
26
26
|
c.save
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
@collection = Collection::
|
|
31
|
-
|
|
30
|
+
@collection = Collection::Skos::Unordered.new.tap do |c|
|
|
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
|
-
|
|
38
|
+
RdfApi.devour @collection, 'skos:member', c
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -150,12 +150,12 @@ class SearchTest < ActionDispatch::IntegrationTest
|
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
test 'searching specific classes within collections' do
|
|
153
|
-
concept = Concept::
|
|
154
|
-
|
|
153
|
+
concept = Concept::Skos::Base.new.tap do |c|
|
|
154
|
+
RdfApi.devour c, 'skos:definition', '"lorem ipsum"@en'
|
|
155
155
|
c.publish
|
|
156
156
|
c.save
|
|
157
157
|
end
|
|
158
|
-
|
|
158
|
+
RdfApi.devour @collection, 'skos:member', concept
|
|
159
159
|
|
|
160
160
|
visit search_path(lang: 'en', format: 'html')
|
|
161
161
|
|
|
@@ -198,8 +198,8 @@ class SearchTest < ActionDispatch::IntegrationTest
|
|
|
198
198
|
test 'pagination' do
|
|
199
199
|
# create a large number of concepts
|
|
200
200
|
1.upto(12) do |i|
|
|
201
|
-
Concept::
|
|
202
|
-
|
|
201
|
+
Concept::Skos::Base.new.tap do |c|
|
|
202
|
+
RdfApi.devour c, 'skos:prefLabel', "\"sample_#{sprintf('_%04d', i)}\"@en"
|
|
203
203
|
c.publish
|
|
204
204
|
c.save
|
|
205
205
|
end
|
|
@@ -239,4 +239,14 @@ class SearchTest < ActionDispatch::IntegrationTest
|
|
|
239
239
|
assert page.source.include?('#result2">')
|
|
240
240
|
assert !page.source.include?('#result3">') # we're on page 3/3
|
|
241
241
|
end
|
|
242
|
+
|
|
243
|
+
test 'api searching with empty search query' do
|
|
244
|
+
%w(ttl nt rdf).each do |format|
|
|
245
|
+
get search_url(lang: 'en', format: format)
|
|
246
|
+
assert_response :bad_request, 'should return bad request without search query'
|
|
247
|
+
|
|
248
|
+
get search_url(lang: 'en', format: format, query: '')
|
|
249
|
+
assert_response :bad_request, 'should return bad request with blank search query'
|
|
250
|
+
end
|
|
251
|
+
end
|
|
242
252
|
end
|
|
@@ -18,15 +18,15 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test
|
|
|
18
18
|
|
|
19
19
|
class TreeTest < ActionDispatch::IntegrationTest
|
|
20
20
|
test 'browse hierarchical concepts tree' do
|
|
21
|
-
narrower_concept = Concept::
|
|
22
|
-
|
|
21
|
+
narrower_concept = Concept::Skos::Base.new.tap do |c|
|
|
22
|
+
RdfApi.devour c, 'skos:prefLabel', '"Narrower"@en'
|
|
23
23
|
c.publish
|
|
24
24
|
c.save
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
concept = Concept::
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
concept = Concept::Skos::Base.new(top_term: true).tap do |c|
|
|
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
|
|
@@ -23,9 +23,9 @@ class UntranslatedConceptsTest < ActionDispatch::IntegrationTest
|
|
|
23
23
|
{ en: 'Yen1', de: 'Yde1' },
|
|
24
24
|
{ en: 'Yen2' }
|
|
25
25
|
].each do |hsh|
|
|
26
|
-
concept = Concept::
|
|
26
|
+
concept = Concept::Skos::Base.new
|
|
27
27
|
hsh.each do |lang, value|
|
|
28
|
-
|
|
28
|
+
RdfApi.devour concept, 'skos:prefLabel', "\"#{value}\"@#{lang}"
|
|
29
29
|
end
|
|
30
30
|
concept.publish.save
|
|
31
31
|
end
|
|
@@ -22,6 +22,13 @@ require File.expand_path('authentication', File.dirname(__FILE__))
|
|
|
22
22
|
|
|
23
23
|
Capybara.server = :webrick
|
|
24
24
|
Capybara.javascript_driver = :cuprite
|
|
25
|
+
Capybara.register_driver(:cuprite) do |app|
|
|
26
|
+
if ENV["CI"].present?
|
|
27
|
+
Capybara::Cuprite::Driver.new(app, browser_options: { 'no-sandbox': nil })
|
|
28
|
+
else
|
|
29
|
+
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
25
32
|
|
|
26
33
|
WebMock.allow_net_connect! # required for integration tests
|
|
27
34
|
|
|
@@ -18,18 +18,18 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
|
|
18
18
|
|
|
19
19
|
class ConceptSchemeTest < ActiveSupport::TestCase
|
|
20
20
|
test 'singleton concept scheme' do
|
|
21
|
-
assert_equal 0, Concept::
|
|
21
|
+
assert_equal 0, Concept::Skos::Scheme.count
|
|
22
22
|
|
|
23
|
-
assert_difference 'Concept::
|
|
24
|
-
Concept::
|
|
23
|
+
assert_difference 'Concept::Skos::Scheme.count' do
|
|
24
|
+
Concept::Skos::Scheme.instance
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
assert_no_difference 'Concept::
|
|
28
|
-
Concept::
|
|
27
|
+
assert_no_difference 'Concept::Skos::Scheme.count' do
|
|
28
|
+
Concept::Skos::Scheme.instance
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
assert_raise TypeError do
|
|
32
|
-
Concept::
|
|
32
|
+
Concept::Skos::Scheme.create
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
data/test/models/concept_test.rb
CHANGED
|
@@ -41,7 +41,7 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
test 'concept with no preflabel' do
|
|
44
|
-
concept =
|
|
44
|
+
concept = RdfApi.devour 'bear', 'a', 'skos:Concept'
|
|
45
45
|
|
|
46
46
|
assert concept.save
|
|
47
47
|
refute concept.publishable?
|
|
@@ -51,15 +51,15 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
test 'concepts without pref_labels should be saveable but not publishable' do
|
|
54
|
-
concept =
|
|
54
|
+
concept = RdfApi.devour 'bear', 'a', 'skos:Concept'
|
|
55
55
|
assert_equal [], concept.pref_labels
|
|
56
56
|
assert concept.valid?
|
|
57
57
|
refute concept.publishable?
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
test 'published concept must have a pref_label of the first pref_label language configured (the main language)' do
|
|
61
|
-
concept =
|
|
62
|
-
|
|
61
|
+
concept = RdfApi.devour 'bear', 'a', 'skos:Concept'
|
|
62
|
+
RdfApi.devour concept, 'skos:prefLabel', '"Bear"@en'
|
|
63
63
|
|
|
64
64
|
assert concept.save
|
|
65
65
|
|
|
@@ -72,14 +72,14 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
test 'one pref label per language' do
|
|
75
|
-
concept = Concept::
|
|
76
|
-
|
|
75
|
+
concept = Concept::Skos::Base.new.tap do |c|
|
|
76
|
+
RdfApi.devour c, 'skos:prefLabel', '"Bear"@en'
|
|
77
77
|
c.publish
|
|
78
78
|
c.save
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
assert concept.valid?
|
|
82
|
-
|
|
82
|
+
RdfApi.devour concept, 'skos:prefLabel', '"Beaaar"@en'
|
|
83
83
|
concept.pref_labelings.reload
|
|
84
84
|
assert_equal 2, concept.pref_labelings.count
|
|
85
85
|
assert_equal concept.pref_labelings.first.target.language, concept.pref_labelings.second.target.language
|
|
@@ -87,29 +87,29 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
test 'unique pref label' do
|
|
90
|
-
bear_one =
|
|
91
|
-
|
|
90
|
+
bear_one = RdfApi.devour 'bear_one', 'a', 'skos:Concept'
|
|
91
|
+
RdfApi.devour bear_one, 'skos:prefLabel', '"Bear"@en'
|
|
92
92
|
|
|
93
93
|
assert bear_one.save
|
|
94
94
|
assert bear_one.publishable?
|
|
95
95
|
|
|
96
|
-
bear_two =
|
|
97
|
-
|
|
96
|
+
bear_two = RdfApi.devour 'bear_two', 'a', 'skos:Concept'
|
|
97
|
+
RdfApi.devour bear_two, 'skos:prefLabel', '"Bear"@en'
|
|
98
98
|
|
|
99
99
|
bear_two.save!
|
|
100
100
|
refute bear_two.publishable?
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
test 'unique alt labels' do
|
|
104
|
-
tiger =
|
|
105
|
-
|
|
104
|
+
tiger = RdfApi.devour 'tiger', 'a', 'skos:Concept'
|
|
105
|
+
RdfApi.devour tiger, 'skos:prefLabel', '"Tiger"@en'
|
|
106
106
|
|
|
107
107
|
assert tiger.save
|
|
108
108
|
assert tiger.publishable?
|
|
109
109
|
|
|
110
110
|
# two identical alt labels
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
RdfApi.devour tiger, 'skos:altLabel', '"Big cat"@en'
|
|
112
|
+
RdfApi.devour tiger, 'skos:altLabel', '"Big cat"@en'
|
|
113
113
|
|
|
114
114
|
tiger.save!
|
|
115
115
|
tiger.reload
|
|
@@ -117,14 +117,14 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
test 'distinct labels' do
|
|
120
|
-
monkey =
|
|
121
|
-
|
|
120
|
+
monkey = RdfApi.devour 'Monkey', 'a', 'skos:Concept'
|
|
121
|
+
RdfApi.devour monkey, 'skos:prefLabel', '"Monkey"@en'
|
|
122
122
|
|
|
123
123
|
assert monkey.save
|
|
124
124
|
assert monkey.publishable?
|
|
125
125
|
|
|
126
126
|
# identical to pref label
|
|
127
|
-
|
|
127
|
+
RdfApi.devour monkey, 'skos:altLabel', '"Monkey"@en'
|
|
128
128
|
|
|
129
129
|
monkey.save!
|
|
130
130
|
monkey.reload
|
|
@@ -132,9 +132,9 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
test 'multiple pref labels of different languages' do
|
|
135
|
-
concept =
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
concept = RdfApi.devour 'bear', 'a', 'skos:Concept'
|
|
136
|
+
RdfApi.devour concept, 'skos:prefLabel', '"Bear"@en'
|
|
137
|
+
RdfApi.devour concept, 'skos:prefLabel', '"Bär"@de'
|
|
138
138
|
|
|
139
139
|
assert concept.save
|
|
140
140
|
concept.reload
|
|
@@ -145,7 +145,7 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
test 'labelings_by_text setter' do
|
|
148
|
-
concept = Concept::
|
|
148
|
+
concept = Concept::Skos::Base.new
|
|
149
149
|
|
|
150
150
|
concept.labelings_by_text = {
|
|
151
151
|
Iqvoc::Concept.pref_labeling_class_name.to_relation_name => {
|
|
@@ -181,11 +181,11 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
181
181
|
}
|
|
182
182
|
concept = Iqvoc::Concept.base_class.create(form_data)
|
|
183
183
|
|
|
184
|
-
assert_equal ['lipsum'], labels_for.call(concept, Labeling::
|
|
184
|
+
assert_equal ['lipsum'], labels_for.call(concept, Labeling::Skos::PrefLabel)
|
|
185
185
|
assert_equal 'lipsum',
|
|
186
186
|
concept.labelings_by_text('labeling_skos_pref_labels', 'en')
|
|
187
187
|
assert_equal ['foo', 'bar'],
|
|
188
|
-
labels_for.call(concept, Labeling::
|
|
188
|
+
labels_for.call(concept, Labeling::Skos::AltLabel)
|
|
189
189
|
assert_equal 'foo, bar',
|
|
190
190
|
concept.labelings_by_text('labeling_skos_alt_labels', 'en')
|
|
191
191
|
|
|
@@ -197,24 +197,24 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
197
197
|
}
|
|
198
198
|
concept = Iqvoc::Concept.base_class.create(form_data)
|
|
199
199
|
|
|
200
|
-
assert_equal ['lipsum'], labels_for.call(concept, Labeling::
|
|
200
|
+
assert_equal ['lipsum'], labels_for.call(concept, Labeling::Skos::PrefLabel)
|
|
201
201
|
assert_equal 'lipsum',
|
|
202
202
|
concept.labelings_by_text('labeling_skos_pref_labels', 'en')
|
|
203
203
|
assert_equal ['lorem', 'foo, bar', 'ipsum'],
|
|
204
|
-
labels_for.call(concept, Labeling::
|
|
204
|
+
labels_for.call(concept, Labeling::Skos::AltLabel)
|
|
205
205
|
assert_equal 'lorem, "foo, bar", ipsum',
|
|
206
206
|
concept.labelings_by_text('labeling_skos_alt_labels', 'en')
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
test 'no narrower and broader concept relation' do
|
|
210
|
-
bear_concept =
|
|
211
|
-
|
|
210
|
+
bear_concept = RdfApi.devour 'bear', 'a', 'skos:Concept'
|
|
211
|
+
RdfApi.devour bear_concept, 'skos:prefLabel', '"Bear"@en'
|
|
212
212
|
bear_concept.save
|
|
213
213
|
|
|
214
|
-
concept =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
concept = RdfApi.devour 'forest', 'a', 'skos:Concept'
|
|
215
|
+
RdfApi.devour concept, 'skos:prefLabel', '"Forest"@en'
|
|
216
|
+
RdfApi.devour concept, 'skos:narrower', bear_concept
|
|
217
|
+
RdfApi.devour concept, 'skos:broader', bear_concept
|
|
218
218
|
assert concept.save!
|
|
219
219
|
assert_equal 1, concept.narrower_relations.count
|
|
220
220
|
assert_equal 1, concept.broader_relations.count
|
|
@@ -227,25 +227,25 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
227
227
|
end
|
|
228
228
|
|
|
229
229
|
test 'concept self reference validation' do
|
|
230
|
-
wolf_concept =
|
|
231
|
-
|
|
230
|
+
wolf_concept = RdfApi.devour 'wolf', 'a', 'skos:Concept'
|
|
231
|
+
RdfApi.devour wolf_concept, 'skos:prefLabel', '"Wolf"@en'
|
|
232
232
|
wolf_concept.save!
|
|
233
233
|
|
|
234
234
|
assert wolf_concept.publishable?
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
RdfApi.devour wolf_concept, 'skos:narrower', wolf_concept
|
|
237
237
|
refute wolf_concept.publishable?
|
|
238
238
|
assert wolf_concept.errors.full_messages_for(:base).include? I18n.t('txt.models.concept.no_self_reference')
|
|
239
239
|
|
|
240
240
|
wolf_concept.relations.delete_all
|
|
241
241
|
assert wolf_concept.reload.publishable?
|
|
242
|
-
|
|
242
|
+
RdfApi.devour wolf_concept, 'skos:broader', wolf_concept
|
|
243
243
|
refute wolf_concept.publishable?
|
|
244
244
|
assert wolf_concept.errors.full_messages_for(:base).include? I18n.t('txt.models.concept.no_self_reference')
|
|
245
245
|
|
|
246
246
|
wolf_concept.relations.delete_all
|
|
247
247
|
assert wolf_concept.reload.publishable?
|
|
248
|
-
|
|
248
|
+
RdfApi.devour wolf_concept, 'skos:related', wolf_concept
|
|
249
249
|
refute wolf_concept.publishable?
|
|
250
250
|
assert wolf_concept.errors.full_messages_for(:base).include? I18n.t('txt.models.concept.no_self_reference')
|
|
251
251
|
end
|
|
@@ -255,7 +255,7 @@ class ConceptTest < ActiveSupport::TestCase
|
|
|
255
255
|
assert_equal 0, Iqvoc::Concept.base_class.expired.count
|
|
256
256
|
|
|
257
257
|
wolf_concept = Iqvoc::Concept.base_class.new(origin: 'wolf').publish.tap do |c|
|
|
258
|
-
|
|
258
|
+
RdfApi.devour c, 'skos:prefLabel', '"Wolf"@en'
|
|
259
259
|
c.save
|
|
260
260
|
end
|
|
261
261
|
refute wolf_concept.expired?
|
|
@@ -34,32 +34,32 @@ class DeepCloningTest < ActiveSupport::TestCase
|
|
|
34
34
|
# - Air Sport
|
|
35
35
|
# + Sports
|
|
36
36
|
@child_concept = Iqvoc::Concept.base_class.new.tap do |c|
|
|
37
|
-
|
|
37
|
+
RdfApi.devour c, 'skos:prefLabel', '"Child Concept"@en'
|
|
38
38
|
c.publish
|
|
39
39
|
c.save
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
@root_concept1 = Iqvoc::Concept.base_class.new(top_term: true, origin: 'root_concept1').tap do |c|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
RdfApi.devour c, 'skos:prefLabel', '"Root Concept 1"@en'
|
|
44
|
+
RdfApi.devour c, 'skos:narrower', @child_concept
|
|
45
45
|
c.publish
|
|
46
46
|
c.save
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
@root_concept2 = Iqvoc::Concept.base_class.new(top_term: true, origin: 'root_concept2').tap do |c|
|
|
50
|
-
|
|
50
|
+
RdfApi.devour c, 'skos:prefLabel', '"Root Concept 2"@en'
|
|
51
51
|
c.publish
|
|
52
52
|
c.save
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
@sub_collection = Iqvoc::Collection.base_class.new(origin: 'sub_collection').tap do |c|
|
|
56
|
-
|
|
56
|
+
RdfApi.devour c, 'skos:prefLabel', '"Sub Collection"@en'
|
|
57
57
|
c.publish
|
|
58
58
|
c.save
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
@root_collection = Iqvoc::Collection.base_class.new(origin: 'root_collection1').tap do |c|
|
|
62
|
-
|
|
62
|
+
RdfApi.devour c, 'skos:prefLabel', '"Root Collection"@en'
|
|
63
63
|
c.publish
|
|
64
64
|
c.save
|
|
65
65
|
end
|
data/test/models/note_test.rb
CHANGED
|
@@ -19,11 +19,11 @@ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
|
|
19
19
|
class NoteTest < ActiveSupport::TestCase
|
|
20
20
|
test 'should parse turtle note annotations' do
|
|
21
21
|
str = '[umt:source <aDisBMS>; umt:thsisn "00000001"; dct:date "2010-04-29"]'
|
|
22
|
-
concept = Concept::
|
|
23
|
-
concept.note_skos_change_notes << ::Note::
|
|
22
|
+
concept = Concept::Skos::Base.create(origin: '_00000001', published_at: Time.now)
|
|
23
|
+
concept.note_skos_change_notes << ::Note::Skos::ChangeNote.new.from_annotation_list!(str)
|
|
24
24
|
|
|
25
|
-
assert_equal 1, Note::
|
|
26
|
-
assert_equal 3, Note::
|
|
25
|
+
assert_equal 1, Note::Skos::ChangeNote.count, 1
|
|
26
|
+
assert_equal 3, Note::Skos::ChangeNote.first.annotations.count, 3
|
|
27
27
|
assert_equal 1, Note::Annotated::Base.where(namespace: 'umt',
|
|
28
28
|
predicate: 'thsisn', value: '"00000001"').count
|
|
29
29
|
end
|