Skip to content

Commit

Permalink
Merge pull request #155 from ontoportal-lirmm/pr/fix/annotator-multil…
Browse files Browse the repository at this point in the history
…ingual-filter-attributes

Fix: annotator attributes languages  filter
  • Loading branch information
alexskr authored Jul 22, 2024
2 parents 237ecd5 + 1b323bc commit db96fed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def populate_classes_from_search(classes, ontology_acronyms=nil)
doc[:submission] = old_class.submission
doc[:properties] = MultiJson.load(doc.delete(:propertyRaw)) if include_param_contains?(:properties)
instance = LinkedData::Models::Class.read_only(doc)
instance.prefLabel = instance.prefLabel.first if instance.prefLabel.is_a?(Array)
filter_language_attributes(@params, instance)
classes_hash[ont_uri_class_uri] = instance
end

Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_annotator_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ def test_default_properties_output
assert_equal 9, annotations.length
annotations.sort! { |a,b| a["annotatedClass"]["prefLabel"].first.downcase <=> b["annotatedClass"]["prefLabel"].first.downcase }
assert_equal "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Aggregate_Human_Data", annotations.first["annotatedClass"]["@id"]
assert_equal "Aggregate Human Data", Array(annotations.first["annotatedClass"]["prefLabel"]).first
assert_equal "Aggregate Human Data", annotations.first["annotatedClass"]["prefLabel"]

params = {text: text, include: "prefLabel,definition"}
get "/annotator", params
assert last_response.ok?
annotations = MultiJson.load(last_response.body)
assert_equal 9, annotations.length
annotations.sort! { |a,b| Array(a["annotatedClass"]["prefLabel"]).first.downcase <=> Array(b["annotatedClass"]["prefLabel"]).first.downcase }
annotations.sort! { |a,b| a["annotatedClass"]["prefLabel"].downcase <=> b["annotatedClass"]["prefLabel"].downcase }
assert_equal "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Aggregate_Human_Data", annotations.first["annotatedClass"]["@id"]
assert_equal ["A resource that provides data from clinical care that comprises combined data from multiple individual human subjects."], annotations.first["annotatedClass"]["definition"]
end
Expand Down

0 comments on commit db96fed

Please sign in to comment.