iqvoc 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile +3 -3
  4. data/Gemfile.lock +7 -5
  5. data/LICENSE +1 -1
  6. data/README.md +1 -1
  7. data/Rakefile +1 -1
  8. data/app/controllers/application_controller.rb +1 -1
  9. data/app/controllers/collections_controller.rb +1 -1
  10. data/app/controllers/concepts/alphabetical_controller.rb +1 -1
  11. data/app/controllers/concepts/expired_controller.rb +1 -1
  12. data/app/controllers/concepts/hierarchical_controller.rb +3 -14
  13. data/app/controllers/concepts/scheme_controller.rb +1 -1
  14. data/app/controllers/concepts/untranslated_controller.rb +1 -1
  15. data/app/controllers/concepts/versions_controller.rb +1 -1
  16. data/app/controllers/concepts_controller.rb +1 -1
  17. data/app/controllers/dashboard_controller.rb +1 -1
  18. data/app/controllers/frontpage_controller.rb +1 -1
  19. data/app/controllers/hierarchy_controller.rb +3 -3
  20. data/app/controllers/import_controller.rb +1 -1
  21. data/app/controllers/instance_configuration_controller.rb +1 -1
  22. data/app/controllers/pages_controller.rb +1 -1
  23. data/app/controllers/rdf_controller.rb +1 -1
  24. data/app/controllers/search_results_controller.rb +1 -1
  25. data/app/controllers/triplestore_sync_controller.rb +1 -1
  26. data/app/controllers/user_sessions_controller.rb +1 -1
  27. data/app/controllers/users_controller.rb +1 -1
  28. data/app/helpers/application_helper.rb +1 -1
  29. data/app/helpers/concepts_helper.rb +2 -3
  30. data/app/helpers/dashboard_helper.rb +1 -1
  31. data/app/helpers/rdf_helper.rb +3 -3
  32. data/app/helpers/search_results_helper.rb +1 -1
  33. data/app/models/collection/base.rb +1 -1
  34. data/app/models/collection/member/base.rb +1 -1
  35. data/app/models/collection/skos/unordered.rb +1 -1
  36. data/app/models/collection/unordered.rb +1 -1
  37. data/app/models/concept/base.rb +1 -1
  38. data/app/models/concept/relation/base.rb +1 -1
  39. data/app/models/concept/relation/reverse_relation_extension.rb +1 -1
  40. data/app/models/concept/relation/skos/base.rb +8 -5
  41. data/app/models/concept/relation/skos/broader/base.rb +1 -1
  42. data/app/models/concept/relation/skos/broader/mono.rb +1 -1
  43. data/app/models/concept/relation/skos/broader/poly.rb +1 -1
  44. data/app/models/concept/relation/skos/narrower/base.rb +1 -1
  45. data/app/models/concept/relation/skos/related.rb +1 -1
  46. data/app/models/concept/skos/base.rb +1 -1
  47. data/app/models/concept/skos/scheme.rb +1 -1
  48. data/app/models/configuration_setting.rb +1 -1
  49. data/app/models/label/base.rb +1 -1
  50. data/app/models/label/skos/base.rb +1 -1
  51. data/app/models/labeling/base.rb +1 -1
  52. data/app/models/labeling/skos/alt_label.rb +1 -1
  53. data/app/models/labeling/skos/base.rb +1 -1
  54. data/app/models/labeling/skos/hidden_label.rb +1 -1
  55. data/app/models/labeling/skos/pref_label.rb +1 -1
  56. data/app/models/match/base.rb +1 -1
  57. data/app/models/match/skos/base.rb +1 -1
  58. data/app/models/match/skos/broad_match.rb +1 -1
  59. data/app/models/match/skos/close_match.rb +1 -1
  60. data/app/models/match/skos/exact_match.rb +1 -1
  61. data/app/models/match/skos/mapping_relation.rb +1 -1
  62. data/app/models/match/skos/narrow_match.rb +1 -1
  63. data/app/models/match/skos/related_match.rb +1 -1
  64. data/app/models/notation/base.rb +1 -1
  65. data/app/models/note/annotated/base.rb +1 -1
  66. data/app/models/note/base.rb +1 -1
  67. data/app/models/note/rdfs/see_also.rb +20 -0
  68. data/app/models/note/skos/base.rb +14 -13
  69. data/app/models/note/skos/change_note.rb +1 -1
  70. data/app/models/note/skos/definition.rb +1 -1
  71. data/app/models/note/skos/editorial_note.rb +1 -1
  72. data/app/models/note/skos/example.rb +1 -1
  73. data/app/models/note/skos/history_note.rb +1 -1
  74. data/app/models/note/skos/scope_note.rb +1 -1
  75. data/app/models/search_extension.rb +1 -1
  76. data/app/models/user.rb +1 -1
  77. data/app/models/user_session.rb +1 -1
  78. data/app/views/concepts/hierarchical/_treeview.html.erb +8 -10
  79. data/app/views/concepts/hierarchical/index.json.jbuilder +15 -0
  80. data/app/views/concepts/index.iqrdf +1 -1
  81. data/config/application.rb +1 -1
  82. data/config/boot.rb +1 -1
  83. data/config/environment.rb +1 -1
  84. data/config/environments/development.rb +1 -1
  85. data/config/environments/heroku.rb +1 -1
  86. data/config/environments/production.rb +1 -1
  87. data/config/environments/test.rb +1 -1
  88. data/config/initializers/action_view.rb +1 -1
  89. data/config/initializers/active_record.rb +1 -1
  90. data/config/initializers/backtrace_silencers.rb +1 -1
  91. data/config/initializers/heroku.rb +1 -1
  92. data/config/initializers/inflections.rb +1 -1
  93. data/config/initializers/iqvoc.rb +1 -1
  94. data/config/initializers/jdbc.rb +1 -1
  95. data/config/initializers/mime_types.rb +1 -1
  96. data/config/initializers/secret_token.rb.template +1 -1
  97. data/config/initializers/secret_token_configurator.rb +1 -1
  98. data/config/initializers/session_store.rb +1 -1
  99. data/config/locales/activerecord.de.yml +1 -1
  100. data/config/locales/activerecord.en.yml +1 -1
  101. data/config/locales/activerecord.pt.yml +1 -1
  102. data/config/locales/authlogic.de.yml +1 -1
  103. data/config/locales/authlogic.en.yml +1 -1
  104. data/config/locales/authlogic.pt.yml +1 -1
  105. data/config/locales/de.yml +12 -12
  106. data/config/locales/defaults.de.yml +1 -1
  107. data/config/locales/en.yml +11 -11
  108. data/config/locales/pt.yml +1 -1
  109. data/config/routes.rb +2 -2
  110. data/config/warble.rb +1 -1
  111. data/db/migrate/20100927101502_create_schema.rb +1 -1
  112. data/db/migrate/20101125141218_add_collection_tables.rb +1 -1
  113. data/db/migrate/20101129161528_add_type_to_collections.rb +1 -1
  114. data/db/migrate/20101202094602_add_origin_to_collections.rb +1 -1
  115. data/db/migrate/20101202135420_rename_collection_contents_to_collection_members.rb +1 -1
  116. data/db/migrate/20101208103531_add_type_to_collection_contents.rb +1 -1
  117. data/db/migrate/20101210153916_add_indexes_to_collections.rb +1 -1
  118. data/db/migrate/20110204121244_create_collection_labels.rb +1 -1
  119. data/db/migrate/20110208084250_change_origin_lengths.rb +1 -1
  120. data/db/migrate/20110328124300_discard_collection_specifics.rb +1 -1
  121. data/db/migrate/20130418093837_add_language_to_note_annotations.rb +5 -0
  122. data/db/schema.rb +2 -1
  123. data/db/seeds.rb +1 -1
  124. data/iqvoc.gemspec +1 -0
  125. data/lib/iqvoc.rb +1 -1
  126. data/lib/iqvoc/configuration/core.rb +2 -2
  127. data/lib/iqvoc/deep_cloning.rb +1 -1
  128. data/lib/iqvoc/inline_data_helper.rb +1 -1
  129. data/lib/iqvoc/instance_configuration.rb +7 -6
  130. data/lib/iqvoc/origin.rb +1 -1
  131. data/lib/iqvoc/rdfapi.rb +3 -1
  132. data/lib/iqvoc/version.rb +2 -2
  133. data/lib/iqvoc/versioning.rb +1 -1
  134. data/lib/string.rb +1 -1
  135. data/test/factories.rb +1 -1
  136. data/test/functional/hierarchy_test.rb +1 -2
  137. data/test/functional/rdf_test.rb +98 -0
  138. data/test/integration/alphabetical_test.rb +1 -1
  139. data/test/integration/authentication_test.rb +1 -1
  140. data/test/integration/browse_concepts_and_labels_test.rb +1 -1
  141. data/test/integration/client_augmentation_test.rb +1 -1
  142. data/test/integration/client_edit_concept_test.rb +1 -1
  143. data/test/integration/collection_circularity_test.rb +1 -1
  144. data/test/integration/concept_scheme_test.rb +1 -1
  145. data/test/integration/concept_test.rb +1 -1
  146. data/test/integration/edit_concepts_test.rb +1 -1
  147. data/test/integration/instance_configuration_test.rb +1 -1
  148. data/test/integration/note_annotations_test.rb +27 -1
  149. data/test/integration/search_test.rb +1 -1
  150. data/test/integration/tree_test.rb +1 -1
  151. data/test/integration/untranslated_test.rb +1 -1
  152. data/test/integration_test_helper.rb +1 -1
  153. data/test/performance/browsing_test.rb +1 -1
  154. data/test/test_helper.rb +6 -12
  155. data/test/unit/concept_scheme_test.rb +1 -1
  156. data/test/unit/concept_test.rb +1 -1
  157. data/test/unit/hygiene_test.rb +2 -2
  158. data/test/unit/inline_data_test.rb +1 -1
  159. data/test/unit/instance_configuration_test.rb +1 -1
  160. data/test/unit/note_test.rb +1 -1
  161. data/test/unit/origin_test.rb +1 -1
  162. data/test/unit/rdf_sync_test.rb +1 -1
  163. data/test/unit/skos_import_test.rb +1 -1
  164. metadata +21 -2
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -0,0 +1,5 @@
1
+ class AddLanguageToNoteAnnotations < ActiveRecord::Migration
2
+ def change
3
+ add_column :note_annotations, :language, :string
4
+ end
5
+ end
data/db/schema.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130315141952) do
14
+ ActiveRecord::Schema.define(:version => 20130418093837) do
15
15
 
