iqvoc 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- 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,74 @@
|
|
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
|
+
class Concepts::HierarchicalController < ConceptsController
|
18
|
+
skip_before_filter :require_user
|
19
|
+
|
20
|
+
def index
|
21
|
+
authorize! :read, Iqvoc::Concept.base_class
|
22
|
+
|
23
|
+
scope = if params[:published] == '0'
|
24
|
+
Iqvoc::Concept.base_class.editor_selectable
|
25
|
+
else
|
26
|
+
Iqvoc::Concept.base_class.published
|
27
|
+
end
|
28
|
+
|
29
|
+
# if params[:broader] is given, the action is handling the reversed tree
|
30
|
+
@concepts = case params[:root]
|
31
|
+
when /\d+/
|
32
|
+
root_concept = Iqvoc::Concept.base_class.find(params[:root])
|
33
|
+
if params[:broader]
|
34
|
+
scope.
|
35
|
+
includes(:narrower_relations, :broader_relations). # D A N G E R: the order matters!!! See the following where
|
36
|
+
where(Concept::Relation::Base.arel_table[:target_id].eq(root_concept.id))
|
37
|
+
else
|
38
|
+
scope.
|
39
|
+
includes(:broader_relations, :narrower_relations). # D A N G E R: the order matters!!! See the following where
|
40
|
+
where(Concept::Relation::Base.arel_table[:target_id].eq(root_concept.id))
|
41
|
+
end
|
42
|
+
else
|
43
|
+
if params[:broader]
|
44
|
+
scope.broader_tops.includes(:broader_relations)
|
45
|
+
else
|
46
|
+
scope.tops.includes(:narrower_relations)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
# When in single query mode, AR handles ALL includes to be loaded by that
|
50
|
+
# one query. We don't want that! So let's do it manually :-)
|
51
|
+
Iqvoc::Concept.base_class.send(:preload_associations, @concepts, Iqvoc::Concept.base_class.default_includes + [:pref_labels])
|
52
|
+
|
53
|
+
@concepts.sort! do |a, b|
|
54
|
+
a.pref_label.to_s <=> b.pref_label.to_s
|
55
|
+
end
|
56
|
+
|
57
|
+
respond_to do |format|
|
58
|
+
format.html
|
59
|
+
format.json do # Treeview data
|
60
|
+
@concepts.map! do |c|
|
61
|
+
{
|
62
|
+
:id => c.id,
|
63
|
+
:url => concept_path(:id => c, :format => :html),
|
64
|
+
:text => CGI.escapeHTML(c.pref_label.to_s),
|
65
|
+
:hasChildren => (params[:broader] ? c.broader_relations.any? : c.narrower_relations.any?),
|
66
|
+
:additionalText => (" (#{c.additional_info})" if c.additional_info.present?)
|
67
|
+
}
|
68
|
+
end
|
69
|
+
render :json => @concepts.to_json
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
# TODO: This class (including the view) should not exist! Please move this back
|
18
|
+
# into the alphabetical_controller. The only difference between those two
|
19
|
+
# controllers is the scope used. Use if statements or published methods instead.
|
20
|
+
# "DRYness"
|
21
|
+
class Concepts::UntranslatedController < ConceptsController
|
22
|
+
skip_before_filter :require_user
|
23
|
+
|
24
|
+
def index
|
25
|
+
authorize! :read, Concept::Base
|
26
|
+
|
27
|
+
scope = Iqvoc::Concept.pref_labeling_class.label_class.
|
28
|
+
begins_with(params[:letter]).
|
29
|
+
missing_translation(I18n.locale, Iqvoc::Concept.pref_labeling_languages.first)
|
30
|
+
|
31
|
+
if I18n.locale == Iqvoc::Concept.pref_labeling_languages.first # TODO: Should be 404!
|
32
|
+
flash[:error] = I18n.t("txt.views.untranslated_concepts.unavailable")
|
33
|
+
else
|
34
|
+
@labels = scope.order("LOWER(labels.value)").page(params[:page])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,119 @@
|
|
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
|
+
class Concepts::VersionsController < ApplicationController
|
18
|
+
|
19
|
+
def merge
|
20
|
+
current_concept = Iqvoc::Concept.base_class.by_origin(params[:origin]).published.last
|
21
|
+
new_version = Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
22
|
+
raise ActiveRecord::RecordNotFound.new("Couldn't find unpublished concept with origin '#{params[:origin]}'") unless new_version
|
23
|
+
|
24
|
+
authorize! :merge, new_version
|
25
|
+
|
26
|
+
ActiveRecord::Base.transaction do
|
27
|
+
if current_concept.blank? || current_concept.destroy
|
28
|
+
new_version.publish
|
29
|
+
new_version.unlock
|
30
|
+
if new_version.valid_with_full_validation?
|
31
|
+
new_version.save
|
32
|
+
if RdfStore.update(rdf_url(:id => new_version, :format => :ttl), concept_url(:id => new_version, :format => :ttl))
|
33
|
+
new_version.update_attribute(:rdf_updated_at, 1.seconds.since)
|
34
|
+
end
|
35
|
+
flash[:notice] = t("txt.controllers.versioning.published")
|
36
|
+
redirect_to concept_path(:id => new_version)
|
37
|
+
else
|
38
|
+
flash[:error] = t("txt.controllers.versioning.merged_publishing_error")
|
39
|
+
redirect_to concept_path(:published => 0, :id => new_version)
|
40
|
+
end
|
41
|
+
else
|
42
|
+
flash[:error] = t("txt.controllers.versioning.merged_delete_error")
|
43
|
+
redirect_to concept_path(:published => 0, :id => new_version)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def branch
|
49
|
+
current_concept = Iqvoc::Concept.base_class.by_origin(params[:origin]).published.last
|
50
|
+
raise ActiveRecord::RecordNotFound.new("Couldn't find published concept with origin '#{params[:origin]}'") unless current_concept
|
51
|
+
raise "There is already an unpublished version for Concept '#{params[:origin]}'" if Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
52
|
+
|
53
|
+
authorize! :branch, current_concept
|
54
|
+
|
55
|
+
new_version = nil
|
56
|
+
ActiveRecord::Base.transaction do
|
57
|
+
new_version = current_concept.branch(current_user)
|
58
|
+
new_version.save!
|
59
|
+
end
|
60
|
+
flash[:notice] = t("txt.controllers.versioning.branched")
|
61
|
+
redirect_to edit_concept_path(:published => 0, :id => new_version)
|
62
|
+
end
|
63
|
+
|
64
|
+
def lock
|
65
|
+
new_version = Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
66
|
+
raise ActiveRecord::RecordNotFound.new("Couldn't find unpublished concept with origin '#{params[:origin]}'") unless new_version
|
67
|
+
raise "Concept with origin '#{params[:origin]}' has already been locked." if new_version.locked?
|
68
|
+
|
69
|
+
authorize! :lock, new_version
|
70
|
+
|
71
|
+
new_version.lock_by_user(current_user.id)
|
72
|
+
new_version.save!
|
73
|
+
|
74
|
+
flash[:notice] = t("txt.controllers.versioning.locked")
|
75
|
+
redirect_to edit_concept_path(:published => 0, :id => new_version)
|
76
|
+
end
|
77
|
+
|
78
|
+
def unlock
|
79
|
+
new_version = Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
80
|
+
raise ActiveRecord::RecordNotFound.new("Couldn't find unpublished concept with origin '#{params[:origin]}'") unless new_version
|
81
|
+
raise "Concept with origin '#{params[:origin]}' wasn't locked." unless new_version.locked?
|
82
|
+
|
83
|
+
authorize! :unlock, new_version
|
84
|
+
|
85
|
+
new_version.unlock
|
86
|
+
new_version.save!
|
87
|
+
|
88
|
+
flash[:notice] = t("txt.controllers.versioning.unlocked")
|
89
|
+
redirect_to concept_path(:published => 0, :id => new_version)
|
90
|
+
end
|
91
|
+
|
92
|
+
def consistency_check
|
93
|
+
concept = Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
94
|
+
raise ActiveRecord::RecordNotFound unless concept
|
95
|
+
|
96
|
+
authorize! :check_consistency, concept
|
97
|
+
|
98
|
+
if concept.valid_with_full_validation?
|
99
|
+
flash[:notice] = t("txt.controllers.versioning.consistency_check_success")
|
100
|
+
redirect_to concept_path(:published => 0, :id => concept)
|
101
|
+
else
|
102
|
+
flash[:error] = t("txt.controllers.versioning.consistency_check_error")
|
103
|
+
redirect_to edit_concept_path(:published => 0, :id => concept, :full_consistency_check => "1")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def to_review
|
108
|
+
concept = Iqvoc::Concept.base_class.by_origin(params[:origin]).unpublished.last
|
109
|
+
raise ActiveRecord::RecordNotFound unless concept
|
110
|
+
|
111
|
+
authorize! :send_to_review, concept
|
112
|
+
|
113
|
+
concept.to_review
|
114
|
+
concept.save!
|
115
|
+
flash[:notice] = t("txt.controllers.versioning.to_review_success")
|
116
|
+
redirect_to concept_path(:published => 0, :id => concept)
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
@@ -0,0 +1,174 @@
|
|
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
|
+
class ConceptsController < ApplicationController
|
18
|
+
skip_before_filter :require_user
|
19
|
+
|
20
|
+
def index
|
21
|
+
authorize! :read, Concept::Base
|
22
|
+
|
23
|
+
respond_to do |format|
|
24
|
+
format.json do # Search for widget
|
25
|
+
@concepts = Iqvoc::Concept.base_class.editor_selectable.with_pref_labels.merge(Label::Base.by_query_value("#{params[:query]}%")).all
|
26
|
+
response = []
|
27
|
+
@concepts.each { |concept| response << concept_widget_data(concept)}
|
28
|
+
|
29
|
+
render :json => response
|
30
|
+
end
|
31
|
+
format.all do # RDF full export
|
32
|
+
authorize! :full_export, Concept::Base
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def show
|
38
|
+
scope = Iqvoc::Concept.base_class.
|
39
|
+
by_origin(params[:id]).
|
40
|
+
with_associations
|
41
|
+
published = params[:published] == '1' || !params[:published]
|
42
|
+
if published
|
43
|
+
scope = scope.published
|
44
|
+
@new_concept_version = Iqvoc::Concept.base_class.by_origin(params[:id]).unpublished.last
|
45
|
+
else
|
46
|
+
scope = scope.unpublished
|
47
|
+
end
|
48
|
+
|
49
|
+
@concept = scope.last
|
50
|
+
raise ActiveRecord::RecordNotFound unless @concept
|
51
|
+
|
52
|
+
authorize! :read, @concept
|
53
|
+
|
54
|
+
respond_to do |format|
|
55
|
+
format.html do
|
56
|
+
# When in single query mode, AR handles ALL includes to be loaded by that
|
57
|
+
# one query. We don't want that! So let's do it manually :-)
|
58
|
+
Concept::Base.send(:preload_associations, @concept, Iqvoc::Concept.base_class.default_includes +
|
59
|
+
[:collection_members => {:collection => :labels},
|
60
|
+
:broader_relations => {:target => [:pref_labels, :broader_relations]},
|
61
|
+
:narrower_relations => {:target => [:pref_labels, :narrower_relations]}])
|
62
|
+
|
63
|
+
published ? render('show_published') : render('show_unpublished')
|
64
|
+
end
|
65
|
+
format.json do
|
66
|
+
# When in single query mode, AR handles ALL includes to be loaded by that
|
67
|
+
# one query. We don't want that! So let's do it manually :-)
|
68
|
+
Concept::Base.send(:preload_associations, @concept, [:labels,
|
69
|
+
{ :relations => { :target => [:labelings, :relations] } }])
|
70
|
+
|
71
|
+
concept_data = {
|
72
|
+
:origin => @concept.origin,
|
73
|
+
:labels => @concept.labelings.map { |ln| labeling_as_json(ln) },
|
74
|
+
:relations => @concept.relations.map { |relation|
|
75
|
+
concept = relation.target
|
76
|
+
{
|
77
|
+
:origin => concept.origin,
|
78
|
+
:labels => concept.labelings.map { |ln| labeling_as_json(ln) },
|
79
|
+
:relations => concept.relations.length
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
render :json => concept_data
|
84
|
+
end
|
85
|
+
format.ttl
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def new
|
90
|
+
authorize! :create, Iqvoc::Concept.base_class
|
91
|
+
|
92
|
+
@concept = Iqvoc::Concept.base_class.new
|
93
|
+
|
94
|
+
Iqvoc::Concept.note_class_names.each do |note_class_name|
|
95
|
+
@concept.send(note_class_name.to_relation_name).build if @concept.send(note_class_name.to_relation_name).empty?
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def create
|
100
|
+
authorize! :create, Iqvoc::Concept.base_class
|
101
|
+
|
102
|
+
@concept = Iqvoc::Concept.base_class.new(params[:concept])
|
103
|
+
if @concept.save
|
104
|
+
flash[:notice] = I18n.t("txt.controllers.versioned_concept.success")
|
105
|
+
redirect_to concept_path(:published => 0, :id => @concept.origin)
|
106
|
+
else
|
107
|
+
flash.now[:error] = I18n.t("txt.controllers.versioned_concept.error")
|
108
|
+
render :new
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def edit
|
113
|
+
@concept = Iqvoc::Concept.base_class.by_origin(params[:id]).unpublished.last
|
114
|
+
raise ActiveRecord::RecordNotFound unless @concept
|
115
|
+
|
116
|
+
authorize! :update, @concept
|
117
|
+
|
118
|
+
@association_objects_in_editing_mode = @concept.associated_objects_in_editing_mode
|
119
|
+
|
120
|
+
if params[:full_consistency_check]
|
121
|
+
@concept.valid_with_full_validation?
|
122
|
+
end
|
123
|
+
|
124
|
+
Iqvoc::Concept.note_class_names.each do |note_class_name|
|
125
|
+
@concept.send(note_class_name.to_relation_name).build if @concept.send(note_class_name.to_relation_name).empty?
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def update
|
130
|
+
@concept = Iqvoc::Concept.base_class.by_origin(params[:id]).unpublished.last
|
131
|
+
raise ActiveRecord::RecordNotFound unless @concept
|
132
|
+
|
133
|
+
authorize! :update, @concept
|
134
|
+
|
135
|
+
if @concept.update_attributes(params[:concept])
|
136
|
+
flash[:notice] = I18n.t("txt.controllers.versioned_concept.update_success")
|
137
|
+
redirect_to concept_path(:published => 0, :id => @concept)
|
138
|
+
else
|
139
|
+
flash.now[:error] = I18n.t("txt.controllers.versioned_concept.update_error")
|
140
|
+
render :action => :edit
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def destroy
|
145
|
+
@new_concept = Iqvoc::Concept.base_class.by_origin(params[:id]).unpublished.last
|
146
|
+
raise ActiveRecord::RecordNotFound unless @new_concept
|
147
|
+
|
148
|
+
authorize! :destroy, @new_concept
|
149
|
+
|
150
|
+
if @new_concept.destroy
|
151
|
+
flash[:notice] = I18n.t("txt.controllers.concept_versions.delete")
|
152
|
+
redirect_to dashboard_path
|
153
|
+
else
|
154
|
+
flash[:notice] = I18n.t("txt.controllers.concept_versions.delete_error")
|
155
|
+
redirect_to concept_path(:published => 0, :id => @new_concept)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
protected
|
160
|
+
|
161
|
+
# TODO: Find a method name matching the behaviour of the method
|
162
|
+
def labeling_as_json(labeling)
|
163
|
+
label = labeling.target
|
164
|
+
return {
|
165
|
+
:origin => label.origin,
|
166
|
+
:reltype => labeling.type.to_relation_name,
|
167
|
+
:value => label.value,
|
168
|
+
:lang => label.language
|
169
|
+
# TODO: relations (XL only)
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
@@ -0,0 +1,43 @@
|
|
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
|
+
class DashboardController < ApplicationController
|
18
|
+
|
19
|
+
def index
|
20
|
+
authorize! :use, :dashboard
|
21
|
+
|
22
|
+
@items = []
|
23
|
+
Iqvoc.first_level_classes.each do |klass|
|
24
|
+
@items += klass.for_dashboard.all
|
25
|
+
end
|
26
|
+
|
27
|
+
factor = params[:order] == "desc" ? -1 : 1
|
28
|
+
|
29
|
+
if ['class', 'locking_user', 'follow_up', 'updated_at', 'state'].include?(params[:by])
|
30
|
+
@items.sort! do |x, y|
|
31
|
+
xval, yval = x.send(params[:by]), y.send(params[:by])
|
32
|
+
xval = xval.to_s.downcase unless xval.is_a?(Date)
|
33
|
+
yval = yval.to_s.downcase unless yval.is_a?(Date)
|
34
|
+
(xval <=> yval) * factor
|
35
|
+
end
|
36
|
+
else
|
37
|
+
@items.sort! { |x,y| (x.to_s.downcase <=> y.to_s.downcase) * factor } rescue nil
|
38
|
+
end
|
39
|
+
|
40
|
+
@items = Kaminari.paginate_array(@items).page(params[:page])
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
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
|
+
class PagesController < ApplicationController
|
18
|
+
skip_before_filter :require_user
|
19
|
+
|
20
|
+
# TODO: Some kind of authorization is missing here!
|
21
|
+
# (even everybody has the right in the Ability)
|
22
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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
|
+
class RdfController < ApplicationController
|
18
|
+
|
19
|
+
skip_before_filter :require_user
|
20
|
+
skip_before_filter :set_locale
|
21
|
+
|
22
|
+
def show
|
23
|
+
scope = if (params[:published] == "0")
|
24
|
+
Iqvoc::Concept.base_class.scoped.unpublished
|
25
|
+
else
|
26
|
+
Iqvoc::Concept.base_class.scoped.published
|
27
|
+
end
|
28
|
+
if @concept = scope.by_origin(params[:id]).with_associations.last
|
29
|
+
respond_to do |format|
|
30
|
+
format.html {
|
31
|
+
redirect_to concept_url(:id => @concept.origin, :published => params[:published])
|
32
|
+
}
|
33
|
+
format.any {
|
34
|
+
authorize! :read, @concept
|
35
|
+
render "show_concept"
|
36
|
+
}
|
37
|
+
end
|
38
|
+
else
|
39
|
+
raise ActiveRecord::RecordNotFound.new("Coulnd't find either a concept matching '#{params[:id]}'.")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,101 @@
|
|
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
|
+
class SearchResultsController < ApplicationController
|
18
|
+
skip_before_filter :require_user
|
19
|
+
|
20
|
+
def index
|
21
|
+
authorize! :read, Concept::Base # TODO: I think a :search right would be
|
22
|
+
# better here because you're able to serach more than only concepts.
|
23
|
+
|
24
|
+
self.class.prepare_basic_variables(self)
|
25
|
+
|
26
|
+
# Map short params to their log representation
|
27
|
+
{:t => :type, :q => :query, :l => :languages, :qt => :query_type, :c => :collection_origin}.each do |short, long|
|
28
|
+
params[long] ||= params[short]
|
29
|
+
end
|
30
|
+
|
31
|
+
# Select first type by default
|
32
|
+
params[:type] = Iqvoc.searchable_class_names.first.parameterize unless params[:type]
|
33
|
+
|
34
|
+
# Delete parameters which should not be included into generated urls (e.g.
|
35
|
+
# in rdf views)
|
36
|
+
request.query_parameters.delete("commit")
|
37
|
+
request.query_parameters.delete("utf8")
|
38
|
+
|
39
|
+
if params[:query]
|
40
|
+
if params[:query].blank? && params[:collection_origin].blank?
|
41
|
+
flash.now[:error] = I18n.t('txt.controllers.search_results.insufficient_data')
|
42
|
+
render :action => 'index', :status => 422
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
# Special treatment for the "nil language"
|
47
|
+
params[:languages] << nil if params[:languages].is_a?(Array) && params[:languages].include?("none")
|
48
|
+
|
49
|
+
# Ensure a valid class was selected
|
50
|
+
unless type_class_index = Iqvoc.searchable_class_names.map(&:parameterize).index(params[:type].parameterize)
|
51
|
+
raise "'#{params[:type]}' is not a valid / configured searchable class! Must be one of " + Iqvoc.searchable_class_names.join(', ')
|
52
|
+
end
|
53
|
+
klass = Iqvoc.searchable_class_names[type_class_index].constantize
|
54
|
+
|
55
|
+
query_size = params[:query].split(/\r\n/).size
|
56
|
+
|
57
|
+
if klass.forces_multi_query? || (klass.supports_multi_query? && query_size > 1)
|
58
|
+
@multi_query = true
|
59
|
+
@results = klass.multi_query(params)
|
60
|
+
# TODO: Add a worst case limit here; e.g. when on page 2 (per_page == 50)
|
61
|
+
# each sub-query has to return 100 objects at most.
|
62
|
+
@klass = klass
|
63
|
+
else
|
64
|
+
@multi_query = false
|
65
|
+
@results = klass.single_query(params)
|
66
|
+
end
|
67
|
+
|
68
|
+
if @multi_query
|
69
|
+
@results = Kaminari.paginate_array(@results)
|
70
|
+
logger.debug("Using multi query mode")
|
71
|
+
else
|
72
|
+
logger.debug("Using single query mode")
|
73
|
+
end
|
74
|
+
|
75
|
+
@results = @results.page(params[:page])
|
76
|
+
|
77
|
+
if params[:limit] and Iqvoc.unlimited_search_results
|
78
|
+
@results = @results.per(params[:limit].to_i)
|
79
|
+
end
|
80
|
+
|
81
|
+
respond_to do |format|
|
82
|
+
format.html
|
83
|
+
format.ttl { render('search_results/index.iqrdf') }
|
84
|
+
format.rdf { render('search_results/index.iqrdf') }
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.prepare_basic_variables(controller)
|
91
|
+
langs = (Iqvoc.available_languages + Iqvoc::Concept.labeling_class_names.values.flatten).uniq.each_with_object({}) do |lang_sym, hsh|
|
92
|
+
lang_sym ||= "none"
|
93
|
+
hsh[lang_sym.to_s] = I18n.t("languages.#{lang_sym.to_s}", :default => lang_sym.to_s)
|
94
|
+
end
|
95
|
+
controller.instance_variable_set(:@available_languages, langs)
|
96
|
+
|
97
|
+
collections = Iqvoc::Collection.base_class.includes(:pref_labels).all
|
98
|
+
controller.instance_variable_set(:@collections, collections)
|
99
|
+
end
|
100
|
+
|
101
|
+
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
|
+
class TripleStoreSyncsController < ApplicationController
|
18
|
+
|
19
|
+
# TODO: This must definitely be rebuild!
|
20
|
+
|
21
|
+
def new
|
22
|
+
authorize! :use, :dashboard # TODO
|
23
|
+
end
|
24
|
+
|
25
|
+
def create
|
26
|
+
authorize! :use, :dashboard # TODO
|
27
|
+
|
28
|
+
time = Time.now
|
29
|
+
|
30
|
+
rdf_helper = Object.new.extend(RdfHelper)
|
31
|
+
|
32
|
+
Concept::Base.published.unsynced.find_each do |concept|
|
33
|
+
concept.update_attribute(:rdf_updated_at, time) if RdfStore.mass_import(concept.rdf_uri, rdf_helper.render_ttl_for_concept(concept))
|
34
|
+
end
|
35
|
+
|
36
|
+
Label::Base.published.unsynced.find_each do |label|
|
37
|
+
label.update_attribute(:rdf_updated_at, time) if RdfStore.mass_import(label.rdf_uri, rdf_helper.render_ttl_for_label(label))
|
38
|
+
end
|
39
|
+
|
40
|
+
flash.now[:notice] = I18n.t("txt.controllers.triple_store_syncs.success")
|
41
|
+
|
42
|
+
render :action => "new"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|