Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Multilingual prefLabel(s) are captured incorrectly #229

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ansi (1.5.0)
ast (2.4.2)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.8)
builder (3.3.0)
Expand All @@ -55,15 +56,12 @@ GEM
launchy (>= 2.1, < 4.0)
mail (~> 2.7)
eventmachine (1.2.7)
faraday (2.12.1)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.17.0)
hashie (5.0.0)
htmlentities (4.3.4)
http-accept (1.7.0)
Expand Down Expand Up @@ -99,8 +97,6 @@ GEM
minitest (>= 2.12, < 5.0)
powerbar
multi_json (1.15.0)
net-http (0.5.0)
uri
net-http-persistent (2.9.4)
net-imap (0.4.18)
date
Expand Down Expand Up @@ -129,7 +125,7 @@ GEM
pry (0.15.0)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (6.0.1)
public_suffix (5.1.1)
racc (1.8.1)
rack (2.2.10)
rack-test (0.8.3)
Expand Down Expand Up @@ -167,6 +163,7 @@ GEM
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (1.3.0)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -186,7 +183,6 @@ GEM
timeout (0.4.2)
tzinfo (0.3.62)
unicode-display_width (2.6.0)
uri (1.0.2)
uuid (2.3.9)
macaddr (~> 1.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ def generate_missing_labels_each(artifacts = {}, logger, paging, page_classes, p
if prefLabel_lang.nil? || no_default_prefLabel
lang_rdfs_labels = c.label(include_languages: true)

lang_rdfs_labels = {none: []} if lang_rdfs_labels.to_a.empty? ||
lang_rdfs_labels.is_a?(Array) ||
(no_default_prefLabel && lang_rdfs_labels.is_a?(Hash) && (lang_rdfs_labels.keys & [portal_lang, :none]).empty?)
if lang_rdfs_labels.to_a.empty? ||
lang_rdfs_labels.is_a?(Array) ||
(no_default_prefLabel && lang_rdfs_labels.is_a?(Hash) && (lang_rdfs_labels.keys & [portal_lang, :none]).empty?)
lang_rdfs_labels = lang_rdfs_labels.is_a?(Hash) ? lang_rdfs_labels : {}
lang_rdfs_labels[:none] = []
end

lang_rdfs_labels.each do |lang, rdfs_labels|
if rdfs_labels && rdfs_labels.length > 1 && c.synonym.length > 0
Expand All @@ -216,12 +219,9 @@ def generate_missing_labels_each(artifacts = {}, logger, paging, page_classes, p
label = LinkedData::Utils::Triples.last_iri_fragment c.id.to_s
end

if lang === :none
lang = nil
prefLabel = label
end
prefLabel = label if !prefLabel && lang === portal_lang
prefLabel = label unless prefLabel
lang = nil if lang === :none
prefLabel = label

artifacts[:label_triples] << LinkedData::Utils::Triples.label_for_class_triple(
c.id, Goo.vocabulary(:metadata_def)[:prefLabel], prefLabel, lang)
end
Expand Down
56 changes: 53 additions & 3 deletions test/data/ontology_files/BRO_v3.2.owl
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,53 @@
<rdfs:label xml:lang="fr">Gestion des échantillons biologiques</rdfs:label>
<core:prefLabel xml:lang="fr">Biospecimen Management</core:prefLabel>
</owl:Class>




<!-- http://bioontology.org/ontologies/Activity.owl#Catalog -->

<owl:Class rdf:about="&activity;Catalog">
<rdfs:subClassOf rdf:resource="&activity;Activity"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/TR/vocab-dcat/"/>
<skos:definition xml:lang="da">En samling af metadata om ressourcer.</skos:definition>
<rdfs:comment xml:lang="it">Una raccolta curata di metadati sulle risorse (ad es. sui dataset e relativi servizi nel contesto di cataloghi di dati).</rdfs:comment>
<rdfs:label xml:lang="es">Catálogo</rdfs:label>
<rdfs:label xml:lang="ar">فهرس قوائم البيانات</rdfs:label>
<skos:scopeNote xml:lang="en">Datasets and data services are examples of resources in the context of a data catalog.</skos:scopeNote>
<rdfs:comment xml:lang="da">En udvalgt og arrangeret samling af metadata om ressourcer (fx datasæt og datatjenester i kontekst af et datakatalog). </rdfs:comment>
<skos:definition xml:lang="en">A curated collection of metadata about resources.</skos:definition>
<skos:definition xml:lang="el">Μια επιμελημένη συλλογή μεταδεδομένων περί συνόλων δεδομένων.</skos:definition>
<skos:editorialNote xml:lang="en">Multilingual text not completelly updated. Translations for skos:scopeNote and definitions to doublecheck.</skos:editorialNote>
<rdfs:label xml:lang="it">Catalogo</rdfs:label>
<rdfs:label xml:lang="cs">Katalog</rdfs:label>
<rdfs:label xml:lang="da">Katalog</rdfs:label>
<skos:definition xml:lang="fr">Une collection élaborée de métadonnées sur les jeux de données.</skos:definition>
<rdfs:comment xml:lang="ja">データ・カタログは、データセットに関するキュレートされたメタデータの集合です。</rdfs:comment>
<rdfs:label xml:lang="el">Κατάλογος</rdfs:label>
<skos:definition xml:lang="ja">データ・カタログは、データセットに関するキュレートされたメタデータの集合です。</skos:definition>
<skos:scopeNote xml:lang="es">Normalmente, un catálogo de datos disponible en la web se representa como una única instancia de esta clase.</skos:scopeNote>
<rdfs:comment xml:lang="es">Una colección curada de metadatos sobre recursos (por ejemplo, conjuntos de datos y servicios de datos en el contexto de un catálogo de datos).</rdfs:comment>
<skos:scopeNote xml:lang="cs">Webový datový katalog je typicky reprezentován jako jedna instance této třídy.</skos:scopeNote>
<skos:scopeNote xml:lang="it">Normalmente, un catalogo di dati nel web viene rappresentato come una singola istanza di questa classe.</skos:scopeNote>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<skos:definition xml:lang="cs">Řízená kolekce metadat o datových sadách a datových službách.</skos:definition>
<skos:definition xml:lang="es">Una colección curada de metadatos sobre recursos.</skos:definition>
<rdfs:comment xml:lang="fr">Une collection élaborée de métadonnées sur les jeux de données</rdfs:comment>
<skos:scopeNote xml:lang="da">Et webbaseret datakatalog repræsenteres typisk ved en enkelt instans af denne klasse.</skos:scopeNote>
<skos:scopeNote xml:lang="en">A web-based data catalog is typically represented as a single instance of this class.</skos:scopeNote>
<rdfs:label xml:lang="ja">カタログ</rdfs:label>
<skos:definition xml:lang="it">Una raccolta curata di metadati sulle risorse.</skos:definition>
<rdfs:label xml:lang="en">Catalog</rdfs:label>
<skos:scopeNote xml:lang="ja">通常、ウェブ・ベースのデータ・カタログは、このクラスの1つのインスタンスとして表わされます。</skos:scopeNote>
<rdfs:label xml:lang="fr">Catalogue</rdfs:label>
<skos:definition xml:lang="ar">مجموعة من توصيفات قوائم البيانات</skos:definition>
<skos:scopeNote xml:lang="el">Συνήθως, ένας κατάλογος δεδομένων στον Παγκόσμιο Ιστό αναπαρίσταται ως ένα στιγμιότυπο αυτής της κλάσης.</skos:scopeNote>
<rdfs:comment xml:lang="el">Μια επιμελημένη συλλογή μεταδεδομένων περί συνόλων δεδομένων</rdfs:comment>
<rdfs:comment xml:lang="en">A curated collection of metadata about resources (e.g., datasets and data services in the context of a data catalog).</rdfs:comment>
<rdfs:comment xml:lang="ar">مجموعة من توصيفات قوائم البيانات</rdfs:comment>
<rdfs:comment xml:lang="cs">Řízená kolekce metadat o datových sadách a datových službách</rdfs:comment>
</owl:Class>



<!-- http://bioontology.org/ontologies/Activity.owl#Community_Engagement -->
Expand Down Expand Up @@ -738,11 +784,13 @@
<!-- http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance -->

<owl:Class rdf:about="&activity;Regulatory_Compliance">
<rdfs:label rdf:datatype="&xsd;string">Regulatory Compliance</rdfs:label>
<rdfs:label rdf:datatype="&xsd;string">Standard Compliance</rdfs:label>
<rdfs:label rdf:datatype="&xsd;string">Statutory Compliance</rdfs:label>
<rdfs:subClassOf rdf:resource="&activity;Activity"/>
<desc:definition rdf:datatype="&xsd;string">As defined in http://en.wikipedia.org/wiki/Regulatory_compliance</desc:definition>
<core:prefLabel rdf:datatype="&xsd;string">Regulatory Compliance</core:prefLabel>
</owl:Class>



<!-- http://bioontology.org/ontologies/Activity.owl#Research_Funding -->
Expand All @@ -761,6 +809,8 @@
<rdfs:subClassOf rdf:resource="&activity;Activity"/>
<desc:definition rdf:datatype="&xsd;string">Management and communications within the laboratory setting (http://www.umuc.edu/programs/undergrad/certificates/lab_mgmt.shtml)</desc:definition>
<core:prefLabel rdf:datatype="&xsd;string">Research Lab Management</core:prefLabel>
<core:prefLabel xml:lang="fr">Gestion du laboratoire de recherche</core:prefLabel>
<core:prefLabel xml:lang="it">Gestione del laboratorio di ricerca</core:prefLabel>
</owl:Class>


Expand Down
46 changes: 46 additions & 0 deletions test/data/ontology_files/BRO_v3.5.owl
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,52 @@



<!-- http://bioontology.org/ontologies/Activity.owl#Catalog -->

<owl:Class rdf:about="&activity;Catalog">
<rdfs:subClassOf rdf:resource="&activity;Activity"/>
<rdfs:isDefinedBy rdf:resource="http://www.w3.org/TR/vocab-dcat/"/>
<skos:definition xml:lang="da">En samling af metadata om ressourcer.</skos:definition>
<rdfs:comment xml:lang="it">Una raccolta curata di metadati sulle risorse (ad es. sui dataset e relativi servizi nel contesto di cataloghi di dati).</rdfs:comment>
<rdfs:label xml:lang="es">Catálogo</rdfs:label>
<rdfs:label xml:lang="ar">فهرس قوائم البيانات</rdfs:label>
<skos:scopeNote xml:lang="en">Datasets and data services are examples of resources in the context of a data catalog.</skos:scopeNote>
<rdfs:comment xml:lang="da">En udvalgt og arrangeret samling af metadata om ressourcer (fx datasæt og datatjenester i kontekst af et datakatalog). </rdfs:comment>
<skos:definition xml:lang="en">A curated collection of metadata about resources.</skos:definition>
<skos:definition xml:lang="el">Μια επιμελημένη συλλογή μεταδεδομένων περί συνόλων δεδομένων.</skos:definition>
<skos:editorialNote xml:lang="en">Multilingual text not completelly updated. Translations for skos:scopeNote and definitions to doublecheck.</skos:editorialNote>
<rdfs:label xml:lang="it">Catalogo</rdfs:label>
<rdfs:label xml:lang="cs">Katalog</rdfs:label>
<rdfs:label xml:lang="da">Katalog</rdfs:label>
<skos:definition xml:lang="fr">Une collection élaborée de métadonnées sur les jeux de données.</skos:definition>
<rdfs:comment xml:lang="ja">データ・カタログは、データセットに関するキュレートされたメタデータの集合です。</rdfs:comment>
<rdfs:label xml:lang="el">Κατάλογος</rdfs:label>
<skos:definition xml:lang="ja">データ・カタログは、データセットに関するキュレートされたメタデータの集合です。</skos:definition>
<skos:scopeNote xml:lang="es">Normalmente, un catálogo de datos disponible en la web se representa como una única instancia de esta clase.</skos:scopeNote>
<rdfs:comment xml:lang="es">Una colección curada de metadatos sobre recursos (por ejemplo, conjuntos de datos y servicios de datos en el contexto de un catálogo de datos).</rdfs:comment>
<skos:scopeNote xml:lang="cs">Webový datový katalog je typicky reprezentován jako jedna instance této třídy.</skos:scopeNote>
<skos:scopeNote xml:lang="it">Normalmente, un catalogo di dati nel web viene rappresentato come una singola istanza di questa classe.</skos:scopeNote>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<skos:definition xml:lang="cs">Řízená kolekce metadat o datových sadách a datových službách.</skos:definition>
<skos:definition xml:lang="es">Una colección curada de metadatos sobre recursos.</skos:definition>
<rdfs:comment xml:lang="fr">Une collection élaborée de métadonnées sur les jeux de données</rdfs:comment>
<skos:scopeNote xml:lang="da">Et webbaseret datakatalog repræsenteres typisk ved en enkelt instans af denne klasse.</skos:scopeNote>
<skos:scopeNote xml:lang="en">A web-based data catalog is typically represented as a single instance of this class.</skos:scopeNote>
<rdfs:label xml:lang="ja">カタログ</rdfs:label>
<skos:definition xml:lang="it">Una raccolta curata di metadati sulle risorse.</skos:definition>
<rdfs:label xml:lang="en">Catalog</rdfs:label>
<skos:scopeNote xml:lang="ja">通常、ウェブ・ベースのデータ・カタログは、このクラスの1つのインスタンスとして表わされます。</skos:scopeNote>
<rdfs:label xml:lang="fr">Catalogue</rdfs:label>
<skos:definition xml:lang="ar">مجموعة من توصيفات قوائم البيانات</skos:definition>
<skos:scopeNote xml:lang="el">Συνήθως, ένας κατάλογος δεδομένων στον Παγκόσμιο Ιστό αναπαρίσταται ως ένα στιγμιότυπο αυτής της κλάσης.</skos:scopeNote>
<rdfs:comment xml:lang="el">Μια επιμελημένη συλλογή μεταδεδομένων περί συνόλων δεδομένων</rdfs:comment>
<rdfs:comment xml:lang="en">A curated collection of metadata about resources (e.g., datasets and data services in the context of a data catalog).</rdfs:comment>
<rdfs:comment xml:lang="ar">مجموعة من توصيفات قوائم البيانات</rdfs:comment>
<rdfs:comment xml:lang="cs">Řízená kolekce metadat o datových sadách a datových službách</rdfs:comment>
</owl:Class>



<!-- http://bioontology.org/ontologies/Activity.owl#Community_Engagement -->

<owl:Class rdf:about="&activity;Community_Engagement">
Expand Down
Loading