16
16
  create_table "collection_members", :force => true do |t|
17
17
  t.integer "collection_id"
@@ -107,6 +107,7 @@ ActiveRecord::Schema.define(:version => 20130315141952) do
107
107
  t.datetime "created_at"
108
108
  t.datetime "updated_at"
109
109
  t.string "namespace", :limit => 50
110
+ t.string "language"
110
111
  end
111
112
 
112
113
  add_index "note_annotations", ["note_id"], :name => "ix_note_annotations_fk"
data/db/seeds.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
data/iqvoc.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'simple_form'
24
24
  s.add_dependency 'sass-rails', '~> 3.2.5'
25
25
  s.add_dependency 'iq_triplestorage'
26
+ s.add_dependency 'jbuilder'
26
27
 
27
28
  s.files = %w(LICENSE README.md CHANGELOG.md Gemfile Gemfile.lock Rakefile iqvoc.gemspec) +
28
29
  Dir.glob("{app,config,db,public,lib,test,vendor}/**/*")
data/lib/iqvoc.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -83,7 +83,8 @@ module Iqvoc
83
83
  :rdfs => "http://www.w3.org/2000/01/rdf-schema#",
84
84
  :owl => "http://www.w3.org/2002/07/owl#",
85
85
  :skos => "http://www.w3.org/2004/02/skos/core#",
