Skip to content

Commit

Permalink
add test for multilingual terms indexation and search
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jul 14, 2023
1 parent e1ea76d commit 4f09fb6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/data/ontology_files/BRO_v3.5.owl
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@

<owl:Class rdf:about="&activity;Activity">
<core:prefLabel rdf:datatype="&xsd;string">Activity</core:prefLabel>
<core:prefLabel xml:lang="en">ActivityEnglish</core:prefLabel>
<core:prefLabel xml:lang="fr">Activité</core:prefLabel>
<desc:definition rdf:datatype="&xsd;string">Activity of interest that may be related to a BRO:Resource.</desc:definition>
<core:altLabel>activities</core:altLabel>
</owl:Class>
Expand Down
34 changes: 34 additions & 0 deletions test/models/test_ontology_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,40 @@ def test_index_properties
assert_equal 0, res["response"]["numFound"]
end

def test_index_multilingual

submission_parse("BRO", "BRO Ontology",
"./test/data/ontology_files/BRO_v3.5.owl", 1,
process_rdf: true, reasoning: false, index_search: true)


res = LinkedData::Models::Class.search("prefLabel:Activity", {:fq => "submissionAcronym:BRO", :start => 0, :rows => 80}, :main)
refute_equal 0, res["response"]["numFound"]

doc = res["response"]["docs"].select{|doc| doc["resource_id"].to_s.eql?('http://bioontology.org/ontologies/Activity.owl#Activity')}.first
refute_nil doc
assert_equal 30, doc.keys.select{|k| k['prefLabel'] || k['synonym']}.size # test that all the languages are indexed


res = LinkedData::Models::Class.search("prefLabel_none:Activity", {:fq => "submissionAcronym:BRO", :start => 0, :rows => 80}, :main)
refute_equal 0, res["response"]["numFound"]
refute_nil res["response"]["docs"].select{|doc| doc["resource_id"].eql?('http://bioontology.org/ontologies/Activity.owl#Activity')}.first

res = LinkedData::Models::Class.search("prefLabel_fr:Activité", {:fq => "submissionAcronym:BRO", :start => 0, :rows => 80}, :main)
refute_equal 0, res["response"]["numFound"]
refute_nil res["response"]["docs"].select{|doc| doc["resource_id"].eql?('http://bioontology.org/ontologies/Activity.owl#Activity')}.first



res = LinkedData::Models::Class.search("prefLabel_en:ActivityEnglish", {:fq => "submissionAcronym:BRO", :start => 0, :rows => 80}, :main)
refute_equal 0, res["response"]["numFound"]
refute_nil res["response"]["docs"].select{|doc| doc["resource_id"].eql?('http://bioontology.org/ontologies/Activity.owl#Activity')}.first


res = LinkedData::Models::Class.search("prefLabel_fr:Activity", {:fq => "submissionAcronym:BRO", :start => 0, :rows => 80}, :main)
assert_equal 0, res["response"]["numFound"]
end

def test_zipped_submission_process
acronym = "PIZZA"
name = "PIZZA Ontology"
Expand Down

0 comments on commit 4f09fb6

Please sign in to comment.