iqvoc 3.2.3
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.
- data/Gemfile +69 -0
- data/Gemfile.lock +134 -0
- data/LICENSE +13 -0
- data/README.md +68 -0
- data/Rakefile +23 -0
- data/app/controllers/application_controller.rb +125 -0
- data/app/controllers/collections/hierarchical_controller.rb +44 -0
- data/app/controllers/collections_controller.rb +124 -0
- data/app/controllers/concepts/alphabetical_controller.rb +39 -0
- data/app/controllers/concepts/hierarchical_controller.rb +74 -0
- data/app/controllers/concepts/untranslated_controller.rb +38 -0
- data/app/controllers/concepts/versions_controller.rb +119 -0
- data/app/controllers/concepts_controller.rb +174 -0
- data/app/controllers/dashboard_controller.rb +43 -0
- data/app/controllers/pages_controller.rb +22 -0
- data/app/controllers/rdf_controller.rb +43 -0
- data/app/controllers/search_results_controller.rb +101 -0
- data/app/controllers/triple_store_syncs_controller.rb +45 -0
- data/app/controllers/user_sessions_controller.rb +48 -0
- data/app/controllers/users_controller.rb +81 -0
- data/app/helpers/application_helper.rb +60 -0
- data/app/helpers/concepts_helper.rb +86 -0
- data/app/helpers/dashboard_helper.rb +46 -0
- data/app/helpers/rdf_helper.rb +63 -0
- data/app/helpers/search_results_helper.rb +32 -0
- data/app/models/collection/base.rb +161 -0
- data/app/models/collection/member/base.rb +23 -0
- data/app/models/collection/member/collection.rb +33 -0
- data/app/models/collection/member/concept.rb +33 -0
- data/app/models/collection/unordered.rb +18 -0
- data/app/models/concept/base.rb +418 -0
- data/app/models/concept/relation/base.rb +95 -0
- data/app/models/concept/relation/reverse_relation_extension.rb +49 -0
- data/app/models/concept/relation/skos/base.rb +37 -0
- data/app/models/concept/relation/skos/broader/base.rb +41 -0
- data/app/models/concept/relation/skos/broader/mono.rb +28 -0
- data/app/models/concept/relation/skos/broader/poly.rb +23 -0
- data/app/models/concept/relation/skos/narrower/base.rb +37 -0
- data/app/models/concept/relation/skos/related.rb +21 -0
- data/app/models/concept/skos/base.rb +28 -0
- data/app/models/label/base.rb +98 -0
- data/app/models/label/skos/base.rb +27 -0
- data/app/models/labeling/base.rb +81 -0
- data/app/models/labeling/skos/alt_label.rb +21 -0
- data/app/models/labeling/skos/base.rb +99 -0
- data/app/models/labeling/skos/hidden_label.rb +25 -0
- data/app/models/labeling/skos/pref_label.rb +30 -0
- data/app/models/match/base.rb +57 -0
- data/app/models/match/skos/base.rb +23 -0
- data/app/models/match/skos/broad_match.rb +21 -0
- data/app/models/match/skos/close_match.rb +21 -0
- data/app/models/match/skos/exact_match.rb +21 -0
- data/app/models/match/skos/mapping_relation.rb +21 -0
- data/app/models/match/skos/narrow_match.rb +21 -0
- data/app/models/match/skos/related_match.rb +21 -0
- data/app/models/note/annotated/base.rb +29 -0
- data/app/models/note/base.rb +127 -0
- data/app/models/note/skos/base.rb +52 -0
- data/app/models/note/skos/change_note.rb +38 -0
- data/app/models/note/skos/definition.rb +33 -0
- data/app/models/note/skos/editorial_note.rb +21 -0
- data/app/models/note/skos/example.rb +21 -0
- data/app/models/note/skos/history_note.rb +21 -0
- data/app/models/note/skos/scope_note.rb +21 -0
- data/app/models/origin_mapping.rb +58 -0
- data/app/models/rdf_store.rb +96 -0
- data/app/models/search_extension.rb +58 -0
- data/app/models/user.rb +49 -0
- data/app/models/user_session.rb +23 -0
- data/app/views/collections/_collection.html.erb +10 -0
- data/app/views/collections/_form.html.erb +47 -0
- data/app/views/collections/edit.html.erb +11 -0
- data/app/views/collections/index.html.erb +12 -0
- data/app/views/collections/new.html.erb +7 -0
- data/app/views/collections/show.html.erb +53 -0
- data/app/views/collections/show.iqrdf +22 -0
- data/app/views/concepts/_base_data.html.erb +72 -0
- data/app/views/concepts/_close_match.html.erb +16 -0
- data/app/views/concepts/_show_head.html.erb +23 -0
- data/app/views/concepts/_visualization.html.erb +9 -0
- data/app/views/concepts/alphabetical/_pref_labeling.html.erb +6 -0
- data/app/views/concepts/alphabetical/index.html.erb +17 -0
- data/app/views/concepts/edit.html.erb +32 -0
- data/app/views/concepts/hierarchical/_treeview.html.erb +20 -0
- data/app/views/concepts/hierarchical/index.html.erb +5 -0
- data/app/views/concepts/index.iqrdf +24 -0
- data/app/views/concepts/new.html.erb +3 -0
- data/app/views/concepts/show_published.html.erb +16 -0
- data/app/views/concepts/show_unpublished.html.erb +43 -0
- data/app/views/concepts/untranslated/index.html.erb +23 -0
- data/app/views/dashboard/index.html.erb +47 -0
- data/app/views/errors/access_denied.html.erb +3 -0
- data/app/views/errors/multiple_choices.html.erb +11 -0
- data/app/views/errors/not_found.html.erb +8 -0
- data/app/views/kaminari/_page.html.erb +6 -0
- data/app/views/kaminari/_paginator.html.erb +15 -0
- data/app/views/layouts/_controls.html.erb +37 -0
- data/app/views/layouts/_header.html.erb +1 -0
- data/app/views/layouts/_navigation.html.erb +27 -0
- data/app/views/layouts/_sections.html.erb +8 -0
- data/app/views/layouts/application.html.erb +83 -0
- data/app/views/pages/about.html.erb +77 -0
- data/app/views/partials/_rdf_logo.html.erb +4 -0
- data/app/views/partials/collection/_member.html.erb +14 -0
- data/app/views/partials/collection_label/_search_result.html.erb +5 -0
- data/app/views/partials/concept/_edit_link_base.html.erb +4 -0
- data/app/views/partials/concept/_inline_base.html.erb +4 -0
- data/app/views/partials/concept/_new_link_base.html.erb +4 -0
- data/app/views/partials/concept/relation/_base.html.erb +8 -0
- data/app/views/partials/concept/relation/_edit_base.html.erb +15 -0
- data/app/views/partials/concept/relation/skos/_narrower.html.erb +12 -0
- data/app/views/partials/concept/relation/skos/broader/_mono.html.erb +28 -0
- data/app/views/partials/concept/relation/skos/broader/_poly.html.erb +14 -0
- data/app/views/partials/labeling/skos/_base.html.erb +17 -0
- data/app/views/partials/labeling/skos/_edit_base.html.erb +7 -0
- data/app/views/partials/labeling/skos/_search_result.html.erb +12 -0
- data/app/views/partials/match/_base.html.erb +13 -0
- data/app/views/partials/match/_edit_base.html.erb +6 -0
- data/app/views/partials/note/_base.html.erb +15 -0
- data/app/views/partials/note/_edit_base.html.erb +28 -0
- data/app/views/partials/note/_note.html.erb +14 -0
- data/app/views/partials/note/_search_result.html.erb +8 -0
- data/app/views/partials/note/skos/_edit_change_note.html.erb +47 -0
- data/app/views/partials/note/skos/definition/_search_result.html.erb +8 -0
- data/app/views/rdf/show_concept.iqrdf +5 -0
- data/app/views/search_results/_head_contents.html.erb +4 -0
- data/app/views/search_results/_rdf_links.html.erb +4 -0
- data/app/views/search_results/index.html.erb +92 -0
- data/app/views/search_results/index.iqrdf +33 -0
- data/app/views/triple_store_syncs/new.html.erb +7 -0
- data/app/views/user_sessions/new.html.erb +11 -0
- data/app/views/users/_form.html.erb +45 -0
- data/app/views/users/_user_preference.html.erb +12 -0
- data/app/views/users/edit.html.erb +14 -0
- data/app/views/users/index.html.erb +29 -0
- data/app/views/users/new.html.erb +13 -0
- data/config/application.rb +82 -0
- data/config/boot.rb +29 -0
- data/config/database.template.yml +43 -0
- data/config/database.yml +40 -0
- data/config/deploy/common.rb +79 -0
- data/config/deploy/ec2.rb +43 -0
- data/config/deploy/history.rb +29 -0
- data/config/deploy/innoq.rb +37 -0
- data/config/deploy.rb +72 -0
- data/config/engine.rb +25 -0
- data/config/environment.rb +21 -0
- data/config/environments/development.rb +74 -0
- data/config/environments/production.rb +65 -0
- data/config/environments/production.template.rb +65 -0
- data/config/environments/production_internal.rb +65 -0
- data/config/environments/test.rb +51 -0
- data/config/initializers/action_view.rb +23 -0
- data/config/initializers/active_record.rb +18 -0
- data/config/initializers/backtrace_silencers.rb +23 -0
- data/config/initializers/inflections.rb +26 -0
- data/config/initializers/iqvoc.rb +50 -0
- data/config/initializers/jdbc.rb +23 -0
- data/config/initializers/kaminari_config.rb +8 -0
- data/config/initializers/language.rb +6 -0
- data/config/initializers/mime_types.rb +24 -0
- data/config/initializers/secret_token.rb +29 -0
- data/config/initializers/secret_token.rb.template +29 -0
- data/config/initializers/session_store.rb +24 -0
- data/config/locales/activerecord.de.yml +135 -0
- data/config/locales/activerecord.en.yml +135 -0
- data/config/locales/authlogic.de.yml +38 -0
- data/config/locales/authlogic.en.yml +38 -0
- data/config/locales/de.yml +326 -0
- data/config/locales/defaults.de.yml +153 -0
- data/config/locales/en.yml +332 -0
- data/config/routes.rb +53 -0
- data/config/warble.rb +158 -0
- data/db/iqvoc_test.sqlite3 +0 -0
- data/db/migrate/20100927101502_create_schema.rb +174 -0
- data/db/migrate/20101125141218_add_collection_tables.rb +32 -0
- data/db/migrate/20101129161528_add_type_to_collections.rb +24 -0
- data/db/migrate/20101202094602_add_origin_to_collections.rb +25 -0
- data/db/migrate/20101202135420_rename_collection_contents_to_collection_members.rb +25 -0
- data/db/migrate/20101208103531_add_type_to_collection_contents.rb +27 -0
- data/db/migrate/20101210153916_add_indexes_to_collections.rb +25 -0
- data/db/migrate/20110204121244_create_collection_labels.rb +32 -0
- data/db/migrate/20110208084250_change_origin_lengths.rb +27 -0
- data/db/migrate/20110328124300_discard_collection_specifics.rb +27 -0
- data/db/migrate/20110408120357_remove_classifications_and_classifiers.rb +32 -0
- data/db/migrate/20110408120740_remove_xl_specfic_stuff.rb +39 -0
- data/db/migrate/20110420133640_change_value_in_notes.rb +8 -0
- data/db/migrate/20110427120534_add_published_at_to_labels.rb +9 -0
- data/db/migrate/20110510162719_use_mono_hierarchy_instead_of_poly_hierarchy.rb +13 -0
- data/db/migrate/20110512132624_extend_notes_value_field_length.rb +8 -0
- data/db/migrate/20110525103100_separate_note_annotation_predicates.rb +38 -0
- data/db/migrate/20110615134040_change_umt_note_annotations_to_dct.rb +9 -0
- data/db/schema.rb +127 -0
- data/db/seeds.rb +37 -0
- data/iqvoc.gemspec +27 -0
- data/lib/engine_tasks/assets.rake +49 -0
- data/lib/engine_tasks/db.rake +18 -0
- data/lib/engine_tasks/release.rake +118 -0
- data/lib/iqvoc/ability.rb +44 -0
- data/lib/iqvoc/data_helper.rb +27 -0
- data/lib/iqvoc/deep_cloning.rb +92 -0
- data/lib/iqvoc/rdf_helper.rb +67 -0
- data/lib/iqvoc/skos_importer.rb +144 -0
- data/lib/iqvoc/version.rb +19 -0
- data/lib/iqvoc/versioning.rb +151 -0
- data/lib/iqvoc.rb +228 -0
- data/lib/maker.rb +144 -0
- data/lib/ojdbc14.jar +0 -0
- data/lib/string.rb +23 -0
- data/lib/tasks/importer.rake +16 -0
- data/lib/tasks/jdbc.rake +24 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/iqvoc/add.png +0 -0
- data/public/images/iqvoc/arrow_down.gif +0 -0
- data/public/images/iqvoc/arrow_up.gif +0 -0
- data/public/images/iqvoc/footer.png +0 -0
- data/public/images/iqvoc/go_there.png +0 -0
- data/public/images/iqvoc/header.png +0 -0
- data/public/images/iqvoc/header_long.png +0 -0
- data/public/images/iqvoc/iqvoc.png +0 -0
- data/public/images/iqvoc/note_add.png +0 -0
- data/public/images/iqvoc/note_delete.png +0 -0
- data/public/images/iqvoc/note_edit.png +0 -0
- data/public/images/iqvoc/ok.png +0 -0
- data/public/images/iqvoc/rails.png +0 -0
- data/public/images/iqvoc/rdf_flyer.gif +0 -0
- data/public/images/iqvoc/red_arrow.png +0 -0
- data/public/images/iqvoc/remove.png +0 -0
- data/public/images/iqvoc/shadow.png +0 -0
- data/public/images/iqvoc/spinner.gif +0 -0
- data/public/images/iqvoc/tokenizer_delete.png +0 -0
- data/public/images/iqvoc/tokenizer_pencile.png +0 -0
- data/public/images/iqvoc/tokenizer_show.png +0 -0
- data/public/images/iqvoc/unfinished.png +0 -0
- data/public/javascripts/iqvoc/application.js +123 -0
- data/public/javascripts/iqvoc/entityselect.js +121 -0
- data/public/javascripts/iqvoc/excanvas.js +35 -0
- data/public/javascripts/iqvoc/iqvoc.js +118 -0
- data/public/javascripts/iqvoc/jit_rgraph.js +153 -0
- data/public/javascripts/iqvoc/jquery-1.6.2.min.js +18 -0
- data/public/javascripts/iqvoc/jquery-treeview/changelog.txt +29 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/async.html +44 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/bg.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/demo.js +43 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/images.html +56 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/index.html +340 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/large.html +559 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/prerendered.html +621 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/screen.css +24 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/simple.html +82 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/source.php +87 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/source.phps +87 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/ajax-loader.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/file.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/folder-closed.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/folder.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/minus.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/plus.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-black-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-black.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-default-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-default.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-famfamfam-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-famfamfam.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-gray-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-gray.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-red-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-red.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.async.js +82 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.css +75 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.js +251 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.min.js +15 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.pack.js +16 -0
- data/public/javascripts/iqvoc/jquery-treeview/lib/jquery.cookie.js +92 -0
- data/public/javascripts/iqvoc/jquery-treeview/lib/jquery.js +3363 -0
- data/public/javascripts/iqvoc/jquery-treeview/todo +8 -0
- data/public/javascripts/iqvoc/jquery-ui-1.8.13.custom.js +3229 -0
- data/public/javascripts/iqvoc/jquery-ui-1.8.13.custom.min.js +163 -0
- data/public/javascripts/iqvoc/jquery-ui.datepicker-de.js +22 -0
- data/public/javascripts/iqvoc/json2.js +480 -0
- data/public/javascripts/iqvoc/langselect.js +73 -0
- data/public/javascripts/iqvoc/rails.js +132 -0
- data/public/javascripts/iqvoc/storage.js +122 -0
- data/public/javascripts/iqvoc/visualization.js +321 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/iqvoc/blueprint/ie.css +35 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/key.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/readme.txt +32 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/screen.css +97 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/fancy-type/screen.css +71 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/readme.txt +18 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/screen.css +40 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/rtl/readme.txt +10 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/rtl/screen.css +110 -0
- data/public/stylesheets/iqvoc/blueprint/print.css +29 -0
- data/public/stylesheets/iqvoc/blueprint/screen.css +258 -0
- data/public/stylesheets/iqvoc/blueprint/src/forms.css +65 -0
- data/public/stylesheets/iqvoc/blueprint/src/grid.css +280 -0
- data/public/stylesheets/iqvoc/blueprint/src/grid.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/src/ie.css +76 -0
- data/public/stylesheets/iqvoc/blueprint/src/print.css +85 -0
- data/public/stylesheets/iqvoc/blueprint/src/reset.css +45 -0
- data/public/stylesheets/iqvoc/blueprint/src/typography.css +106 -0
- data/public/stylesheets/iqvoc/forms.css +71 -0
- data/public/stylesheets/iqvoc/images/back.png +0 -0
- data/public/stylesheets/iqvoc/images/branch.png +0 -0
- data/public/stylesheets/iqvoc/images/categ.png +0 -0
- data/public/stylesheets/iqvoc/images/categ_open.png +0 -0
- data/public/stylesheets/iqvoc/images/go_there.png +0 -0
- data/public/stylesheets/iqvoc/images/iqvoc.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_end.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_end_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_mid.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_mid_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_nothing.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_only.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_only_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_top.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_top_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/nothing.png +0 -0
- data/public/stylesheets/iqvoc/images/top_01.png +0 -0
- data/public/stylesheets/iqvoc/images/trunk.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_217bc0_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_469bdd_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_6da8d5_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_f9bd01_256x240.png +0 -0
- data/public/stylesheets/iqvoc/iqvoc.css +477 -0
- data/public/stylesheets/iqvoc/jquery-ui-1.8.13.custom.css +415 -0
- data/public/stylesheets/iqvoc/widgets.css +81 -0
- data/test/factories.rb +74 -0
- data/test/integration/alphabetical_test.rb +53 -0
- data/test/integration/authentication_test.rb +41 -0
- data/test/integration/browse_concepts_and_labels_test.rb +61 -0
- data/test/integration/browse_static_pages_test.rb +29 -0
- data/test/integration/client_augmentation_test.rb +42 -0
- data/test/integration/client_edit_concept_test.rb +72 -0
- data/test/integration/collection_circularity_test.rb +110 -0
- data/test/integration/concept_test.rb +61 -0
- data/test/integration/edit_concepts_test.rb +40 -0
- data/test/integration/note_annotations_test.rb +86 -0
- data/test/integration/search_test.rb +205 -0
- data/test/integration/tree_test.rb +31 -0
- data/test/integration/untranslated_test.rb +60 -0
- data/test/integration_test_helper.rb +45 -0
- data/test/performance/browsing_test.rb +25 -0
- data/test/test_helper.rb +29 -0
- data/test/unit/concept_test.rb +93 -0
- data/test/unit/note_test.rb +32 -0
- data/test/unit/origin_mapping_test.rb +70 -0
- data/test/unit/skos_import_test.rb +100 -0
- metadata +522 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 'test_helper'
|
|
18
|
+
require 'integration_test_helper'
|
|
19
|
+
|
|
20
|
+
class SearchTest < ActionDispatch::IntegrationTest
|
|
21
|
+
|
|
22
|
+
setup do
|
|
23
|
+
@pagination_setting = Kaminari.config.default_per_page
|
|
24
|
+
Kaminari.config.default_per_page = 5
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@concepts = ["Tree", "Forest"].map do |english_label_value|
|
|
28
|
+
FactoryGirl.create(:concept, :pref_labelings => [
|
|
29
|
+
Factory(:pref_labeling, :target => Factory(:pref_label, :language => :en, :value => english_label_value))
|
|
30
|
+
])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# create collection
|
|
34
|
+
@collection = FactoryGirl.create(:collection, :concepts => @concepts,
|
|
35
|
+
:labelings => [], :pref_labelings => [
|
|
36
|
+
Factory(:pref_labeling,
|
|
37
|
+
:target => Factory(:pref_label, :language => :en, :value => "Alpha"))
|
|
38
|
+
])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
teardown do
|
|
42
|
+
Kaminari.config.default_per_page = @pagination_setting
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
test "Searching" do
|
|
46
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
47
|
+
|
|
48
|
+
[{
|
|
49
|
+
:type => 'Labels', :query => 'Forest', :query_type => 'contains',
|
|
50
|
+
:amount => 1, :result => 'Forest'
|
|
51
|
+
}].each { |q|
|
|
52
|
+
select q[:type], :from => "t"
|
|
53
|
+
fill_in "q", :with => q[:query]
|
|
54
|
+
select q[:query_type], :from => "qt"
|
|
55
|
+
|
|
56
|
+
# select all languages
|
|
57
|
+
page.all(:css, ".lang_check").each do |cb|
|
|
58
|
+
check cb[:id]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
click_button("Search")
|
|
62
|
+
|
|
63
|
+
assert page.has_css?("#search_results dt", :count => q[:amount]),
|
|
64
|
+
"Page has #{page.all(:css, "#search_results dt").count} '#search_results dt' nodes. Should be #{q[:amount]}."
|
|
65
|
+
|
|
66
|
+
within("#search_results dt") do
|
|
67
|
+
assert page.has_content?(q[:result]), "Could not find '#{q[:result]}' within '#search_results dt'."
|
|
68
|
+
end
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
test "exclude collections from results" do
|
|
73
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
74
|
+
|
|
75
|
+
select "Labels", :from => "t"
|
|
76
|
+
select "contains", :from => "qt"
|
|
77
|
+
fill_in "q", :with => "Alpha"
|
|
78
|
+
|
|
79
|
+
click_button("Search")
|
|
80
|
+
|
|
81
|
+
assert page.has_no_css?("#search_results dt")
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
test "searching within collections" do
|
|
85
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
86
|
+
|
|
87
|
+
select "Labels", :from => "t"
|
|
88
|
+
select "contains", :from => "qt"
|
|
89
|
+
fill_in "q", :with => "res"
|
|
90
|
+
select @collection.to_s, :from => "c"
|
|
91
|
+
|
|
92
|
+
# select all languages
|
|
93
|
+
page.all(:css, ".lang_check").each do |cb|
|
|
94
|
+
check cb[:id]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
click_button("Search")
|
|
98
|
+
|
|
99
|
+
assert page.has_css?("#search_results dt", :count => 1)
|
|
100
|
+
assert page.find("#search_results").has_content?("Forest")
|
|
101
|
+
|
|
102
|
+
# TTL & RDF/XML
|
|
103
|
+
|
|
104
|
+
ttl_uri = page.all("#abstract_uri a")[-2][:href]
|
|
105
|
+
xml_uri = page.all("#abstract_uri a")[-1][:href]
|
|
106
|
+
|
|
107
|
+
visit ttl_uri
|
|
108
|
+
assert page.has_content?("search:result1 a sdc:Result")
|
|
109
|
+
assert page.has_no_content?("search:result2 a sdc:Result")
|
|
110
|
+
assert page.has_content?("sdc:link :#{@concepts[1].origin}")
|
|
111
|
+
assert page.has_content?('skos:prefLabel "Forest"@en')
|
|
112
|
+
|
|
113
|
+
visit xml_uri
|
|
114
|
+
assert page.source.include?(@concepts[1].origin)
|
|
115
|
+
assert page.source.include?("<skos:prefLabel xml:lang=\"en\">#{@concepts[1].to_s}</skos:prefLabel>")
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
test "searching specific classes within collections" do
|
|
119
|
+
concept = FactoryGirl.create(:concept, { :notes => [
|
|
120
|
+
Iqvoc::Concept.note_classes[1].new(:language => "en", :value => "lorem ipsum")
|
|
121
|
+
] })
|
|
122
|
+
|
|
123
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
124
|
+
|
|
125
|
+
select "Notes", :from => "t"
|
|
126
|
+
select "contains", :from => "qt"
|
|
127
|
+
fill_in "q", :with => "ipsum"
|
|
128
|
+
select @collection.to_s, :from => "c"
|
|
129
|
+
|
|
130
|
+
# select all languages
|
|
131
|
+
page.all(:css, ".lang_check").each do |cb|
|
|
132
|
+
check cb[:id]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
click_button("Search")
|
|
136
|
+
|
|
137
|
+
assert page.has_css?("#search_results dt", :count => 1)
|
|
138
|
+
assert page.find("#search_results").has_content?(concept.origin)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
test "empty query with selected collection should return all collection members" do
|
|
142
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
143
|
+
|
|
144
|
+
select "Labels", :from => "t"
|
|
145
|
+
select "exact match", :from => "qt"
|
|
146
|
+
fill_in "q", :with => ""
|
|
147
|
+
select @collection.to_s, :from => "c"
|
|
148
|
+
|
|
149
|
+
# select all languages
|
|
150
|
+
page.all(:css, ".lang_check").each do |cb|
|
|
151
|
+
check cb[:id]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
click_button("Search")
|
|
155
|
+
|
|
156
|
+
assert page.has_css?("#search_results dt", :count => 2)
|
|
157
|
+
assert page.find("#search_results").has_content?("Tree")
|
|
158
|
+
assert page.find("#search_results").has_content?("Forest")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
test "Pagination" do
|
|
162
|
+
# create a large number of concepts
|
|
163
|
+
12.times { |i|
|
|
164
|
+
FactoryGirl.create(:concept,
|
|
165
|
+
:pref_labelings => [Factory(:pref_labeling,
|
|
166
|
+
:target => Factory(:pref_label, :language => :en,
|
|
167
|
+
:value => "sample_#{sprintf("_%04d", i + 1)}"))])
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
visit search_path(:lang => 'en', :format => 'html')
|
|
171
|
+
|
|
172
|
+
select "Labels", :from => "t"
|
|
173
|
+
select "contains", :from => "qt"
|
|
174
|
+
fill_in "q", :with => "sample_"
|
|
175
|
+
|
|
176
|
+
click_button("Search")
|
|
177
|
+
|
|
178
|
+
assert page.has_css?("#search_results dt", :count => 5)
|
|
179
|
+
assert page.has_css?(".pagination .page", :count => 3)
|
|
180
|
+
|
|
181
|
+
click_link("3")
|
|
182
|
+
|
|
183
|
+
assert page.has_css?("#search_results dt", :count => 2)
|
|
184
|
+
|
|
185
|
+
# TTL & RDF/XML
|
|
186
|
+
|
|
187
|
+
ttl_uri = page.all("#abstract_uri a")[-2][:href]
|
|
188
|
+
xml_uri = page.all("#abstract_uri a")[-1][:href]
|
|
189
|
+
|
|
190
|
+
visit ttl_uri
|
|
191
|
+
assert page.has_content?("sdc:totalResults 12;")
|
|
192
|
+
assert page.has_content?("sdc:itemsPerPage 5;")
|
|
193
|
+
assert page.has_content?("search:result1 a sdc:Result;")
|
|
194
|
+
assert page.has_content?("search:result2 a sdc:Result;")
|
|
195
|
+
assert page.has_no_content?("search:result3 a sdc:Result;") # we're on page 3/3
|
|
196
|
+
|
|
197
|
+
visit xml_uri
|
|
198
|
+
assert page.source.include?('<sdc:totalResults rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">12</sdc:totalResults>')
|
|
199
|
+
assert page.source.include?('<sdc:itemsPerPage rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">5</sdc:itemsPerPage>')
|
|
200
|
+
assert page.source.include?('#result1">')
|
|
201
|
+
assert page.source.include?('#result2">')
|
|
202
|
+
assert !page.source.include?('#result3">') # we're on page 3/3
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 'test_helper'
|
|
18
|
+
require 'integration_test_helper'
|
|
19
|
+
|
|
20
|
+
class TreeTest < ActionDispatch::IntegrationTest
|
|
21
|
+
|
|
22
|
+
test "Browse hierarchical concepts tree" do
|
|
23
|
+
concept = Factory(:concept, :broader_relations => [])
|
|
24
|
+
narrower_concept = concept.narrower_relations.first.target
|
|
25
|
+
|
|
26
|
+
visit hierarchical_concepts_path(:lang => :de, :format => :html)
|
|
27
|
+
assert page.has_link?(concept.pref_label.to_s), "Concept #{concept.pref_label} isn't visible in the hierarchical concepts list"
|
|
28
|
+
assert !page.has_content?(narrower_concept.pref_label.to_s), "Narrower relation (#{narrower_concept.pref_label}) schouldn't be visible in the hierarchical concepts list"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 'test_helper'
|
|
18
|
+
require 'integration_test_helper'
|
|
19
|
+
|
|
20
|
+
class UntranslatedConceptsTest < ActionDispatch::IntegrationTest
|
|
21
|
+
|
|
22
|
+
setup do
|
|
23
|
+
[ {:en => "Xen1", :de => "Xde1"},
|
|
24
|
+
{:en => "Xen2"},
|
|
25
|
+
{:en => "Yen1", :de => "Yde1"},
|
|
26
|
+
{:en => "Yen2"}
|
|
27
|
+
].map do |hsh|
|
|
28
|
+
labelings = []
|
|
29
|
+
hsh.each do |lang, val|
|
|
30
|
+
labelings << Factory(:pref_labeling, :target => Factory(:pref_label, :language => lang, :value => val))
|
|
31
|
+
end
|
|
32
|
+
FactoryGirl.create(:concept, :pref_labelings => labelings)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
test "showing only concepts without pref label in respective language" do
|
|
37
|
+
visit untranslated_concepts_path(:lang => :de, :letter => "x", :format => :html)
|
|
38
|
+
concepts = page.all("#content ul")[1].all("li") # XXX: too unspecific
|
|
39
|
+
|
|
40
|
+
assert_equal :de, I18n.locale
|
|
41
|
+
assert_equal 1, concepts.length
|
|
42
|
+
assert_equal 1, concepts[0].all("a").length
|
|
43
|
+
assert_equal "Xen2", concepts[0].find("a").text.strip
|
|
44
|
+
|
|
45
|
+
visit untranslated_concepts_path(:lang => :de, :letter => "y", :format => :html)
|
|
46
|
+
concepts = page.all("#content ul")[1].all("li") # XXX: too unspecific
|
|
47
|
+
|
|
48
|
+
assert_equal 1, concepts.length
|
|
49
|
+
assert_equal "Yen2", concepts[0].find("a").text.strip
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
test "showing error message for thesaurus's main language" do
|
|
53
|
+
visit untranslated_concepts_path(:lang => :en, :letter => "x", :format => :html)
|
|
54
|
+
|
|
55
|
+
assert_equal :en, I18n.locale
|
|
56
|
+
assert_equal 1, page.all("#content p.flash_error").length
|
|
57
|
+
assert_equal 0, page.all("#content ul").length
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 'test_helper'
|
|
18
|
+
require 'capybara/rails'
|
|
19
|
+
|
|
20
|
+
module ActionController
|
|
21
|
+
class IntegrationTest
|
|
22
|
+
include Capybara::DSL
|
|
23
|
+
|
|
24
|
+
Capybara.javascript_driver = :webkit
|
|
25
|
+
|
|
26
|
+
def login(role = nil)
|
|
27
|
+
logout
|
|
28
|
+
user(role)
|
|
29
|
+
visit new_user_session_path(:lang => :de)
|
|
30
|
+
fill_in "E-Mail", :with => user.email
|
|
31
|
+
fill_in "Passwort", :with => user.password
|
|
32
|
+
click_button "Anmelden"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def logout
|
|
36
|
+
visit dashboard_path(:lang => :de)
|
|
37
|
+
click_link_or_button "Abmelden" if page.has_link?("Abmelden")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def user(role = nil)
|
|
41
|
+
@user ||= FactoryGirl.create(:user, :role => (role || User.default_role))
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 'test_helper'
|
|
18
|
+
require 'rails/performance_test_help'
|
|
19
|
+
|
|
20
|
+
# Profiling results for each test method are written to tmp/performance.
|
|
21
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
|
22
|
+
def test_homepage
|
|
23
|
+
get '/'
|
|
24
|
+
end
|
|
25
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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
|
+
ENV["RAILS_ENV"] = "test"
|
|
18
|
+
require File.expand_path('../../config/environment', __FILE__)
|
|
19
|
+
require 'rails/test_help'
|
|
20
|
+
|
|
21
|
+
class ActiveSupport::TestCase
|
|
22
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
23
|
+
#
|
|
24
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
25
|
+
# -- they do not yet inherit this setting
|
|
26
|
+
# fixtures :all
|
|
27
|
+
|
|
28
|
+
# Add more helper methods to be used by all tests here...
|
|
29
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 ConceptTest < ActiveSupport::TestCase
|
|
20
|
+
|
|
21
|
+
def setup
|
|
22
|
+
@current_concept = FactoryGirl.create(:concept)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
test "should not create more than two versions of a concept" do
|
|
26
|
+
first_new_concept = Concept::Base.new(@current_concept.attributes)
|
|
27
|
+
second_new_concept = Concept::Base.new(@current_concept.attributes)
|
|
28
|
+
assert first_new_concept.save
|
|
29
|
+
assert_equal second_new_concept.save, false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
test "should not save concept with empty preflabel" do
|
|
33
|
+
FactoryGirl.create(:concept).save_with_full_validation! # Is the factory working as expected?
|
|
34
|
+
assert_raise ActiveRecord::RecordInvalid do
|
|
35
|
+
FactoryGirl.create(:concept, :pref_labelings => []).save_with_full_validation!
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test "concepts without pref_labels should be saveable but not publishable" do
|
|
40
|
+
concept = FactoryGirl.create(:concept, :pref_labelings => [])
|
|
41
|
+
assert_equal [], concept.pref_labels
|
|
42
|
+
assert concept.valid?
|
|
43
|
+
assert !concept.valid_with_full_validation?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
test "published concept must have a pref_label of the first pref_label language configured (the main language)" do
|
|
47
|
+
concept = FactoryGirl.create(:concept)
|
|
48
|
+
assert_equal 1, concept.pref_labels.count
|
|
49
|
+
assert concept.valid_with_full_validation?
|
|
50
|
+
|
|
51
|
+
concept.pref_labels.first.language = Iqvoc::Concept.pref_labeling_languages.second
|
|
52
|
+
assert !concept.valid_with_full_validation?
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
test "concept shouldn't have more then one pref label of the same language" do
|
|
56
|
+
concept = FactoryGirl.create(:concept)
|
|
57
|
+
assert concept.valid?
|
|
58
|
+
concept.pref_labelings << FactoryGirl.build(:pref_labeling)
|
|
59
|
+
assert_equal 2, concept.pref_labelings.count
|
|
60
|
+
assert_equal concept.pref_labelings.first.target.language, concept.pref_labelings.second.target.language
|
|
61
|
+
assert concept.invalid?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
test "concepts can have multiple preferred labels" do
|
|
65
|
+
concept = FactoryGirl.build(:concept)
|
|
66
|
+
concept.labelings << FactoryGirl.build(:pref_labeling, :target => Factory(:pref_label, :language => Iqvoc::Concept.pref_labeling_languages.second))
|
|
67
|
+
concept.save!
|
|
68
|
+
concept.reload
|
|
69
|
+
|
|
70
|
+
assert_equal 2, concept.pref_labels.count
|
|
71
|
+
assert_not_equal concept.pref_labels.first.language, concept.pref_labels.second.language
|
|
72
|
+
assert concept.valid_with_full_validation?
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
test "labelings_by_text setter" do
|
|
76
|
+
concept = FactoryGirl.build(:concept, :pref_labelings => [])
|
|
77
|
+
|
|
78
|
+
concept.labelings_by_text = {
|
|
79
|
+
Iqvoc::Concept.pref_labeling_class_name.to_relation_name => {Iqvoc::Concept.pref_labeling_languages.first => 'A new label'}
|
|
80
|
+
}
|
|
81
|
+
assert concept.valid?
|
|
82
|
+
assert concept.save
|
|
83
|
+
concept.reload
|
|
84
|
+
assert_equal 'A new label', concept.pref_label.value
|
|
85
|
+
assert_equal Iqvoc::Concept.pref_labeling_languages.first.to_s, concept.pref_label.language.to_s
|
|
86
|
+
|
|
87
|
+
concept.labelings_by_text = {
|
|
88
|
+
Iqvoc::Concept.pref_labeling_class_name.to_relation_name => {Iqvoc::Concept.pref_labeling_languages.first => 'A new label, Another Label in the same language'}
|
|
89
|
+
}
|
|
90
|
+
assert !concept.save
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 NoteTest < ActiveSupport::TestCase
|
|
20
|
+
|
|
21
|
+
test "should parse turtle note annotations" do
|
|
22
|
+
str = '[umt:source <aDisBMS>; umt:thsisn "00000001"; dct:date "2010-04-29"]'
|
|
23
|
+
concept = Concept::SKOS::Base.create(:origin => "_00000001", :published_at => Time.now)
|
|
24
|
+
concept.note_skos_change_notes << ::Note::SKOS::ChangeNote.new.from_annotation_list!(str)
|
|
25
|
+
|
|
26
|
+
assert_equal 1, Note::SKOS::ChangeNote.count, 1
|
|
27
|
+
assert_equal 3, Note::SKOS::ChangeNote.first.annotations.count, 3
|
|
28
|
+
assert_equal 1, Note::Annotated::Base.where(:namespace => "umt",
|
|
29
|
+
:predicate => 'thsisn', :value => '"00000001"').count
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 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 OriginMappingTest < ActiveSupport::TestCase
|
|
20
|
+
|
|
21
|
+
def test_should_replace_umlauts
|
|
22
|
+
assert_equal "AeaeUeueOeoess", OriginMapping.merge("ÄäÜüÖöß")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_should_camalize_string
|
|
26
|
+
assert_equal "AWeighting", OriginMapping.merge("'A' Weighting")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_should_handle_numbers_at_the_beginning
|
|
30
|
+
assert_equal "_123", OriginMapping.merge("123")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_should_handle_whitespaces_at_strange_positions
|
|
34
|
+
assert_equal "test12", OriginMapping.merge("test 12 ")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_should_handle_dashes_at_the_beginning
|
|
38
|
+
assert_equal "_-bla", OriginMapping.merge("-bla")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_should_preserve_underlines
|
|
42
|
+
assert_equal "_test", OriginMapping.merge("_test")
|
|
43
|
+
assert_equal "a_Test", OriginMapping.merge("a_Test")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_should_preserve_case
|
|
47
|
+
assert_equal "test", OriginMapping.merge("test")
|
|
48
|
+
assert_equal "Test", OriginMapping.merge("Test")
|
|
49
|
+
assert_equal "_5test", OriginMapping.merge("5test")
|
|
50
|
+
assert_equal "_5Test", OriginMapping.merge("5Test")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_should_replace_brackets
|
|
54
|
+
assert_equal "_--Energie-Ressource", OriginMapping.merge("[Energie/Ressource]")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_should_replace_comma
|
|
58
|
+
assert_equal "_-", OriginMapping.merge(",")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_should_merge_all_together
|
|
62
|
+
assert_equal "_--Energie-Ressource", OriginMapping.merge("[Energie - Ressource]")
|
|
63
|
+
assert_equal "_--Hydrosphaere-WasserUndGewaesser", OriginMapping.merge("[Hydrosphäre - Wasser und Gewässer]")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_sanitize_for_base_form
|
|
67
|
+
assert_equal "commaslashdotbracketbracket", OriginMapping.sanitize_for_base_form("comma,slash/dot.bracket[bracket]")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|