diff --git a/app/assets/javascripts/bp_annotator.js b/app/assets/javascripts/bp_annotator.js index 96cced42d2..b1f8c81124 100644 --- a/app/assets/javascripts/bp_annotator.js +++ b/app/assets/javascripts/bp_annotator.js @@ -55,8 +55,7 @@ function get_annotations() { ajax_process_halt(); var params = {}, - ont_select = jQuery("#ontology_ontologyId"), - mappings = []; + ont_select = jQuery("#ontology_ontologyId"); params.text = jQuery("#annotation_text").val(); params.ontologies = (ont_select.val() === null) ? [] : ont_select.val(); @@ -64,6 +63,7 @@ function get_annotations() { params.exclude_numbers = jQuery("#exclude_numbers").is(':checked'); params.whole_word_only = !jQuery("#match_partial_words").is(':checked'); params.exclude_synonyms = jQuery("#exclude_synonyms").is(':checked'); + params.expand_mappings = jQuery("#expand_mappings").is(':checked'); params.ncbo_slice = (("ncbo_slice" in BP_CONFIG) ? BP_CONFIG.ncbo_slice : ''); var maxLevel = parseInt(jQuery("#class_hierarchy_max_level").val()); @@ -83,11 +83,6 @@ function get_annotations() { // params.wholeWordOnly = jQuery("#wholeWordOnly:checked").val(); //} - jQuery("[name='mappings']:checked").each(function() { - mappings.push(jQuery(this).val()); - }); - params.mappings = mappings; - if (jQuery("#semantic_types").val() !== null) { params.semantic_types = jQuery("#semantic_types").val(); annotationsTable.fnSetColumnVis(BP_COLUMNS.sem_types, true); diff --git a/app/controllers/annotator_controller.rb b/app/controllers/annotator_controller.rb index 9878256578..36679d79c2 100644 --- a/app/controllers/annotator_controller.rb +++ b/app/controllers/annotator_controller.rb @@ -31,7 +31,7 @@ def create :class_hierarchy_max_level => params[:class_hierarchy_max_level].to_i, :expand_class_hierarchy => params[:class_hierarchy_max_level].to_i > 0, :semantic_types => params[:semantic_types], - :mappings => params[:mappings], + :expand_mappings => params[:expand_mappings], :longest_only => params[:longest_only], :exclude_numbers => params[:exclude_numbers] ||= "false", # service default is false :whole_word_only => params[:whole_word_only] ||= "true", # service default is true @@ -42,19 +42,20 @@ def create start = Time.now query = ANNOTATOR_URI query += "?text=" + CGI.escape(text_to_annotate) - query += "&include=prefLabel" + #query += "&include=prefLabel" + # Include= prefLabel causes an internal error when retrieving mappings query += "&expand_class_hierarchy=true" if options[:class_hierarchy_max_level] > 0 query += "&class_hierarchy_max_level=" + options[:class_hierarchy_max_level].to_s if options[:class_hierarchy_max_level] > 0 query += "&ontologies=" + CGI.escape(options[:ontologies].join(',')) unless options[:ontologies].empty? query += "&semantic_types=" + options[:semantic_types].join(',') unless options[:semantic_types].empty? - query += "&mappings=" + options[:mappings].join(',') unless options[:mappings].empty? + query += "&expand_mappings=" + options[:expand_mappings].to_s unless options[:expand_mappings].empty? query += "&longest_only=#{options[:longest_only]}" query += "&recognizer=#{params[:recognizer]}" query += "&exclude_numbers=" + options[:exclude_numbers].to_s unless options[:exclude_numbers].empty? query += "&whole_word_only=" + options[:whole_word_only].to_s unless options[:whole_word_only].empty? query += "&exclude_synonyms=" + options[:exclude_synonyms].to_s unless options[:exclude_synonyms].empty? query += "&ncbo_slice=" + options[:ncbo_slice].to_s unless options[:ncbo_slice].empty? - + annotations = parse_json(query) # See application_controller.rb #annotations = LinkedData::Client::HTTP.get(query) LOG.add :debug, "Retrieved #{annotations.length} annotations: #{Time.now - start}s" diff --git a/app/views/annotator/index.html.haml b/app/views/annotator/index.html.haml index 69bbbd455c..d9f40f40be 100644 --- a/app/views/annotator/index.html.haml +++ b/app/views/annotator/index.html.haml @@ -21,8 +21,8 @@ = label_tag :longest_only, "Match Longest Only"    / TODO: When the REST API supports different mapping types, revise this section of the UI. - = check_box_tag :mappings, :all, false, :id => "mappings_all" - = label_tag :mappings_all, "Include Mappings" + = check_box_tag :expand_mappings, :all, false, :id => "expand_mappings" + = label_tag :expand_mappings, "Include Mappings" %p = check_box_tag :exclude_numbers, :all, false, :id => "exclude_numbers" = label_tag :exclude_numbers, "Exclude Numbers"