86
- :dct => "http://purl.org/dc/terms/"
86
+ :dct => "http://purl.org/dc/terms/",
87
+ :foaf => "http://xmlns.com/foaf/spec/"
87
88
  }
88
89
 
89
90
  # The class to use for automatic generation of change notes on every save
@@ -100,7 +101,6 @@ module Iqvoc
100
101
  "languages.further_labelings.Labeling::SKOS::AltLabel" => ["en", "de"],
101
102
  "note_languages" => ["en", "de"]
102
103
  })
103
- self.config.initialize_cache
104
104
  end
105
105
 
106
106
  module ClassMethods
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -39,7 +39,7 @@ module Iqvoc
39
39
 
40
40
  # convenience wrapper for `register_setting` batch operations
41
41
  # accepts a hash of key / default value pairs
42
- def register_settings(settings = {})
42
+ def register_settings(settings)
43
43
  settings.each do |key, default_value|
44
44
  register_setting(key, default_value)
45
45
  end
@@ -69,7 +69,7 @@ module Iqvoc
69
69
 
70
70
  # retrieve individual setting, using default value as fallback
71
71
  def [](key)
72
- initialize_cache if @settings.blank?
72
+ initialize_cache unless @initialized
73
73
  return @settings[key]
74
74
  end
75
75
 
@@ -96,16 +96,17 @@ module Iqvoc
96
96
  # (subsequent updates will happen automatically via the respective setters)
97
97
  def initialize_cache
98
98
  # cache customized settings
99
- db_settings = ConfigurationSetting.all rescue [] # database table might not exist yet (pre-migration)
100
- db_settings.each do |setting|
99
+ ConfigurationSetting.all.each do |setting|
101
100
  @records[setting.key] = JSON.load("[#{setting.value}]")[0] # temporary array wrapper ensures valid JSON text
102
101
  end
103
102
 
104
103
  # cache current settings
105
- @defaults.each_with_object({}) do |(key, default_value), hsh|
104
+ @defaults.each do |key, default_value|
106
105
  value = @records[key]
107
106
  @settings[key] = value.nil? ? default_value : value
108
107
  end
