From ff70aa1634dd9dbd908b535772ac7c406a60bde5 Mon Sep 17 00:00:00 2001 From: haider Date: Fri, 17 Jan 2025 16:31:24 +0000 Subject: [PATCH] Update ontolog_purl and mailing_list fields --- .../ols/repository/v1/mappers/V1OntologyMapper.java | 6 +++--- .../main/java/uk/ac/ebi/rdf2json/OntologyGraph.java | 11 +++++++++++ frontend/src/model/Ontology.ts | 4 ++-- .../main/java/uk/ac/ebi/ols/shared/DefinedFields.java | 4 +++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/repository/v1/mappers/V1OntologyMapper.java b/backend/src/main/java/uk/ac/ebi/spot/ols/repository/v1/mappers/V1OntologyMapper.java index d74a1e7d7..27dff6d3e 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/repository/v1/mappers/V1OntologyMapper.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/repository/v1/mappers/V1OntologyMapper.java @@ -13,7 +13,7 @@ import java.util.Map; import java.util.Objects; -import static uk.ac.ebi.ols.shared.DefinedFields.LANGUAGE; +import static uk.ac.ebi.ols.shared.DefinedFields.*; public class V1OntologyMapper { @@ -43,12 +43,12 @@ public static V1Ontology mapOntology(JsonElement json, String lang) { ontology.config.description = JsonHelper.getString(localizedJson, "description"); ontology.config.homepage = JsonHelper.getString(localizedJson, "homepage"); ontology.config.version = JsonHelper.getString(localizedJson, "version"); - ontology.config.mailingList = JsonHelper.getString(localizedJson, "mailing_list"); + ontology.config.mailingList = JsonHelper.getString(localizedJson, MAILING_LIST.getText()); ontology.config.tracker = JsonHelper.getString(localizedJson, "tracker"); ontology.config.logo = JsonHelper.getString(localizedJson, "logo"); ontology.config.creators = JsonHelper.getStrings(localizedJson, "creators"); ontology.config.annotations = gson.fromJson(localizedJson.get("annotations"), Map.class); - ontology.config.fileLocation = JsonHelper.getString(localizedJson, "ontology_purl"); + ontology.config.fileLocation = JsonHelper.getString(localizedJson, ONTOLOGY_PURL.getText()); ontology.config.oboSlims = localizedJson.has("oboSlims") && localizedJson.get("oboSlims").getAsBoolean(); ontology.config.labelProperty = JsonHelper.getString(localizedJson, "label_property"); diff --git a/dataload/rdf2json/src/main/java/uk/ac/ebi/rdf2json/OntologyGraph.java b/dataload/rdf2json/src/main/java/uk/ac/ebi/rdf2json/OntologyGraph.java index d8b94d3b6..813ed18cc 100644 --- a/dataload/rdf2json/src/main/java/uk/ac/ebi/rdf2json/OntologyGraph.java +++ b/dataload/rdf2json/src/main/java/uk/ac/ebi/rdf2json/OntologyGraph.java @@ -328,6 +328,17 @@ public void write(JsonWriter writer) throws Throwable { } } + + if(configKey.equalsIgnoreCase("ontology_purl")) { + // Config uses "ontology_purl" whereas rest of code base uses ONTOLOGY_PURL.getText(). + configKey = ONTOLOGY_PURL.getText(); + } + + if(configKey.equalsIgnoreCase("mailing_list")) { + // Config uses "mailing_list" whereas rest of code base uses MAILING_LIST.getText(). + configKey = MAILING_LIST.getText(); + } + // annotated as hasPreferredRoot by PreferredRootsAnnotator, no need to duplicate if (configKey.equals("preferred_root_term")) continue; diff --git a/frontend/src/model/Ontology.ts b/frontend/src/model/Ontology.ts index 4abd87501..6a88bbcea 100644 --- a/frontend/src/model/Ontology.ts +++ b/frontend/src/model/Ontology.ts @@ -37,13 +37,13 @@ export default class Ontology extends Thing { return this.properties["depicted_by"] || undefined; } getOntologyPurl(): string { - return this.properties["ontology_purl"]; + return this.properties["ontologyPurl"]; } getHomepage(): string { return this.properties["homepage"]; } getMailingList(): string { - return this.properties["mailing_list"]; + return this.properties["mailingList"]; } getTracker(): string { return this.properties["tracker"]; diff --git a/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java b/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java index ba20b742e..d46ea373a 100644 --- a/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java +++ b/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java @@ -49,7 +49,9 @@ public enum DefinedFields { " in defining this class. It only considers classes in the filler position, not classes expressions in the filler position." + "I.e. 'liver disease' (EFO:0001421) has a relatedTo relation with 'liver' (UBERON:0002107) because " + "'liver disease' is a subclass of 'has_disease_location some liver'.", "array"), - SYNONYM("synonym", "", "The list of names that are synonyms of this entity.", "array"),; + SYNONYM("synonym", "", "The list of names that are synonyms of this entity.", "array"), + MAILING_LIST("mailingList", "", "The mailing list for the ontology.", "string"), + ONTOLOGY_PURL("ontologyPurl", "", "The URL of the ontology to download the ontology file.", "string"); private final String text; private final String ols3Text;