iqvoc 4.7.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +11 -11
- data/Gemfile.lock +178 -122
- data/README.md +39 -24
- data/{test/performance/browsing_test.rb → app/aides/inline_data_helper.rb} +23 -6
- data/app/aides/maker.rb +139 -0
- data/{lib → app/aides}/multi_logger.rb +0 -0
- data/app/aides/origin.rb +47 -0
- data/app/aides/rdfapi.rb +59 -0
- data/app/aides/skos_exporter.rb +151 -0
- data/app/aides/skos_importer.rb +348 -0
- data/app/assets/javascripts/iqvoc/entityselect.js.erb +7 -9
- data/app/controllers/application_controller.rb +1 -3
- data/app/controllers/collections/versions_controller.rb +1 -3
- data/app/controllers/concepts/versions_controller.rb +9 -3
- data/app/controllers/concerns/controller_extensions.rb +109 -0
- data/app/{concerns → controllers/concerns}/reverse_match_errors.rb +0 -0
- data/app/controllers/hierarchy_controller.rb +7 -3
- data/app/controllers/instance_configuration_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +10 -0
- data/app/controllers/search_results_controller.rb +2 -2
- data/app/controllers/triplestore_sync_controller.rb +2 -4
- data/app/helpers/application_helper.rb +1 -1
- data/app/helpers/widget_helper.rb +3 -3
- data/app/jobs/export_job.rb +1 -3
- data/app/jobs/import_job.rb +1 -3
- data/app/models/ability.rb +59 -0
- data/app/models/abstract_user.rb +1 -1
- data/app/models/collection/base.rb +12 -3
- data/app/models/collection/member/skos/base.rb +1 -1
- data/app/models/concept/base.rb +15 -8
- data/app/models/concept/relation/base.rb +1 -1
- data/app/models/concept/relation/skos/base.rb +1 -1
- data/app/models/concept/skos/scheme.rb +1 -1
- data/app/models/concept/validations.rb +1 -1
- data/app/models/concerns/deep_cloning.rb +92 -0
- data/app/models/concerns/first_level_object_scopes.rb +9 -0
- data/app/{concerns → models/concerns}/first_level_object_validations.rb +9 -2
- data/app/models/concerns/rankable.rb +31 -0
- data/app/models/{search_extension.rb → concerns/search_extension.rb} +0 -0
- data/app/{concerns → models/concerns}/versioning.rb +0 -6
- data/app/models/configuration_setting.rb +1 -1
- data/app/models/labeling/skos/base.rb +2 -2
- data/app/models/match/skos/base.rb +2 -2
- data/app/models/note/skos/base.rb +7 -6
- data/app/models/note/skos/change_note.rb +1 -1
- data/{lib/iqvoc/rdf_sync.rb → app/services/rdf_sync_service.rb} +3 -3
- data/app/view_models/concept_view.rb +1 -1
- data/app/views/collections/_form.html.erb +2 -2
- data/app/views/concepts/scheme/edit.html.erb +1 -1
- data/app/views/pages/components.html.erb +45 -0
- data/app/views/pages/version.html.erb +6 -0
- data/app/views/partials/concept/_reverse_match_notice.html.erb +0 -1
- data/app/views/search_results/_sidebar.html.erb +3 -3
- data/config/application.rb +4 -1
- data/config/boot.rb +1 -2
- data/config/database.yml.postgresql +23 -0
- data/config/engine.rb +0 -2
- data/config/environments/heroku.rb +1 -1
- data/config/initializers/inflections.rb +9 -3
- data/config/initializers/iqvoc.rb +1 -7
- data/config/initializers/mime_types.rb +0 -1
- data/config/locales/de.yml +2 -1
- data/config/locales/en.yml +11 -10
- data/config/routes.rb +2 -0
- data/config/travis/database.yml.mysql +9 -0
- data/config/travis/database.yml.postgresql +7 -0
- data/config/travis/database.yml.sqlite +5 -0
- data/db/migrate/20141204151558_add_foreign_key_constraints.rb +23 -0
- data/iqvoc.gemspec +2 -2
- data/lib/generators/app/template.rb +15 -7
- data/lib/iqvoc.rb +2 -1
- data/lib/iqvoc/configuration/core.rb +18 -4
- data/lib/iqvoc/configuration/instance_configuration.rb +125 -0
- data/lib/iqvoc/configuration/navigation.rb +63 -0
- data/lib/iqvoc/environments/development.rb +4 -0
- data/lib/iqvoc/environments/production.rb +11 -12
- data/lib/iqvoc/environments/test.rb +4 -1
- data/lib/iqvoc/version.rb +2 -2
- data/lib/tasks/exporter.rake +1 -4
- data/lib/tasks/importer.rake +1 -5
- data/lib/tasks/sync.rake +1 -2
- data/test/controllers/concept_movement_test.rb +11 -11
- data/test/controllers/hierarchy_test.rb +83 -79
- data/test/controllers/reverse_match_test.rb +2 -2
- data/test/integration/alphabetical_test.rb +2 -3
- data/test/integration/browse_concepts_and_labels_test.rb +2 -2
- data/test/integration/collection_circularity_test.rb +6 -6
- data/test/integration/concept_scheme_browsing_test.rb +2 -2
- data/test/integration/edit_concepts_test.rb +1 -1
- data/test/integration/export_test.rb +5 -3
- data/test/integration/import_test.rb +4 -1
- data/test/integration/instance_configuration_browsing_test.rb +2 -2
- data/test/integration/navigation_test.rb +2 -2
- data/test/integration/note_annotations_test.rb +12 -11
- data/test/integration/reverse_match_job_test.rb +19 -10
- data/test/integration/search_test.rb +6 -6
- data/test/integration/tree_test.rb +3 -3
- data/test/integration/untranslated_test.rb +1 -1
- data/test/models/concept_test.rb +13 -14
- data/test/models/inline_data_test.rb +9 -9
- data/test/models/instance_configuration_test.rb +7 -3
- data/test/models/origin_test.rb +9 -59
- data/test/models/rdf_sync_test.rb +2 -4
- data/test/models/rdfapi_test.rb +0 -2
- data/test/models/skos_collection_import_test.rb +3 -4
- data/test/models/skos_export_test.rb +3 -5
- data/test/models/skos_import_test.rb +12 -10
- data/test/test_helper.rb +0 -1
- data/vendor/assets/stylesheets/{jquery-ui.css.scss → jquery-ui.scss} +0 -0
- data/vendor/assets/stylesheets/{jquery-ui.structure.css.scss → jquery-ui.structure.scss} +0 -0
- data/vendor/assets/stylesheets/{jquery-ui.theme.css.scss → jquery-ui.theme.scss} +0 -0
- metadata +34 -28
- data/lib/iqvoc/ability.rb +0 -60
- data/lib/iqvoc/controller_extensions.rb +0 -111
- data/lib/iqvoc/deep_cloning.rb +0 -90
- data/lib/iqvoc/inline_data_helper.rb +0 -45
- data/lib/iqvoc/instance_configuration.rb +0 -123
- data/lib/iqvoc/maker.rb +0 -141
- data/lib/iqvoc/navigation.rb +0 -61
- data/lib/iqvoc/origin.rb +0 -111
- data/lib/iqvoc/rankable.rb +0 -33
- data/lib/iqvoc/rdfapi.rb +0 -60
- data/lib/iqvoc/skos_exporter.rb +0 -153
- data/lib/iqvoc/skos_importer.rb +0 -337
@@ -16,7 +16,7 @@ module Iqvoc::Environments
|
|
16
16
|
config.eager_load = false
|
17
17
|
|
18
18
|
# Configure static asset server for tests with Cache-Control for performance.
|
19
|
-
config.
|
19
|
+
config.serve_static_files = true
|
20
20
|
config.static_cache_control = 'public, max-age=3600'
|
21
21
|
|
22
22
|
# Show full error reports and disable caching.
|
@@ -34,6 +34,9 @@ module Iqvoc::Environments
|
|
34
34
|
# ActionMailer::Base.deliveries array.
|
35
35
|
config.action_mailer.delivery_method = :test
|
36
36
|
|
37
|
+
# Randomize the order test cases are executed
|
38
|
+
config.active_support.test_order = :random
|
39
|
+
|
37
40
|
# Print deprecation notices to the stderr.
|
38
41
|
config.active_support.deprecation = :stderr
|
39
42
|
|
data/lib/iqvoc/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
# Copyright 2011-
|
3
|
+
# Copyright 2011-2015 innoQ Deutschland GmbH
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -15,5 +15,5 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
module Iqvoc
|
18
|
-
VERSION = "4.
|
18
|
+
VERSION = "4.8.0"
|
19
19
|
end
|
data/lib/tasks/exporter.rake
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require 'multi_logger'
|
2
|
-
|
3
1
|
namespace :iqvoc do
|
4
2
|
|
5
3
|
desc 'Exports iQvoc data to rdf serialization (turtle, ntriples, rdf/xml)'
|
6
4
|
task :export => :environment do
|
7
|
-
require 'iqvoc/skos_exporter'
|
8
5
|
|
9
6
|
raise "You have to specify an rdf serialization format (turtle, ntriples or rdf/xml) for the data file to be exported. Example: rake iqvoc:import TYPE=... NAMESPACE=... [FILE=...]" unless ENV['TYPE']
|
10
7
|
raise "You have to specify a default namespace for the data to be imported. Example: rake iqvoc:import TYPE=... NAMESPACE=... [FILE=...]" unless ENV['NAMESPACE']
|
@@ -15,7 +12,7 @@ namespace :iqvoc do
|
|
15
12
|
timestamp = Time.now.strftime("%Y-%m-%d_%H-%M")
|
16
13
|
file_path = ENV['FILE'] || Rails.root.join(Iqvoc.export_path, "iqvoc_dump-#{timestamp}.#{ENV['TYPE']}").to_s
|
17
14
|
|
18
|
-
exporter =
|
15
|
+
exporter = SkosExporter.new(file_path, ENV['TYPE'], ENV['NAMESPACE'], MultiLogger.new(stdout_logger, Rails.logger))
|
19
16
|
exporter.run
|
20
17
|
end
|
21
18
|
|
data/lib/tasks/importer.rake
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
require 'multi_logger'
|
2
|
-
|
3
1
|
namespace :iqvoc do
|
4
2
|
|
5
3
|
namespace :import do
|
6
4
|
|
7
5
|
desc 'Imports some ntriples data from a given url (URL=...). Use the parameter NAMESPACE=... to define the default namespace used in your data.'
|
8
6
|
task :url => :environment do
|
9
|
-
require 'iqvoc/skos_importer'
|
10
|
-
|
11
7
|
raise "You have to specify an url for the data file to be imported. Example: rake iqvoc:import:url URL=... NAMESPACE=" unless ENV['URL']
|
12
8
|
raise "You have to specify a default namespace for the data to be imported. Example: rake iqvoc:import:url URL=... NAMESPACE=" unless ENV['NAMESPACE']
|
13
9
|
|
@@ -21,7 +17,7 @@ namespace :iqvoc do
|
|
21
17
|
false
|
22
18
|
end
|
23
19
|
|
24
|
-
importer =
|
20
|
+
importer = SkosImporter.new(ENV['URL'], URI.parse(ENV['NAMESPACE']).to_s, MultiLogger.new(stdout_logger, Rails.logger), publish, debug)
|
25
21
|
importer.run
|
26
22
|
end
|
27
23
|
|
data/lib/tasks/sync.rake
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
namespace :sync do
|
2
2
|
task :all, [:host] => :environment do |t, args|
|
3
3
|
require 'iqvoc'
|
4
|
-
require 'iqvoc/rdf_sync'
|
5
4
|
|
6
5
|
if Iqvoc.config["triplestore.url"] == Iqvoc.config.defaults["triplestore.url"] # XXX: duplicates controller
|
7
6
|
puts I18n.t("txt.controllers.triplestore_sync.config_warning")
|
@@ -15,7 +14,7 @@ namespace :sync do
|
|
15
14
|
default_url_options[:host] = ROOT
|
16
15
|
|
17
16
|
class FakeController
|
18
|
-
include
|
17
|
+
include RDFSyncService::Helper
|
19
18
|
delegate :url_helpers, :to => "Rails.application.routes"
|
20
19
|
|
21
20
|
def root_url(*args)
|
@@ -41,18 +41,18 @@ class ConceptMovementTest < ActionController::TestCase
|
|
41
41
|
# + Sports
|
42
42
|
#
|
43
43
|
@air_sports = Concept::SKOS::Base.new.tap do |c|
|
44
|
-
|
44
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Air sports"@en'
|
45
45
|
c.publish
|
46
46
|
c.save
|
47
47
|
end
|
48
48
|
@achievement_hobbies = Concept::SKOS::Base.new(top_term: true).tap do |c|
|
49
|
-
|
50
|
-
|
49
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
|
50
|
+
RDFAPI.devour c, 'skos:narrower', @air_sports
|
51
51
|
c.publish
|
52
52
|
c.save
|
53
53
|
end
|
54
54
|
@sports = Concept::SKOS::Base.new(top_term: true).tap do |c|
|
55
|
-
|
55
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Sports"@en'
|
56
56
|
c.publish
|
57
57
|
c.save
|
58
58
|
end
|
@@ -128,16 +128,16 @@ class ConceptMovementTest < ActionController::TestCase
|
|
128
128
|
|
129
129
|
# create unpublished concepts
|
130
130
|
@air_sports = Concept::SKOS::Base.new.tap do |c|
|
131
|
-
|
131
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Air sports"@en'
|
132
132
|
c.save
|
133
133
|
end
|
134
134
|
@achievement_hobbies = Concept::SKOS::Base.new(top_term: true).tap do |c|
|
135
|
-
|
136
|
-
|
135
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
|
136
|
+
RDFAPI.devour c, 'skos:narrower', @air_sports
|
137
137
|
c.save
|
138
138
|
end
|
139
139
|
@sports = Concept::SKOS::Base.new(top_term: true).tap do |c|
|
140
|
-
|
140
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Sports"@en'
|
141
141
|
c.save
|
142
142
|
end
|
143
143
|
|
@@ -182,8 +182,8 @@ class ConceptMovementTest < ActionController::TestCase
|
|
182
182
|
test 'top term movement' do
|
183
183
|
UserSession.create(@admin)
|
184
184
|
|
185
|
-
assert_equal @achievement_hobbies.top_term
|
186
|
-
assert_equal @sports.top_term
|
185
|
+
assert_equal @achievement_hobbies.top_term?, true
|
186
|
+
assert_equal @sports.top_term?, true
|
187
187
|
|
188
188
|
# move achievement_hobbies (includung childs) to sports
|
189
189
|
patch :move,
|
@@ -204,7 +204,7 @@ class ConceptMovementTest < ActionController::TestCase
|
|
204
204
|
refute @achievement_hobbies_version.published?
|
205
205
|
|
206
206
|
# is not a top_term anymore
|
207
|
-
assert_equal @achievement_hobbies_version.top_term
|
207
|
+
assert_equal @achievement_hobbies_version.top_term?, false
|
208
208
|
|
209
209
|
# test relations
|
210
210
|
assert_equal 1, @sports_version.narrower_relations.size
|
@@ -67,26 +67,26 @@ boot:
|
|
67
67
|
|
68
68
|
test 'permission handling' do
|
69
69
|
get :show, lang: 'en', format: 'html', root: 'root'
|
70
|
-
entries = get_entries('ul.concept-hierarchy li')
|
71
|
-
assert_equal
|
72
|
-
entries = get_entries('ul.concept-hierarchy li li')
|
73
|
-
assert_equal
|
74
|
-
entries = get_entries('ul.concept-hierarchy li li li')
|
75
|
-
assert_equal
|
76
|
-
entries = get_entries('ul.concept-hierarchy li li li li')
|
77
|
-
assert_equal
|
78
|
-
entries = css_select('ul.concept-hierarchy li li li li li')
|
79
|
-
assert_equal entries.length
|
70
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
71
|
+
assert_equal ['Root'], entries
|
72
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li')
|
73
|
+
assert_equal ['Bar', 'Foo'], entries
|
74
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li')
|
75
|
+
assert_equal ['Alpha', 'Bravo'], entries
|
76
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li > ul > li')
|
77
|
+
assert_equal ['Dos', 'Uno'], entries
|
78
|
+
entries = css_select('ul.concept-hierarchy > li > ul > li > ul > li > ul > li > ul > li')
|
79
|
+
assert_equal 0, entries.length # exceeded default depth
|
80
80
|
|
81
81
|
@concepts['bar'].update_attribute('published_at', nil)
|
82
82
|
|
83
83
|
get :show, lang: 'en', format: 'html', root: 'root'
|
84
|
-
entries = get_entries('ul.concept-hierarchy li')
|
85
|
-
assert_equal
|
86
|
-
entries = get_entries('ul.concept-hierarchy li li')
|
87
|
-
assert_equal
|
88
|
-
entries = get_entries('ul.concept-hierarchy li li li')
|
89
|
-
assert_equal entries.length
|
84
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
85
|
+
assert_equal ['Root'], entries
|
86
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li')
|
87
|
+
assert_equal ['Foo'], entries
|
88
|
+
entries = get_entries('ul.concept-hierarchy li > ul > li > ul > li')
|
89
|
+
assert_equal 0, entries.length
|
90
90
|
end
|
91
91
|
|
92
92
|
test 'caching' do
|
@@ -223,125 +223,129 @@ boot:
|
|
223
223
|
|
224
224
|
get :show, lang: 'en', format: 'html', root: 'N/A'
|
225
225
|
assert_response 404
|
226
|
-
assert_equal
|
226
|
+
assert_equal 'no concept matching root parameter', flash[:error]
|
227
227
|
entries = css_select('ul.concept-hierarchy li')
|
228
|
-
assert_equal entries.length
|
228
|
+
assert_equal 0, entries.length
|
229
229
|
|
230
230
|
get :show, lang: 'en', format: 'html', root: 'root'
|
231
231
|
assert_response 200
|
232
|
-
|
233
|
-
entries = get_entries('ul.concept-hierarchy li')
|
234
|
-
assert_equal entries.length
|
235
|
-
assert_equal entries[0]
|
232
|
+
assert_nil flash[:error]
|
233
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
234
|
+
assert_equal 1, entries.length
|
235
|
+
assert_equal 'Root', entries[0]
|
236
236
|
|
237
237
|
get :show, lang: 'en', format: 'html', root: 'root'
|
238
|
-
entries = get_entries('ul.concept-hierarchy li')
|
239
|
-
assert_equal
|
240
|
-
entries = get_entries('ul.concept-hierarchy li li')
|
241
|
-
assert_equal
|
242
|
-
entries = get_entries('ul.concept-hierarchy li li li')
|
243
|
-
assert_equal
|
244
|
-
entries = get_entries('ul.concept-hierarchy li li li li')
|
245
|
-
assert_equal
|
246
|
-
entries = css_select('ul.concept-hierarchy li li li li li')
|
247
|
-
assert_equal entries.length
|
238
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
239
|
+
assert_equal ['Root'], entries
|
240
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li')
|
241
|
+
assert_equal ['Bar', 'Foo'], entries
|
242
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li')
|
243
|
+
assert_equal ['Alpha', 'Bravo'], entries
|
244
|
+
entries = get_entries('ul.concept-hierarchy li > ul > li > ul > li > ul > li')
|
245
|
+
assert_equal ['Dos', 'Uno'], entries
|
246
|
+
entries = css_select('ul.concept-hierarchy > li > ul > li > ul > li > ul > li > ul > li')
|
247
|
+
assert_equal 0, entries.length # exceeded default depth
|
248
248
|
|
249
249
|
get :show, lang: 'en', format: 'html', root: 'bravo'
|
250
|
-
entries = get_entries('ul.concept-hierarchy li')
|
251
|
-
assert_equal
|
252
|
-
entries = get_entries('ul.concept-hierarchy li li')
|
253
|
-
assert_equal
|
254
|
-
entries = get_entries('ul.concept-hierarchy li li li')
|
255
|
-
assert_equal
|
256
|
-
entries = css_select('ul.concept-hierarchy li li li li')
|
257
|
-
assert_equal entries.length
|
250
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
251
|
+
assert_equal ['Bravo'], entries
|
252
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li')
|
253
|
+
assert_equal ['Dos', 'Uno'], entries
|
254
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li')
|
255
|
+
assert_equal ['Ipsum', 'Lorem'], entries
|
256
|
+
entries = css_select('ul.concept-hierarchy > li > ul > li > ul > li > ul > li')
|
257
|
+
assert_equal 0, entries.length
|
258
258
|
|
259
259
|
get :show, lang: 'en', format: 'html', root: 'lorem'
|
260
|
-
entries = get_entries('ul.concept-hierarchy li')
|
261
|
-
assert_equal
|
262
|
-
entries = css_select('ul.concept-hierarchy li li')
|
263
|
-
assert_equal entries.length
|
260
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
261
|
+
assert_equal ['Lorem'], entries
|
262
|
+
entries = css_select('ul.concept-hierarchy > li > ul > li')
|
263
|
+
assert_equal 0, entries.length
|
264
264
|
end
|
265
265
|
|
266
266
|
test 'depth handling' do
|
267
|
-
selector = 'ul.concept-hierarchy li li li li li'
|
267
|
+
selector = 'ul.concept-hierarchy > li > ul > li > ul > li > ul > li > ul > li'
|
268
268
|
|
269
269
|
get :show, lang: 'en', format: 'html', root: 'root'
|
270
270
|
entries = css_select(selector)
|
271
|
-
assert_equal entries.length
|
271
|
+
assert_equal 0, entries.length # default depth is 3
|
272
272
|
|
273
273
|
get :show, lang: 'en', format: 'html', root: 'root', depth: 4
|
274
274
|
entries = css_select(selector)
|
275
|
-
assert_equal entries.length
|
275
|
+
assert_equal 2, entries.length
|
276
276
|
|
277
277
|
get :show, lang: 'en', format: 'html', root: 'root', depth: 1
|
278
|
-
entries = get_entries('ul.concept-hierarchy li')
|
279
|
-
assert_equal
|
280
|
-
entries = get_entries('ul.concept-hierarchy li li')
|
281
|
-
assert_equal
|
282
|
-
entries = css_select('ul.concept-hierarchy li li li')
|
283
|
-
assert_equal entries.length
|
284
|
-
|
278
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
279
|
+
assert_equal ['Root'], entries
|
280
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li')
|
281
|
+
assert_equal ['Bar', 'Foo'], entries
|
282
|
+
entries = css_select('ul.concept-hierarchy > li > ul > li > ul > li')
|
283
|
+
assert_equal 0, entries.length
|
284
|
+
|
285
|
+
old_config_value = Iqvoc.config['performance.unbounded_hierarchy']
|
286
|
+
Iqvoc.config['performance.unbounded_hierarchy'] = false
|
285
287
|
get :show, lang: 'en', format: 'html', root: 'root', depth: 5
|
286
288
|
assert_response 403
|
287
|
-
assert_equal flash[:error]
|
289
|
+
assert_equal 'excessive depth', flash[:error]
|
290
|
+
Iqvoc.config['performance.unbounded_hierarchy'] = old_config_value
|
288
291
|
|
289
292
|
get :show, lang: 'en', format: 'html', root: 'root', depth: 'invalid'
|
290
293
|
assert_response 400
|
291
|
-
assert_equal
|
294
|
+
assert_equal 'invalid depth parameter', flash[:error]
|
292
295
|
end
|
293
296
|
|
294
297
|
test 'direction handling' do
|
295
298
|
get :show, lang: 'en', format: 'html', root: 'root'
|
296
|
-
entries = get_entries('ul.concept-hierarchy li')
|
297
|
-
assert_equal
|
298
|
-
entries = get_entries('ul.concept-hierarchy li li li li')
|
299
|
-
assert_equal
|
299
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
300
|
+
assert_equal ['Root'], entries
|
301
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li > ul > li')
|
302
|
+
assert_equal ['Dos', 'Uno'], entries
|
300
303
|
|
301
304
|
get :show, lang: 'en', format: 'html', root: 'root', dir: 'up'
|
302
305
|
entries = get_entries('ul.concept-hierarchy li')
|
303
|
-
assert_equal
|
306
|
+
assert_equal ['Root'], entries
|
304
307
|
entries = css_select('ul.concept-hierarchy li li')
|
305
|
-
assert_equal entries.length
|
308
|
+
assert_equal 0, entries.length
|
306
309
|
|
307
310
|
get :show, lang: 'en', format: 'html', root: 'lorem'
|
308
311
|
entries = get_entries('ul.concept-hierarchy li')
|
309
|
-
assert_equal
|
312
|
+
assert_equal ['Lorem'], entries
|
310
313
|
entries = css_select('ul.concept-hierarchy li li')
|
311
|
-
assert_equal entries.length
|
314
|
+
assert_equal 0, entries.length
|
312
315
|
|
313
316
|
get :show, lang: 'en', format: 'html', root: 'lorem', dir: 'up'
|
314
|
-
entries = get_entries('ul.concept-hierarchy li')
|
315
|
-
assert_equal
|
316
|
-
entries = get_entries('ul.concept-hierarchy li li li li')
|
317
|
-
assert_equal
|
318
|
-
entries = css_select('ul.concept-hierarchy li li li li li')
|
319
|
-
assert_equal entries.length
|
317
|
+
entries = get_entries('ul.concept-hierarchy > li')
|
318
|
+
assert_equal ['Lorem'], entries
|
319
|
+
entries = get_entries('ul.concept-hierarchy li > ul > li > ul > li > ul > li')
|
320
|
+
assert_equal ['Bar'], entries
|
321
|
+
entries = css_select('ul.concept-hierarchy li > ul > li > ul > li > ul > li > ul > li')
|
322
|
+
assert_equal 0, entries.length
|
320
323
|
|
321
324
|
get :show, lang: 'en', format: 'html', root: 'lorem', dir: 'up', depth: 4
|
322
325
|
page.all('ul.concept-hierarchy li').
|
323
326
|
map { |node| node.native.children.first.text }
|
324
|
-
entries = get_entries('ul.concept-hierarchy li li li li li')
|
325
|
-
assert_equal
|
327
|
+
entries = get_entries('ul.concept-hierarchy > li > ul > li > ul > li > ul > li > ul > li')
|
328
|
+
assert_equal ['Root'], entries
|
326
329
|
end
|
327
330
|
|
328
331
|
test 'siblings handling' do
|
329
332
|
get :show, lang: 'en', format: 'html', root: 'foo'
|
330
333
|
entries = get_all_entries('ul.concept-hierarchy li')
|
331
|
-
assert_equal
|
334
|
+
assert_equal ['Foo'], entries
|
332
335
|
|
333
336
|
get :show, lang: 'en', format: 'html', root: 'foo', siblings: 'true'
|
334
337
|
entries = get_all_entries('ul.concept-hierarchy li')
|
335
|
-
|
338
|
+
# binding.pry
|
339
|
+
assert_equal ['Bar', 'Foo'], entries
|
336
340
|
|
337
341
|
get :show, lang: 'en', format: 'html', root: 'lorem'
|
338
342
|
entries = get_all_entries('ul.concept-hierarchy li')
|
339
|
-
assert_equal
|
343
|
+
assert_equal ['Lorem'], entries
|
340
344
|
|
341
345
|
get :show, lang: 'en', format: 'html', root: 'lorem', dir: 'up',
|
342
346
|
siblings: 'true'
|
343
347
|
entries = get_all_entries('ul.concept-hierarchy li')
|
344
|
-
assert_equal entries.length
|
348
|
+
assert_equal 8, entries.length
|
345
349
|
['Lorem', 'Ipsum', 'Uno', 'Dos', 'Alpha', 'Bravo', 'Bar', 'Foo'].each do |name|
|
346
350
|
assert entries.include?(name), "missing entry: #{name}"
|
347
351
|
end
|
@@ -349,7 +353,7 @@ boot:
|
|
349
353
|
get :show, lang: 'en', format: 'html', root: 'lorem', dir: 'up',
|
350
354
|
siblings: '1', depth: 4
|
351
355
|
entries = get_all_entries('ul.concept-hierarchy li')
|
352
|
-
assert_equal entries.length
|
356
|
+
assert_equal 9, entries.length
|
353
357
|
['Lorem', 'Ipsum', 'Uno', 'Dos', 'Alpha', 'Bravo', 'Bar', 'Foo', 'Root'].each do |name|
|
354
358
|
assert entries.include?(name), "missing entry: #{name}"
|
355
359
|
end
|
@@ -358,7 +362,7 @@ boot:
|
|
358
362
|
test 'avoid duplication' do # in response to a bug report
|
359
363
|
get :show, lang: 'en', format: 'ttl', root: 'uno', dir: 'up'
|
360
364
|
assert_response 200
|
361
|
-
assert_equal
|
365
|
+
assert_equal 'text/turtle', @response.content_type
|
362
366
|
assert @response.body.include?(<<-EOS)
|
363
367
|
:bravo a skos:Concept;
|
364
368
|
skos:prefLabel "Bravo"@en;
|
@@ -379,7 +383,7 @@ boot:
|
|
379
383
|
return Capybara::Node::Simple.new(@response.body)
|
380
384
|
end
|
381
385
|
|
382
|
-
def create_hierarchy(hash, rel_class, memo=nil, parent=nil)
|
386
|
+
def create_hierarchy(hash, rel_class, memo = nil, parent =nil)
|
383
387
|
hash.each do |origin, children|
|
384
388
|
concept = create_concept(origin, origin.capitalize, 'en')
|
385
389
|
memo[origin] = concept if memo
|
@@ -34,13 +34,13 @@ class ReverseMatchTest < ActionController::TestCase
|
|
34
34
|
Iqvoc.config['sources.iqvoc'] = ['http://try.iqvoc.net']
|
35
35
|
|
36
36
|
@achievement_hobbies = Concept::SKOS::Base.new.tap do |c|
|
37
|
-
|
37
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Achievement hobbies"@en'
|
38
38
|
c.publish
|
39
39
|
c.save
|
40
40
|
end
|
41
41
|
|
42
42
|
@airsoft = Concept::SKOS::Base.new.tap do |c|
|
43
|
-
|
43
|
+
RDFAPI.devour c, 'skos:prefLabel', '"Airsoft"@en'
|
44
44
|
c.publish
|
45
45
|
c.save
|
46
46
|
new_version = c.branch @admin
|
@@ -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 AlphabeticalConceptsTest < ActionDispatch::IntegrationTest
|
21
20
|
setup do
|
@@ -25,10 +24,10 @@ class AlphabeticalConceptsTest < ActionDispatch::IntegrationTest
|
|
25
24
|
]
|
26
25
|
|
27
26
|
data.each_with_index do |hsh, i|
|
28
|
-
concept =
|
27
|
+
concept = RDFAPI.devour "concept_#{i}", 'a', 'skos:Concept'
|
29
28
|
labelings = []
|
30
29
|
hsh.each do |lang, val|
|
31
|
-
|
30
|
+
RDFAPI.devour concept, 'skos:prefLabel', "\"#{val}\"@#{lang}"
|
32
31
|
end
|
33
32
|
concept.publish.save
|
34
33
|
end
|