108
+
109
+ @initialized = true
109
110
  end
110
111
 
111
112
  # checks whether value type is supported
data/lib/iqvoc/origin.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
data/lib/iqvoc/rdfapi.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -34,6 +34,8 @@ module Iqvoc
34
34
  hash
35
35
  end
36
36
 
37
+ URI_REGEXP = /^https?:\/\/[^\s]+$/
38
+
37
39
  def self.devour(rdf_subject, rdf_predicate, rdf_object)
38
40
  case rdf_predicate
39
41
  when 'a', 'rdf:type'
data/lib/iqvoc/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.1.0"
18
+ VERSION = "4.1.1"
19
19
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
data/lib/string.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
data/test/factories.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -22,7 +22,6 @@ class HierarchyTest < ActionController::TestCase
22
22
  @controller = HierarchyController.new
23
23
 
24
24
  # create a concept hierarchy
25
-
26
25
  concepts = YAML.load <<-EOS
27
26
  root:
28
27
  foo:
@@ -0,0 +1,98 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2013 innoQ Deutschland GmbH
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
18
+
19
+ class RDFTest < ActionController::TestCase
20
+
21
+ setup do
22
+ @controller = ConceptsController.new
23
+
24
+ # create a concept hierarchy
25
+ concepts = YAML.load <<-EOS
26
+ root:
27
+ foo:
28
+ bar:
29
+ EOS
30
+ rel_class = Iqvoc::Concept.broader_relation_class.narrower_class
31
+ @concepts = create_hierarchy(concepts, rel_class, {})
32
+ @concepts["root"].update_attribute("top_term", true)
33
+ end
34
+
35
+ test "individual concept representations" do
36
+ params = { :lang => "en", :format => "ttl" }
37
+
38
+ get :show, params.merge(:id => "root")
39
+ assert_response 200
40
+ assert @response.body.include? ':root a skos:Concept'
41
+ assert @response.body.include? 'skos:narrower :foo'
42
+ assert @response.body.include? 'skos:narrower :bar'
43
+ assert @response.body.include? 'skos:prefLabel "Root"@en'
44
+ assert @response.body.include? ':foo skos:prefLabel "Foo"@en.'
45
+ assert @response.body.include? ':bar skos:prefLabel "Bar"@en.'
46
+
47
+ get :show, params.merge(:id => "foo")
48
+ assert_response 200
49
+ assert @response.body.include? ':foo a skos:Concept'
50
+ assert @response.body.include? 'skos:broader :root'
51
+ assert @response.body.include? 'skos:prefLabel "Foo"@en'
52
+ assert @response.body.include? ':root skos:prefLabel "Root"@en.'
53
+ end
54
+
55
+ test "full export" do
56
+ params = { :lang => "en", :format => "ttl" }
57
+
58
+ get :index, params
59
+ assert_response 401
60
+
61
+ # XXX: disabled because authentication fails
62
+ #get :index, params
63
+ #assert_response 200
64
+ #assert @response.body.include? ':foo a skos:Concept'
65
+ #assert @response.body.include? ':bar a skos:Concept'
66
+ #assert @response.body.include? 'skos:prefLabel "Foo"@en'
67
+ #assert @response.body.include? 'skos:prefLabel "Bar"@en'
68
+ # don't duplicate pref. labels
69
+ #assert !@response.body.include?(':foo skos:prefLabel "Foo"@en.')
70
+ #assert !@response.body.include?(':bar skos:prefLabel "Bar"@en.')
71
+ end
72
+
73
+ def create_hierarchy(hash, rel_class, memo=nil, parent=nil)
74
+ hash.each do |origin, children|
75
+ concept = create_concept(origin, origin.capitalize, "en")
76
+ memo[origin] = concept if memo
77
+ link_concepts(parent, rel_class, concept) if parent
78
+ create_hierarchy(children, rel_class, memo, concept) unless children.blank?
79
+ end
80
+ return memo
81
+ end
82
+
83
+ def link_concepts(source, rel_class, target)
84
+ rel_name = rel_class.name.to_relation_name
85
+ source.send(rel_name).create_with_reverse_relation(target)
86
+ end
87
+
88
+ def create_concept(origin, pref_label, label_lang, published=true)
89
+ concept = Iqvoc::Concept.base_class.create(:origin => origin,
90
+ :published_at => (published ? Time.now : nil))
91
+ label = Iqvoc::Label.base_class.create(:value => pref_label,
92
+ :language => label_lang)
93
+ labeling = Iqvoc::Concept.pref_labeling_class.create(:owner => concept,
94
+ :target => label)
95
+ return concept
96
+ end
97
+
98
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- # Copyright 2011 innoQ Deutschland GmbH
3
+ # Copyright 2011-2013 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.