From 73db9ffd9b1092390e90f3f80659373a460cecea Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Mon, 2 Dec 2024 22:27:55 +1100 Subject: [PATCH 1/8] auto detect latest ARDC versions --- ardcvocabs/pom.xml | 5 ++ .../configuration/VocabApiPaths.java | 37 -------- .../aodn/ardcvocabs/model/ArdcRootPaths.java | 28 ++++++ .../aodn/ardcvocabs/model/VocabApiPaths.java | 43 +++++---- .../service/ArdcVocabServiceImpl.java | 89 +++++++++++++++++-- 5 files changed, 137 insertions(+), 65 deletions(-) delete mode 100644 ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/configuration/VocabApiPaths.java create mode 100644 ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java diff --git a/ardcvocabs/pom.xml b/ardcvocabs/pom.xml index 01d40f92..51df694a 100644 --- a/ardcvocabs/pom.xml +++ b/ardcvocabs/pom.xml @@ -60,6 +60,11 @@ org.springframework.retry spring-retry + + org.jsoup + jsoup + 1.18.1 + diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/configuration/VocabApiPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/configuration/VocabApiPaths.java deleted file mode 100644 index b078cc92..00000000 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/configuration/VocabApiPaths.java +++ /dev/null @@ -1,37 +0,0 @@ -package au.org.aodn.ardcvocabs.configuration; - -import lombok.Getter; - -@Getter -public enum VocabApiPaths { - PARAMETER_VOCAB( - "/aodn-parameter-category-vocabulary/version-2-1/concept.json", - "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", - "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", - "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" - ), - PLATFORM_VOCAB( - "/aodn-platform-category-vocabulary/version-1-2/concept.json", - "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", - "/aodn-platform-vocabulary/version-6-1/concept.json", - "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" - ), - ORGANISATION_VOCAB( - "/aodn-organisation-category-vocabulary/version-2-5/concept", - "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", - "/aodn-organisation-vocabulary/version-2-5/concept", - "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" - ); - - private final String vocabCategoryApiPath; - private final String vocabCategoryDetailsApiPath; - private final String vocabApiPath; - private final String vocabDetailsApiPath; - - VocabApiPaths(String vocabCategoryApiPath, String vocabCategoryDetailsApiPath, String vocabApiPath, String vocabDetailsApiPath) { - this.vocabCategoryApiPath = vocabCategoryApiPath; - this.vocabCategoryDetailsApiPath = vocabCategoryDetailsApiPath; - this.vocabApiPath = vocabApiPath; - this.vocabDetailsApiPath = vocabDetailsApiPath; - } -} diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java new file mode 100644 index 00000000..ab7e8e19 --- /dev/null +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java @@ -0,0 +1,28 @@ +package au.org.aodn.ardcvocabs.model; + +import lombok.Getter; + +@Getter +public enum ArdcRootPaths { + PARAMETER_VOCAB( + "/viewById/24", + "/viewById/22" + ), + PLATFORM_VOCAB( + "/viewById/26", + "/viewById/25" + ), + ORGANISATION_VOCAB( + "/viewById/29", + "/viewById/28" + ); + + + private final String categoryRoot; + private final String vocabRoot; + + ArdcRootPaths(String categoryRoot, String vocabRoot) { + this.categoryRoot = categoryRoot; + this.vocabRoot = vocabRoot; + } +} diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java index ab5f7b7b..038052a5 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java @@ -1,37 +1,36 @@ package au.org.aodn.ardcvocabs.model; - import lombok.Getter; @Getter public enum VocabApiPaths { PARAMETER_VOCAB( - "/aodn-parameter-category-vocabulary/version-2-1/concept.json", - "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", - "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", - "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" + "/aodn-parameter-category-vocabulary/%s/concept.json", + "/aodn-parameter-category-vocabulary/%s/resource.json?uri=%s", + "/aodn-discovery-parameter-vocabulary/%s/concept.json", + "/aodn-discovery-parameter-vocabulary/%s/resource.json?uri=%s" ), PLATFORM_VOCAB( - "/aodn-platform-category-vocabulary/version-1-2/concept.json", - "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", - "/aodn-platform-vocabulary/version-6-1/concept.json", - "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" + "/aodn-platform-category-vocabulary/%s/concept.json", + "/aodn-platform-category-vocabulary/%s/resource.json?uri=%s", + "/aodn-platform-vocabulary/%s/concept.json", + "/aodn-platform-vocabulary/%s/resource.json?uri=%s" ), ORGANISATION_VOCAB( - "/aodn-organisation-category-vocabulary/version-2-5/concept.json", - "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", - "/aodn-organisation-vocabulary/version-2-5/concept.json", - "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" + "/aodn-organisation-category-vocabulary/%s/concept", + "/aodn-organisation-category-vocabulary/%s/resource.json?uri=%s", + "/aodn-organisation-vocabulary/%s/concept", + "/aodn-organisation-vocabulary/%s/resource.json?uri=%s" ); - private final String vocabCategoryApiPath; - private final String vocabCategoryDetailsApiPath; - private final String vocabApiPath; - private final String vocabDetailsApiPath; + private final String categoryApiTemplate; + private final String categoryDetailsTemplate; + private final String vocabApiTemplate; + private final String vocabDetailsTemplate; - VocabApiPaths(String vocabCategoryApiPath, String vocabCategoryDetailsApiPath, String vocabApiPath, String vocabDetailsApiPath) { - this.vocabCategoryApiPath = vocabCategoryApiPath; - this.vocabCategoryDetailsApiPath = vocabCategoryDetailsApiPath; - this.vocabApiPath = vocabApiPath; - this.vocabDetailsApiPath = vocabDetailsApiPath; + VocabApiPaths(String categoryApiTemplate, String categoryDetailsTemplate, String vocabApiTemplate, String vocabDetailsTemplate) { + this.categoryApiTemplate = categoryApiTemplate; + this.categoryDetailsTemplate = categoryDetailsTemplate; + this.vocabApiTemplate = vocabApiTemplate; + this.vocabDetailsTemplate = vocabDetailsTemplate; } } diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index a736a6e0..4361ee4e 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -1,10 +1,15 @@ package au.org.aodn.ardcvocabs.service; +import au.org.aodn.ardcvocabs.model.ArdcRootPaths; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabModel; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; +import jakarta.annotation.PostConstruct; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -22,7 +27,7 @@ public class ArdcVocabServiceImpl implements ArdcVocabService { - protected Logger log = LoggerFactory.getLogger(ArdcVocabServiceImpl.class); + protected static Logger log = LoggerFactory.getLogger(ArdcVocabServiceImpl.class); @Value("${ardcvocabs.baseUrl:https://vocabs.ardc.edu.au/repository/api/lda/aodn}") protected String vocabApiBase; @@ -30,6 +35,78 @@ public class ArdcVocabServiceImpl implements ArdcVocabService { protected RestTemplate restTemplate; protected RetryTemplate retryTemplate; + protected static final String VERSION_REGEX = "^version-\\d+-\\d+$"; + Map> resolvedPathCollection = new HashMap<>(); + protected enum PathName { + categoryApi, + categoryDetailsApi, + vocabApi, + vocabDetailsApi + } + + @PostConstruct + public void initialiseVersions() { + for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { + String categoryVersion = fetchVersion(rootPath.getCategoryRoot()); + String vocabVersion = fetchVersion(rootPath.getVocabRoot()); + + if (categoryVersion != null && vocabVersion != null) { + log.info("Fetched ARDC category version for {}: {}", rootPath.name(), categoryVersion); + log.info("Fetched ARDC vocab version for {}: {}", rootPath.name(), vocabVersion); + Map resolvedPaths = new HashMap<>(); + for (VocabApiPaths vocabApiPath : VocabApiPaths.values()) { + if (rootPath.name().equals(vocabApiPath.name())) { + resolvedPaths.put(PathName.categoryApi, String.format(vocabApiPath.getCategoryApiTemplate(), categoryVersion)); + resolvedPaths.put(PathName.categoryDetailsApi, String.format(vocabApiPath.getCategoryDetailsTemplate(), categoryVersion, "%s")); + resolvedPaths.put(PathName.vocabApi, String.format(vocabApiPath.getVocabApiTemplate(), vocabVersion)); + resolvedPaths.put(PathName.vocabDetailsApi, String.format(vocabApiPath.getVocabDetailsTemplate(), vocabVersion, "%s")); + } + } + resolvedPathCollection.put(rootPath.name(), resolvedPaths); + } else { + log.error("Failed to fetch ARDC version for {}", rootPath.name()); + } + } + } + + protected static String fetchVersion(String url) { + String fullUrl = "https://vocabs.ardc.edu.au" + url; + try { + RestTemplate restTemplate = new RestTemplate(); + String htmlContent = restTemplate.getForObject(fullUrl, String.class); + + if (htmlContent != null && !htmlContent.isEmpty()) { + // Parse HTML content with Jsoup + Document doc = Jsoup.parse(htmlContent); + + // Extract the first h4 element + Element firstH4 = doc.selectFirst("div.col-md-4.panel-body:has(.box-tag.box-tag-green) h4:first-of-type"); + + if (firstH4 != null) { + String version = firstH4.text() + .toLowerCase() + .replaceAll("[ .]", "-"); + // Validate the version format + if (version.matches(VERSION_REGEX)) { + log.info("Valid Version Found: {}", version); + return version; + } else { + log.warn("Version does not match the required format: {}", version); + } + } else { + log.warn("No matching h4 element found in the document."); + } + } else { + log.warn("HTML content is empty or null."); + } + } catch (Exception e) { + log.error("Error fetching version from {}: {}", fullUrl, e.getMessage()); + } + + return null; + } + + protected Function extractSingleText(String key) { return (node) -> { JsonNode labelNode = node.get(key); @@ -92,8 +169,8 @@ public ArdcVocabServiceImpl(RestTemplate restTemplate, RetryTemplate retryTempla protected VocabModel buildVocabByResourceUri(String vocabUri, String vocabApiBase, VocabApiPaths vocabApiPaths) { String resourceDetailsApi = vocabUri.contains("_classes") - ? vocabApiPaths.getVocabCategoryDetailsApiPath() - : vocabApiPaths.getVocabDetailsApiPath(); + ? resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.categoryDetailsApi) + : resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabDetailsApi); String detailsUrl = String.format(vocabApiBase + resourceDetailsApi, vocabUri); @@ -166,7 +243,7 @@ protected VocabModel buildVocabModel(T currentNode, String vocabApiBase, Voc protected Map> getVocabLeafNodes(String vocabApiBase, VocabApiPaths vocabApiPaths) { Map> results = new HashMap<>(); - String url = String.format(vocabApiBase + vocabApiPaths.getVocabApiPath()); + String url = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabApi)); while (url != null && !url.isEmpty()) { try { @@ -180,7 +257,7 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V if (isNodeValid.apply(node, "items")) { for (JsonNode j : node.get("items")) { // Now we need to construct link to detail resources - String dl = String.format(vocabApiBase + vocabApiPaths.getVocabDetailsApiPath(), about.apply(j)); + String dl = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabDetailsApi), about.apply(j)); try { log.debug("getVocabLeafNodes -> {}", dl); ObjectNode d = retryTemplate.execute(context -> restTemplate.getForObject(dl, ObjectNode.class)); @@ -271,7 +348,7 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V @Override public List getVocabTreeFromArdcByType(VocabApiPaths vocabApiPaths) { Map> vocabLeafNodes = getVocabLeafNodes(vocabApiBase, vocabApiPaths); - String url = String.format(vocabApiBase + vocabApiPaths.getVocabCategoryApiPath()); + String url = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.categoryApi)); List vocabCategoryNodes = new ArrayList<>(); while (url != null && !url.isEmpty()) { try { From 0cee6c60e73d31d00656060693a1104ef357cc73 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Tue, 3 Dec 2024 00:47:18 +1100 Subject: [PATCH 2/8] Update tests --- .../aodn/ardcvocabs/model/VocabApiPaths.java | 4 +-- .../service/ArdcVocabServiceImplTest.java | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java index 038052a5..5ffa4793 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/VocabApiPaths.java @@ -16,9 +16,9 @@ public enum VocabApiPaths { "/aodn-platform-vocabulary/%s/resource.json?uri=%s" ), ORGANISATION_VOCAB( - "/aodn-organisation-category-vocabulary/%s/concept", + "/aodn-organisation-category-vocabulary/%s/concept.json", "/aodn-organisation-category-vocabulary/%s/resource.json?uri=%s", - "/aodn-organisation-vocabulary/%s/concept", + "/aodn-organisation-vocabulary/%s/concept.json", "/aodn-organisation-vocabulary/%s/resource.json?uri=%s" ); diff --git a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java index 0feed35f..4ee47768 100644 --- a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java +++ b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java @@ -24,7 +24,9 @@ import java.io.FileNotFoundException; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -199,6 +201,31 @@ public void init() { //this.ardcVocabService = new ArdcVocabServiceImpl(new RestTemplate()); this.ardcVocabService = new ArdcVocabServiceImpl(mockRestTemplate, new RetryTemplate()); this.ardcVocabService.vocabApiBase = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; + + Map> resolvedPathCollection = new HashMap<>(); + + resolvedPathCollection.put(VocabApiPaths.PARAMETER_VOCAB.name(), Map.of( + ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", + ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-parameter-category-vocabulary/version-2-1/concept.json", + ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", + ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" + )); + + resolvedPathCollection.put(VocabApiPaths.PLATFORM_VOCAB.name(), Map.of( + ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-platform-vocabulary/version-6-1/concept.json", + ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-platform-category-vocabulary/version-1-2/concept.json", + ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", + ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" + )); + + resolvedPathCollection.put(VocabApiPaths.ORGANISATION_VOCAB.name(), Map.of( + ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-organisation-vocabulary/version-2-5/concept.json", + ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-organisation-category-vocabulary/version-2-5/concept.json", + ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", + ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" + )); + + this.ardcVocabService.resolvedPathCollection = resolvedPathCollection; } @AfterEach void clear() { From cbcf9c129876e66f2542b11962bd2d93fcf31780 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Tue, 3 Dec 2024 10:46:47 +1100 Subject: [PATCH 3/8] Add tests --- .../service/ArdcVocabServiceImpl.java | 113 +- .../service/ArdcVocabServiceImplTest.java | 35 +- .../resources/databag/ardc/viewById22.html | 1616 ++++++ .../resources/databag/ardc/viewById24.html | 1616 ++++++ .../resources/databag/ardc/viewById25.html | 4446 +++++++++++++++++ .../resources/databag/ardc/viewById26.html | 1189 +++++ .../resources/databag/ardc/viewById28.html | 2109 ++++++++ .../resources/databag/ardc/viewById29.html | 2153 ++++++++ 8 files changed, 13227 insertions(+), 50 deletions(-) create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById22.html create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById24.html create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById25.html create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById26.html create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById28.html create mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById29.html diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index 4361ee4e..c1f635a8 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -46,67 +46,90 @@ protected enum PathName { @PostConstruct public void initialiseVersions() { + String rootHostname = "https://vocabs.ardc.edu.au"; for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { - String categoryVersion = fetchVersion(rootPath.getCategoryRoot()); - String vocabVersion = fetchVersion(rootPath.getVocabRoot()); - - if (categoryVersion != null && vocabVersion != null) { - log.info("Fetched ARDC category version for {}: {}", rootPath.name(), categoryVersion); - log.info("Fetched ARDC vocab version for {}: {}", rootPath.name(), vocabVersion); - Map resolvedPaths = new HashMap<>(); - for (VocabApiPaths vocabApiPath : VocabApiPaths.values()) { - if (rootPath.name().equals(vocabApiPath.name())) { - resolvedPaths.put(PathName.categoryApi, String.format(vocabApiPath.getCategoryApiTemplate(), categoryVersion)); - resolvedPaths.put(PathName.categoryDetailsApi, String.format(vocabApiPath.getCategoryDetailsTemplate(), categoryVersion, "%s")); - resolvedPaths.put(PathName.vocabApi, String.format(vocabApiPath.getVocabApiTemplate(), vocabVersion)); - resolvedPaths.put(PathName.vocabDetailsApi, String.format(vocabApiPath.getVocabDetailsTemplate(), vocabVersion, "%s")); + try { + // Fetch HTML contents for category and vocab + String categoryRootHtmlContent = fetchHtmlContent(rootHostname + rootPath.getCategoryRoot()); + String vocabRootHtmlContent = fetchHtmlContent(rootHostname + rootPath.getVocabRoot()); + + if (categoryRootHtmlContent != null && vocabRootHtmlContent != null) { + // Extract versions + String categoryVersion = extractVersionFromHtmlContent(categoryRootHtmlContent); + String vocabVersion = extractVersionFromHtmlContent(vocabRootHtmlContent); + + if (categoryVersion != null && vocabVersion != null) { + log.info("Fetched ARDC category version for {}: {}", rootPath.name(), categoryVersion); + log.info("Fetched ARDC vocab version for {}: {}", rootPath.name(), vocabVersion); + + // Build and store resolved paths + Map resolvedPaths = buildResolvedPaths(rootPath, categoryVersion, vocabVersion); + resolvedPathCollection.put(rootPath.name(), resolvedPaths); + } else { + log.error("Failed to extract versions for {}", rootPath.name()); } + } else { + log.error("Failed to fetch HTML content for {}", rootPath.name()); } - resolvedPathCollection.put(rootPath.name(), resolvedPaths); - } else { - log.error("Failed to fetch ARDC version for {}", rootPath.name()); + } catch (Exception e) { + log.error("Error initialising versions for {}: {}", rootPath.name(), e.getMessage(), e); } } } - protected static String fetchVersion(String url) { - String fullUrl = "https://vocabs.ardc.edu.au" + url; + private String fetchHtmlContent(String url) { try { - RestTemplate restTemplate = new RestTemplate(); - String htmlContent = restTemplate.getForObject(fullUrl, String.class); - - if (htmlContent != null && !htmlContent.isEmpty()) { - // Parse HTML content with Jsoup - Document doc = Jsoup.parse(htmlContent); - - // Extract the first h4 element - Element firstH4 = doc.selectFirst("div.col-md-4.panel-body:has(.box-tag.box-tag-green) h4:first-of-type"); - - if (firstH4 != null) { - String version = firstH4.text() - .toLowerCase() - .replaceAll("[ .]", "-"); - // Validate the version format - if (version.matches(VERSION_REGEX)) { - log.info("Valid Version Found: {}", version); - return version; - } else { - log.warn("Version does not match the required format: {}", version); - } + return restTemplate.getForObject(url, String.class); + } catch (RestClientException e) { + log.error("Failed to fetch HTML content from URL {}: {}", url, e.getMessage()); + } catch (Exception e) { + log.error("Unexpected error while fetching HTML content from URL {}: {}", url, e.getMessage(), e); + } + return null; + } + + protected Map buildResolvedPaths(ArdcRootPaths rootPath, String categoryVersion, String vocabVersion) { + Map resolvedPaths = new HashMap<>(); + for (VocabApiPaths vocabApiPath : VocabApiPaths.values()) { + if (rootPath.name().equals(vocabApiPath.name())) { + resolvedPaths.put(PathName.categoryApi, String.format(vocabApiPath.getCategoryApiTemplate(), categoryVersion)); + resolvedPaths.put(PathName.categoryDetailsApi, String.format(vocabApiPath.getCategoryDetailsTemplate(), categoryVersion, "%s")); + resolvedPaths.put(PathName.vocabApi, String.format(vocabApiPath.getVocabApiTemplate(), vocabVersion)); + resolvedPaths.put(PathName.vocabDetailsApi, String.format(vocabApiPath.getVocabDetailsTemplate(), vocabVersion, "%s")); + } + } + return resolvedPaths; + } + + protected static String extractVersionFromHtmlContent(String htmlContent) { + if (htmlContent != null && !htmlContent.isEmpty()) { + // Parse HTML content with Jsoup + Document doc = Jsoup.parse(htmlContent); + + // Extract the first h4 element + // has(.box-tag.box-tag-green) query will ensure to select only the div element that has "Current" indicator + Element firstH4 = doc.selectFirst("div.col-md-4.panel-body:has(.box-tag.box-tag-green) h4:first-of-type"); + + if (firstH4 != null) { + String version = firstH4.text() + .toLowerCase() + .replaceAll("[ .]", "-"); + // Validate the version format + if (version.matches(VERSION_REGEX)) { + log.info("Valid Version Found: {}", version); + return version; } else { - log.warn("No matching h4 element found in the document."); + log.warn("Version does not match the required format: {}", version); } } else { - log.warn("HTML content is empty or null."); + log.warn("No matching h4 element found in the document."); } - } catch (Exception e) { - log.error("Error fetching version from {}: {}", fullUrl, e.getMessage()); + } else { + log.warn("HTML content is empty or null."); } - return null; } - protected Function extractSingleText(String key) { return (node) -> { JsonNode labelNode = node.get(key); diff --git a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java index 4ee47768..ce2b791a 100644 --- a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java +++ b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java @@ -14,11 +14,8 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.stubbing.Answer; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; -import org.springframework.retry.RetryCallback; -import org.springframework.retry.RetryContext; import org.springframework.retry.support.RetryTemplate; import org.springframework.web.client.RestTemplate; @@ -32,8 +29,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import static org.springframework.test.util.AssertionErrors.assertTrue; @ExtendWith(MockitoExtension.class) @@ -232,6 +227,36 @@ public void init() { Mockito.reset(mockRestTemplate); } + @Test + void testFetchVersionWithCannedHtml() throws Exception { + String mockHtmlContent; + String version; + + mockHtmlContent = readResourceFile("/databag/ardc/viewById22.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-1-6", version, "Expected parsed version for viewById22.html is 'version-1-6'"); + + mockHtmlContent = readResourceFile("/databag/ardc/viewById24.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-2-1", version, "Expected parsed version for viewById24.html is 'version-2-1'"); + + mockHtmlContent = readResourceFile("/databag/ardc/viewById25.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-6-1", version, "Expected parsed version for viewById25.html is 'version-6-1'"); + + mockHtmlContent = readResourceFile("/databag/ardc/viewById26.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-1-2", version, "Expected parsed version for viewById26.html is 'version-1-2'"); + + mockHtmlContent = readResourceFile("/databag/ardc/viewById28.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-2-5", version, "Expected parsed version for viewById28.html is 'version-2-5'"); + + mockHtmlContent = readResourceFile("/databag/ardc/viewById29.html"); + version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); + assertEquals("version-2-5", version, "Expected parsed version for viewById29.html is 'version-2-5'"); + } + @Test public void verifyParameterVocab() throws IOException, JSONException { diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById22.html b/ardcvocabs/src/test/resources/databag/ardc/viewById22.html new file mode 100644 index 00000000..537cd0bb --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById22.html @@ -0,0 +1,1616 @@ + + + + + + + + + + + AODN Discovery Parameter Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Discovery Parameter Vocabulary

+ Acronym: AODN Discovery Parameters
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 1.6

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-6 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 10 Aug 2023 view notes
+ +
+
+ + + + +
+
+

  Version 1.5

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-5 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 21 Oct 2022 view notes
+ + +
+
+ +
+
+

  Version 1.4

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-4 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 12 Dec 2018 view notes
+ + +
+
+ +
+
+

  Version 1.3

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-3 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 23 Feb 2018 view notes
+ + +
+
+ +
+
+

  Version 1.2

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 11 Aug 2016 view notes
+ + +
+
+ +
+
+

  Version 1.1

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 04 Nov 2015 view notes
+ + +
+
+ + + +
+ + +
+ +
An AODN controlled vocabulary describing discovery parameters. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Discovery Parameter Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-discovery-parameter-vocabulary" name="aodn-discovery-parameter-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-discovery-parameter-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-discovery-parameter-vocabulary/version-1-6',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has contributor + eMII_Finney.Kim_Admin +

+ +

+ + + Has author + Sebastien Mancini +

+ +

+ + + Has contributor + eMII_Mancini.Sebastien +

+
+
+ + +
+
Used by
+
+ +
+ Used by IMOS. + +
+
+
+ +
+
Examples of use
+
+ +
+

IMOS use this vocabulary to provide standardised entry of discovery parameter information in metadata, and these terms are utilised in the parameter facet of the AODN Portal.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById24.html b/ardcvocabs/src/test/resources/databag/ardc/viewById24.html new file mode 100644 index 00000000..9c0d190a --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById24.html @@ -0,0 +1,1616 @@ + + + + + + + + + + + AODN Parameter Category Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Parameter Category Vocabulary

+ Acronym: AODN Parameter Categories
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 2.1

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-2-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 10 Aug 2023 view notes
+ +
+
+ + + + +
+
+

  Version 2.0

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-2-0 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 21 Oct 2022 view notes
+ + +
+
+ +
+
+

  Version 1.4

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-4 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 11 Dec 2018 view notes
+ + +
+
+ +
+
+

  Version 1.3

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-3 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 27 Feb 2018 view notes
+ + +
+
+ +
+
+

  Version 1.2

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 23 Feb 2018 view notes
+ + +
+
+ +
+
+

  Version 1.1

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 11 Aug 2016 view notes
+ + +
+
+ + + +
+ + +
+ +
A classification scheme to support faceted searching across parameter types in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Parameter Category Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-parameter-category-vocabulary" name="aodn-parameter-category-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-parameter-category-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-parameter-category-vocabulary/version-2-1',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has contributor + eMII_Finney.Kim_Admin +

+ +

+ + + Has author + Sebastien Mancini +

+ +

+ + + Has contributor + eMII_Mancini.Sebastien +

+
+
+ + +
+
Used by
+
+ +
+ Used by IMOS. + +
+
+
+ +
+
Examples of use
+
+ +
+

IMOS use this vocabulary to provide high level classification of parameters in the AODN Portal.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById25.html b/ardcvocabs/src/test/resources/databag/ardc/viewById25.html new file mode 100644 index 00000000..48cadb5d --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById25.html @@ -0,0 +1,4446 @@ + + + + + + + + + + + AODN Platform Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Platform Vocabulary

+ Acronym: AODN Platforms
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 6.1

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-6-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 24 Jul 2024 view notes
+ +
+
+ + + + +
+
+

  Version 6.0

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-6-0 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 15 Mar 2024 view notes
+ + +
+
+ +
+
+

  Version 5.5

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-5 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 17 Oct 2023 view notes
+ + +
+
+ +
+
+

  Version 5.4

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-4 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 28 Aug 2023 view notes
+ + +
+
+ +
+
+

  Version 5.3

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-3 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 05 Jul 2023 view notes
+ + +
+
+ +
+
+

  Version 5.2

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 30 Mar 2023 view notes
+ + +
+
+ + + +
+ + +
+ +
An AODN controlled vocabulary describing platforms. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Platform Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-platform-vocabulary" name="aodn-platform-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-platform-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/version-6-1',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has contributor + eMII_Finney.Kim_Admin +

+ +

+ + + Has contributor + Natalia_Atkins +

+ +

+ + + Has author + Sebastien Mancini +

+ +

+ + + Has contributor + eMII_Atkins.Natalia +

+ +

+ + + Has contributor + Kim_Finney +

+
+
+ + +
+
Used by
+
+ +
+ Used by IMOS. + +
+
+
+ +
+
Examples of use
+
+ +
+

IMOS use this vocabulary to provide standardised entry of instrument information in metadata, and these terms are utilised in the platform facet of the AODN Portal. The vocabulary also provides a check for data ingestion in several IMOS Sub-facilities.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById26.html b/ardcvocabs/src/test/resources/databag/ardc/viewById26.html new file mode 100644 index 00000000..19dd4c78 --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById26.html @@ -0,0 +1,1189 @@ + + + + + + + + + + + AODN Platform Category Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Platform Category Vocabulary

+ Acronym: AODN Platform Categories
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 1.2

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 02 Jan 2020 view notes
+ +
+
+ + + + +
+
+

  Version 1.1

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 03 Jul 2017 view notes
+ + +
+
+ +
+
+

  Version 1.0

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-0 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 23 Sep 2015
+ + +
+
+ +
+ + +
+ +
A classification scheme to support faceted searching across platform types in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Platform Category Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-platform-category-vocabulary" name="aodn-platform-category-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-platform-category-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-category-vocabulary/version-1-2',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has contributor + eMII_Finney.Kim_Admin +

+ +

+ + + Has contributor + Natalia_Atkins +

+ +

+ + + Has author + Sebastien Mancini +

+ +

+ + + Has contributor + eMII_Atkins.Natalia +

+
+
+ + + + +
+
Examples of use
+
+ +
+

Department of Climate Change, Energy, the Environment and Water use this vocabulary to describe research outputs for reporting, search and discovery.

+

IMOS use this vocabulary to provide high level classification of platforms in the AODN Portal.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById28.html b/ardcvocabs/src/test/resources/databag/ardc/viewById28.html new file mode 100644 index 00000000..1ddc76d1 --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById28.html @@ -0,0 +1,2109 @@ + + + + + + + + + + + AODN Organisation Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Organisation Vocabulary

+ Acronym: AODN Organisations
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 2.5

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-5 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 10 Nov 2023 view notes
+ +
+
+ + + + +
+
+

  Version 2.4

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-4 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 18 Jan 2023 view notes
+ + +
+
+ +
+
+

  Version 2.3

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-3 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 13 Aug 2021 view notes
+ + +
+
+ +
+
+

  Version 2.2

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 16 Sep 2020 view notes
+ + +
+
+ +
+
+

  Version 2.1

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 07 Jan 2020 view notes
+ + +
+
+ +
+
+

  Version 2.0

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-0 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 27 Nov 2018 view notes
+ + +
+
+ + + +
+ + +
+ +
An AODN controlled vocabulary describing organisational entities. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Organisation Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-organisation-vocabulary" name="aodn-organisation-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-organisation-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-organisation-vocabulary/version-2-5',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has contributor + eMII_Finney.Kim +

+ +

+ + + Has author + Natalia Atkins +

+ +

+ + + Has contributor + Natalia_Atkins +

+ +

+ + + Has contributor + eMII_Atkins.Natalia +

+
+
+ + +
+
Used by
+
+ +
+ Used by IMOS. + +
+
+
+ +
+
Examples of use
+
+ +
+

IMOS use this vocabulary to provide consistent entry of organisation details in metadata, and to support faceted searching in the AODN Portal.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById29.html b/ardcvocabs/src/test/resources/databag/ardc/viewById29.html new file mode 100644 index 00000000..7369e55c --- /dev/null +++ b/ardcvocabs/src/test/resources/databag/ardc/viewById29.html @@ -0,0 +1,2153 @@ + + + + + + + + + + + AODN Organisation Category Vocabulary - Research Vocabularies Australia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+ +
+
+
+ + + + + + Using search + + + Browse all vocabularies + + + | + + + concepts + +
+
+
+
+
+
+ + Help +
+
+
+
+
+
+ +
+
+ +

AODN Organisation Category Vocabulary

+ Acronym: AODN Organisation Categories
+ Publisher Australian Ocean Data Network (AODN) +
+ Created: 23 Sep 2015 + 𝕏 +
+
+
+
+
+
+ +
+
+ +
+ + +
+
+

+ + Version 2.5

+ current +
+
+
+ + Download + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-5 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 10 Nov 2023 view notes
+ +
+
+ + + + +
+
+

  Version 2.4

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-4 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 18 Jan 2023 view notes
+ + +
+
+ +
+
+

  Version 2.3

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-3 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 13 Aug 2021 view notes
+ + +
+
+ +
+
+

  Version 2.2

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-2 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 16 Sep 2020 view notes
+ + +
+
+ +
+
+

  Version 2.1

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-1 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 07 Jan 2020 view notes
+ + +
+
+ +
+
+

  Version 2.0

+ superseded +
+
+
+ Download + + + + + +
+ +
+ SPARQL Endpoint: +

+ https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-0 +
+ + Open SPARQL Endpoint in YASGUI + +
+ Learn More +

+
+
+
+ released: 27 Nov 2018 view notes
+ + +
+
+ + + +
+ + +
+ +
An AODN controlled vocabulary describing organisation categories for classifying organisational entities, to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
+
Revision Cycle
+

Periodic

+
Languages
+

+ English +

+
Licence
+

+ CC-BY
+

+
+
+
+
+ + +
+
+
+

+ + Using browse + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +   + + + + + + + + + + + +
+ + Concept + + + + +
+
+
+ +
+
+
+
+
+
+
Use this code snippet to describe or + discover resources with + AODN Organisation Category Vocabulary in your system +

Example: Search for and select concepts + in this vocabulary + + +
+ +
+
+
+<input type="text" id="aodn-organisation-category-vocabulary" name="aodn-organisation-category-vocabulary" value="" size="80" autocomplete="off">
+<script>
+    $("#aodn-organisation-category-vocabulary").vocab_widget({
+        mode: 'search',
+        cache: false,
+        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-organisation-category-vocabulary/version-2-5',
+        target_field: 'label',
+        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
+    });
+</script>
+                        
+
+
+ + + + +
+
+
+ +
+
+
Related
+
+ +
Related people and organisations
+ +

+ + + Has author + Natalia Atkins +

+ +

+ + + Has contributor + Sebastien Mancini +

+
+
+ + +
+
Used by
+
+ +
+ Used by IMOS. + +
+
+
+ +
+
Examples of use
+
+ +
+

IMOS use this vocabulary to provide high level classification of organisations in the AODN Portal.

+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
+ +
+ + + From ea2f21480c757ea11b90e28dd938b392040472c3 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Tue, 3 Dec 2024 10:50:57 +1100 Subject: [PATCH 4/8] refactor --- .../java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java | 5 +++-- .../au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java index ab7e8e19..f9812a08 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java @@ -22,7 +22,8 @@ public enum ArdcRootPaths { private final String vocabRoot; ArdcRootPaths(String categoryRoot, String vocabRoot) { - this.categoryRoot = categoryRoot; - this.vocabRoot = vocabRoot; + String rootHostname = "https://vocabs.ardc.edu.au"; + this.categoryRoot = rootHostname + categoryRoot; + this.vocabRoot = rootHostname + vocabRoot; } } diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index c1f635a8..98e7e996 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -46,12 +46,11 @@ protected enum PathName { @PostConstruct public void initialiseVersions() { - String rootHostname = "https://vocabs.ardc.edu.au"; for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { try { // Fetch HTML contents for category and vocab - String categoryRootHtmlContent = fetchHtmlContent(rootHostname + rootPath.getCategoryRoot()); - String vocabRootHtmlContent = fetchHtmlContent(rootHostname + rootPath.getVocabRoot()); + String categoryRootHtmlContent = fetchHtmlContent(rootPath.getCategoryRoot()); + String vocabRootHtmlContent = fetchHtmlContent(rootPath.getVocabRoot()); if (categoryRootHtmlContent != null && vocabRootHtmlContent != null) { // Extract versions From eabab6d085eeb55580ba15d93aab9b9061e22f83 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Tue, 3 Dec 2024 12:20:12 +1100 Subject: [PATCH 5/8] Refactor and update tests --- .../org/aodn/ardcvocabs/model/PathName.java | 8 ++++ .../ardcvocabs/service/ArdcVocabService.java | 5 ++- .../service/ArdcVocabServiceImpl.java | 40 +++++++++---------- .../service/ArdcVocabServiceImplTest.java | 33 +++++++-------- .../controller/IndexerExtController.java | 8 ++-- .../aodn/esindexer/service/VocabService.java | 6 ++- .../esindexer/service/VocabServiceImpl.java | 21 +++++----- .../esindexer/utils/VocabsIndexUtils.java | 12 +++++- .../au/org/aodn/esindexer/BaseTestClass.java | 29 +++++++++++++- .../esindexer/service/VocabServiceIT.java | 6 +-- 10 files changed, 107 insertions(+), 61 deletions(-) create mode 100644 ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/PathName.java diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/PathName.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/PathName.java new file mode 100644 index 00000000..9f3a673d --- /dev/null +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/PathName.java @@ -0,0 +1,8 @@ +package au.org.aodn.ardcvocabs.model; + +public enum PathName { + categoryApi, + categoryDetailsApi, + vocabApi, + vocabDetailsApi +} diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabService.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabService.java index aea64f32..ddea556f 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabService.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabService.java @@ -1,10 +1,13 @@ package au.org.aodn.ardcvocabs.service; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabModel; import java.util.List; +import java.util.Map; public interface ArdcVocabService { - List getVocabTreeFromArdcByType(VocabApiPaths vocabApiPaths); + Map> getResolvedPathCollection(); + List getVocabTreeFromArdcByType(Map resolvedPaths); } diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index 98e7e996..0a87fd01 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -1,12 +1,14 @@ package au.org.aodn.ardcvocabs.service; import au.org.aodn.ardcvocabs.model.ArdcRootPaths; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabModel; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import jakarta.annotation.PostConstruct; +import lombok.Getter; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -36,13 +38,9 @@ public class ArdcVocabServiceImpl implements ArdcVocabService { protected RetryTemplate retryTemplate; protected static final String VERSION_REGEX = "^version-\\d+-\\d+$"; + + @Getter Map> resolvedPathCollection = new HashMap<>(); - protected enum PathName { - categoryApi, - categoryDetailsApi, - vocabApi, - vocabDetailsApi - } @PostConstruct public void initialiseVersions() { @@ -189,10 +187,10 @@ public ArdcVocabServiceImpl(RestTemplate restTemplate, RetryTemplate retryTempla this.retryTemplate = retryTemplate; } - protected VocabModel buildVocabByResourceUri(String vocabUri, String vocabApiBase, VocabApiPaths vocabApiPaths) { + protected VocabModel buildVocabByResourceUri(String vocabUri, String vocabApiBase, Map resolvedPaths) { String resourceDetailsApi = vocabUri.contains("_classes") - ? resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.categoryDetailsApi) - : resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabDetailsApi); + ? resolvedPaths.get(PathName.categoryDetailsApi) + : resolvedPaths.get(PathName.vocabDetailsApi); String detailsUrl = String.format(vocabApiBase + resourceDetailsApi, vocabUri); @@ -222,7 +220,7 @@ protected VocabModel buildVocabByResourceUri(String vocabUri, String vocabApiBas for (JsonNode j : target.get("narrower")) { if (!about.apply(j).isEmpty()) { // recursive call - VocabModel narrowerNode = buildVocabByResourceUri(about.apply(j), vocabApiBase, vocabApiPaths); + VocabModel narrowerNode = buildVocabByResourceUri(about.apply(j), vocabApiBase, resolvedPaths); if (narrowerNode != null) { narrowerNodes.add(narrowerNode); } @@ -242,7 +240,7 @@ protected VocabModel buildVocabByResourceUri(String vocabUri, String vocabApiBas return null; } - protected VocabModel buildVocabModel(T currentNode, String vocabApiBase, VocabApiPaths vocabApiPaths) { + protected VocabModel buildVocabModel(T currentNode, String vocabApiBase, Map resolvedPaths) { String resourceUri = null; if (currentNode instanceof ObjectNode objectNode) { @@ -260,12 +258,12 @@ protected VocabModel buildVocabModel(T currentNode, String vocabApiBase, Voc throw new IllegalArgumentException("Unsupported node type: " + currentNode.getClass().getName()); } - return buildVocabByResourceUri(resourceUri, vocabApiBase, vocabApiPaths); + return buildVocabByResourceUri(resourceUri, vocabApiBase, resolvedPaths); } - protected Map> getVocabLeafNodes(String vocabApiBase, VocabApiPaths vocabApiPaths) { + protected Map> getVocabLeafNodes(String vocabApiBase, Map resolvedPaths) { Map> results = new HashMap<>(); - String url = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabApi)); + String url = String.format(vocabApiBase + resolvedPaths.get(PathName.vocabApi)); while (url != null && !url.isEmpty()) { try { @@ -279,7 +277,7 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V if (isNodeValid.apply(node, "items")) { for (JsonNode j : node.get("items")) { // Now we need to construct link to detail resources - String dl = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.vocabDetailsApi), about.apply(j)); + String dl = String.format(vocabApiBase + resolvedPaths.get(PathName.vocabDetailsApi), about.apply(j)); try { log.debug("getVocabLeafNodes -> {}", dl); ObjectNode d = retryTemplate.execute(context -> restTemplate.getForObject(dl, ObjectNode.class)); @@ -304,7 +302,7 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V List vocabNarrower = new ArrayList<>(); if(target.has("narrower") && !target.get("narrower").isEmpty()) { for(JsonNode currentNode : target.get("narrower")) { - VocabModel narrowerNode = buildVocabModel(currentNode, vocabApiBase, vocabApiPaths); + VocabModel narrowerNode = buildVocabModel(currentNode, vocabApiBase, resolvedPaths); if (narrowerNode != null) { vocabNarrower.add(narrowerNode); } @@ -329,7 +327,7 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V List completedInternalNodes = new ArrayList<>(); vocab.getNarrower().forEach(currentInternalNode -> { // rebuild currentInternalNode (no linked leaf nodes) to completedInternalNode (with linked leaf nodes) - VocabModel completedInternalNode = buildVocabModel(currentInternalNode, vocabApiBase, vocabApiPaths); + VocabModel completedInternalNode = buildVocabModel(currentInternalNode, vocabApiBase, resolvedPaths); if (completedInternalNode != null) { // each internal node now will have linked narrower nodes (if available) completedInternalNodes.add(completedInternalNode); @@ -368,9 +366,9 @@ protected Map> getVocabLeafNodes(String vocabApiBase, V } @Override - public List getVocabTreeFromArdcByType(VocabApiPaths vocabApiPaths) { - Map> vocabLeafNodes = getVocabLeafNodes(vocabApiBase, vocabApiPaths); - String url = String.format(vocabApiBase + resolvedPathCollection.get(vocabApiPaths.name()).get(PathName.categoryApi)); + public List getVocabTreeFromArdcByType(Map resolvedPaths) { + Map> vocabLeafNodes = getVocabLeafNodes(vocabApiBase, resolvedPaths); + String url = String.format(vocabApiBase + resolvedPaths.get(PathName.categoryApi)); List vocabCategoryNodes = new ArrayList<>(); while (url != null && !url.isEmpty()) { try { @@ -398,7 +396,7 @@ public List getVocabTreeFromArdcByType(VocabApiPaths vocabApiPaths) Map> internalVocabCategoryNodes = new HashMap<>(); if (j.has("narrower") && !j.get("narrower").isEmpty()) { j.get("narrower").forEach(currentNode -> { - VocabModel internalNode = buildVocabModel(currentNode, vocabApiBase, vocabApiPaths); + VocabModel internalNode = buildVocabModel(currentNode, vocabApiBase, resolvedPaths); if (internalNode != null) { List leafNodes = vocabLeafNodes.getOrDefault(internalNode.getAbout(), Collections.emptyList()); if (!leafNodes.isEmpty()) { diff --git a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java index ce2b791a..ffc05ceb 100644 --- a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java +++ b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java @@ -1,6 +1,7 @@ package au.org.aodn.ardcvocabs.service; import au.org.aodn.ardcvocabs.BaseTestClass; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabModel; import com.fasterxml.jackson.databind.ObjectMapper; @@ -197,27 +198,27 @@ public void init() { this.ardcVocabService = new ArdcVocabServiceImpl(mockRestTemplate, new RetryTemplate()); this.ardcVocabService.vocabApiBase = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; - Map> resolvedPathCollection = new HashMap<>(); + Map> resolvedPathCollection = new HashMap<>(); resolvedPathCollection.put(VocabApiPaths.PARAMETER_VOCAB.name(), Map.of( - ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", - ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-parameter-category-vocabulary/version-2-1/concept.json", - ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", - ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" + PathName.vocabApi, "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", + PathName.categoryApi, "/aodn-parameter-category-vocabulary/version-2-1/concept.json", + PathName.categoryDetailsApi, "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" )); resolvedPathCollection.put(VocabApiPaths.PLATFORM_VOCAB.name(), Map.of( - ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-platform-vocabulary/version-6-1/concept.json", - ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-platform-category-vocabulary/version-1-2/concept.json", - ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", - ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" + PathName.vocabApi, "/aodn-platform-vocabulary/version-6-1/concept.json", + PathName.categoryApi, "/aodn-platform-category-vocabulary/version-1-2/concept.json", + PathName.categoryDetailsApi, "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" )); resolvedPathCollection.put(VocabApiPaths.ORGANISATION_VOCAB.name(), Map.of( - ArdcVocabServiceImpl.PathName.vocabApi, "/aodn-organisation-vocabulary/version-2-5/concept.json", - ArdcVocabServiceImpl.PathName.categoryApi, "/aodn-organisation-category-vocabulary/version-2-5/concept.json", - ArdcVocabServiceImpl.PathName.categoryDetailsApi, "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", - ArdcVocabServiceImpl.PathName.vocabDetailsApi, "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" + PathName.vocabApi, "/aodn-organisation-vocabulary/version-2-5/concept.json", + PathName.categoryApi, "/aodn-organisation-category-vocabulary/version-2-5/concept.json", + PathName.categoryDetailsApi, "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" )); this.ardcVocabService.resolvedPathCollection = resolvedPathCollection; @@ -262,7 +263,7 @@ public void verifyParameterVocab() throws IOException, JSONException { mockRestTemplate = setupParameterVocabMockRestTemplate(mockRestTemplate); - List parameterVocabModelList = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PARAMETER_VOCAB); + List parameterVocabModelList = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name())); assertEquals(4, parameterVocabModelList.size(), "Total equals"); Optional c = parameterVocabModelList @@ -356,7 +357,7 @@ public void verifyParameterVocab() throws IOException, JSONException { public void verifyPlatform() throws IOException, JSONException { mockRestTemplate = setupPlatformMockRestTemplate(mockRestTemplate); - List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PLATFORM_VOCAB); + List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name())); // verify the contents randomly assertNotNull(platformVocabsFromArdc); @@ -396,7 +397,7 @@ public void verifyPlatform() throws IOException, JSONException { public void verifyOrganization() throws IOException, JSONException { mockRestTemplate = setupOrganizationMockRestTemplate(mockRestTemplate); - List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.ORGANISATION_VOCAB); + List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name())); // verify the contents randomly assertNotNull(organisationVocabsFromArdc); diff --git a/indexer/src/main/java/au/org/aodn/esindexer/controller/IndexerExtController.java b/indexer/src/main/java/au/org/aodn/esindexer/controller/IndexerExtController.java index 7c235e61..54e5ff03 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/controller/IndexerExtController.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/controller/IndexerExtController.java @@ -65,7 +65,7 @@ public ResponseEntity> getOrganisationVocabs() throws IOException @GetMapping(path="/ardc/parameter/vocabs") @Operation(security = { @SecurityRequirement(name = "X-API-Key") }, description = "Get parameter vocabs from ARDC directly") public ResponseEntity> getParameterVocabsFromArdc() { - List vocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PARAMETER_VOCAB); + List vocabs = ardcVocabService.getVocabTreeFromArdcByType(ardcVocabService.getResolvedPathCollection().get(VocabApiPaths.PARAMETER_VOCAB.name())); return ResponseEntity.ok(indexerObjectMapper.valueToTree(vocabs)); } @@ -73,7 +73,7 @@ public ResponseEntity> getParameterVocabsFromArdc() { @GetMapping(path="/ardc/platform/vocabs") @Operation(security = { @SecurityRequirement(name = "X-API-Key") }, description = "Get platform vocabs from ARDC directly") public ResponseEntity> getPlatformVocabsFromArdc() { - List vocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PLATFORM_VOCAB); + List vocabs = ardcVocabService.getVocabTreeFromArdcByType(ardcVocabService.getResolvedPathCollection().get(VocabApiPaths.PLATFORM_VOCAB.name())); return ResponseEntity.ok(indexerObjectMapper.valueToTree(vocabs)); } @@ -81,7 +81,7 @@ public ResponseEntity> getPlatformVocabsFromArdc() { @GetMapping(path="/ardc/organisation/vocabs") @Operation(security = { @SecurityRequirement(name = "X-API-Key") }, description = "Get organisation vocabs from ARDC directly") public ResponseEntity> getOrganisationVocabsFromArdc() { - List vocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.ORGANISATION_VOCAB); + List vocabs = ardcVocabService.getVocabTreeFromArdcByType(ardcVocabService.getResolvedPathCollection().get(VocabApiPaths.ORGANISATION_VOCAB.name())); return ResponseEntity.ok(indexerObjectMapper.valueToTree(vocabs)); } @@ -94,7 +94,7 @@ public ResponseEntity populateDataToVocabsIndex() throws IOException, Ex vocabService.clearPlatformVocabCache(); vocabService.clearOrganisationVocabCache(); // populate new data - vocabService.populateVocabsData(); + vocabService.populateVocabsData(ardcVocabService.getResolvedPathCollection()); return ResponseEntity.status(HttpStatus.NO_CONTENT).body("Populated data to the vocabs index"); } } diff --git a/indexer/src/main/java/au/org/aodn/esindexer/service/VocabService.java b/indexer/src/main/java/au/org/aodn/esindexer/service/VocabService.java index bb308d27..c78e7026 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/service/VocabService.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/service/VocabService.java @@ -1,5 +1,6 @@ package au.org.aodn.esindexer.service; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabModel; import au.org.aodn.stac.model.ContactsModel; import au.org.aodn.stac.model.ThemesModel; @@ -7,13 +8,14 @@ import java.io.IOException; import java.util.List; +import java.util.Map; public interface VocabService { List extractVocabLabelsFromThemes(List themes, String vocabType) throws IOException; List extractOrganisationVocabLabelsFromThemes(List themes) throws IOException; List getMappedOrganisationVocabsFromContacts(List contacts) throws IOException; - void populateVocabsData() throws IOException; - void populateVocabsDataAsync(); + void populateVocabsData(Map> resolvedPathCollection) throws IOException; + void populateVocabsDataAsync(Map> resolvedPathCollection); void clearParameterVocabCache(); void clearPlatformVocabCache(); void clearOrganisationVocabCache(); diff --git a/indexer/src/main/java/au/org/aodn/esindexer/service/VocabServiceImpl.java b/indexer/src/main/java/au/org/aodn/esindexer/service/VocabServiceImpl.java index f2fea138..5c80fdab 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/service/VocabServiceImpl.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/service/VocabServiceImpl.java @@ -1,5 +1,6 @@ package au.org.aodn.esindexer.service; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabDto; import au.org.aodn.ardcvocabs.model.VocabModel; @@ -370,24 +371,24 @@ protected void bulkIndexVocabs(List vocabs) throws IOException { } } - public void populateVocabsData() throws IOException { + public void populateVocabsData(Map> resolvedPathCollection) throws IOException { log.info("Starting fetching vocabs data process synchronously..."); - List parameterVocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PARAMETER_VOCAB); - List platformVocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PLATFORM_VOCAB); - List organisationVocabs = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.ORGANISATION_VOCAB); + List parameterVocabs = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name())); + List platformVocabs = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name())); + List organisationVocabs = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name())); indexAllVocabs(parameterVocabs, platformVocabs, organisationVocabs); } - public void populateVocabsDataAsync() { + public void populateVocabsDataAsync(Map> resolvedPathCollection) { log.info("Starting async vocabs data fetching process..."); ExecutorService executorService = Executors.newFixedThreadPool(3); List>> vocabTasks = List.of( - createVocabFetchTask(VocabApiPaths.PARAMETER_VOCAB, "parameter"), - createVocabFetchTask(VocabApiPaths.PLATFORM_VOCAB, "platform"), - createVocabFetchTask(VocabApiPaths.ORGANISATION_VOCAB, "organisation") + createVocabFetchTask(resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name()), "parameter"), + createVocabFetchTask(resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name()), "platform"), + createVocabFetchTask(resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name()), "organisation") ); CompletableFuture.runAsync(() -> { @@ -422,10 +423,10 @@ public void populateVocabsDataAsync() { log.info("Vocabs data fetching process started in the background."); } - private Callable> createVocabFetchTask(VocabApiPaths vocabType, String vocabName) { + private Callable> createVocabFetchTask(Map resolvedPaths, String vocabName) { return () -> { log.info("Fetching {} vocabs from ARDC", vocabName); - return ardcVocabService.getVocabTreeFromArdcByType(vocabType); + return ardcVocabService.getVocabTreeFromArdcByType(resolvedPaths); }; } } diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java index 155d921e..6f09a87c 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java @@ -1,5 +1,6 @@ package au.org.aodn.esindexer.utils; +import au.org.aodn.ardcvocabs.service.ArdcVocabService; import au.org.aodn.esindexer.service.VocabService; import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; @@ -24,12 +25,19 @@ public void setVocabService(VocabService vocabService) { this.vocabService = vocabService; } + protected ArdcVocabService ardcVocabService; + @Autowired + public void setArdcVocabService(ArdcVocabService ardcVocabService) { + this.ardcVocabService = ardcVocabService; + } + + @PostConstruct public void init() throws IOException { // Check if the initialiseVocabsIndex flag is enabled if (initialiseVocabsIndex) { log.info("Initialising {} asynchronously", vocabsIndexName); - vocabService.populateVocabsDataAsync(); + vocabService.populateVocabsDataAsync(ardcVocabService.getResolvedPathCollection()); } } @@ -38,7 +46,7 @@ public void scheduledRefreshVocabsData() throws IOException { log.info("Refreshing ARDC vocabularies data"); // call synchronous populating method, otherwise existing vocab caches will be emptied while new data hasn't been fully processed yet. - vocabService.populateVocabsData(); + vocabService.populateVocabsData(ardcVocabService.getResolvedPathCollection()); // clear existing caches vocabService.clearParameterVocabCache(); diff --git a/indexer/src/test/java/au/org/aodn/esindexer/BaseTestClass.java b/indexer/src/test/java/au/org/aodn/esindexer/BaseTestClass.java index c1589b93..ce23ed7b 100644 --- a/indexer/src/test/java/au/org/aodn/esindexer/BaseTestClass.java +++ b/indexer/src/test/java/au/org/aodn/esindexer/BaseTestClass.java @@ -1,9 +1,10 @@ package au.org.aodn.esindexer; +import au.org.aodn.ardcvocabs.model.PathName; +import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.esindexer.configuration.GeoNetworkSearchTestConfig; import au.org.aodn.esindexer.service.VocabServiceImpl; import au.org.aodn.esindexer.utils.CommonUtils; -import au.org.aodn.esindexer.utils.VocabsIndexUtils; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch._types.ElasticsearchException; import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders; @@ -73,9 +74,33 @@ protected void clearElasticIndex(String indexName) throws IOException { } } + protected Map> resolvedPathCollection = new HashMap<>(); + @PostConstruct public void init() throws IOException { - vocabService.populateVocabsData(); + + resolvedPathCollection.put(VocabApiPaths.PARAMETER_VOCAB.name(), Map.of( + PathName.vocabApi, "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", + PathName.categoryApi, "/aodn-parameter-category-vocabulary/version-2-1/concept.json", + PathName.categoryDetailsApi, "/aodn-parameter-category-vocabulary/version-2-1/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-discovery-parameter-vocabulary/version-1-6/resource.json?uri=%s" + )); + + resolvedPathCollection.put(VocabApiPaths.PLATFORM_VOCAB.name(), Map.of( + PathName.vocabApi, "/aodn-platform-vocabulary/version-6-1/concept.json", + PathName.categoryApi, "/aodn-platform-category-vocabulary/version-1-2/concept.json", + PathName.categoryDetailsApi, "/aodn-platform-category-vocabulary/version-1-2/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-platform-vocabulary/version-6-1/resource.json?uri=%s" + )); + + resolvedPathCollection.put(VocabApiPaths.ORGANISATION_VOCAB.name(), Map.of( + PathName.vocabApi, "/aodn-organisation-vocabulary/version-2-5/concept.json", + PathName.categoryApi, "/aodn-organisation-category-vocabulary/version-2-5/concept.json", + PathName.categoryDetailsApi, "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", + PathName.vocabDetailsApi, "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" + )); + + vocabService.populateVocabsData(resolvedPathCollection); } protected HttpEntity getRequestEntity(String body) { diff --git a/indexer/src/test/java/au/org/aodn/esindexer/service/VocabServiceIT.java b/indexer/src/test/java/au/org/aodn/esindexer/service/VocabServiceIT.java index 86d73999..4ad8454c 100644 --- a/indexer/src/test/java/au/org/aodn/esindexer/service/VocabServiceIT.java +++ b/indexer/src/test/java/au/org/aodn/esindexer/service/VocabServiceIT.java @@ -101,7 +101,7 @@ void testExtractPlatformVocabLabelsFromThemes() throws IOException { @Test void testProcessParameterVocabs() throws IOException, JSONException { // read from ARDC - List parameterVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PARAMETER_VOCAB); + List parameterVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name())); // read from Elastic search List parameterVocabsFromEs = vocabService.getParameterVocabs(); @@ -118,7 +118,7 @@ void testProcessParameterVocabs() throws IOException, JSONException { @Test void testProcessPlatformVocabs() throws IOException, JSONException { // read from ARDC - List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.PLATFORM_VOCAB); + List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name())); // read from Elastic search List platformVocabsFromEs = vocabService.getPlatformVocabs(); @@ -134,7 +134,7 @@ void testProcessPlatformVocabs() throws IOException, JSONException { @Test void testProcessOrganisationVocabs() throws IOException, JSONException { // read from ARDC - List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(VocabApiPaths.ORGANISATION_VOCAB); + List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name())); // read from Elastic search List organisationVocabsFromEs = vocabService.getOrganisationVocabs(); From d3a135c262f6cbc89983e16d97c968c018995176 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Tue, 3 Dec 2024 16:10:37 +1100 Subject: [PATCH 6/8] Only update vocabs if there are version changes --- .../service/ArdcVocabServiceImpl.java | 8 +-- .../service/ArdcVocabServiceImplTest.java | 12 ++-- .../esindexer/utils/VocabsIndexUtils.java | 58 ++++++++++++++----- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index 0a87fd01..800c59d1 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -39,11 +39,8 @@ public class ArdcVocabServiceImpl implements ArdcVocabService { protected static final String VERSION_REGEX = "^version-\\d+-\\d+$"; - @Getter - Map> resolvedPathCollection = new HashMap<>(); - - @PostConstruct - public void initialiseVersions() { + public Map> getResolvedPathCollection() { + Map> resolvedPathCollection = new HashMap<>(); for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { try { // Fetch HTML contents for category and vocab @@ -72,6 +69,7 @@ public void initialiseVersions() { log.error("Error initialising versions for {}: {}", rootPath.name(), e.getMessage(), e); } } + return resolvedPathCollection; } private String fetchHtmlContent(String url) { diff --git a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java index ffc05ceb..20fa1164 100644 --- a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java +++ b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java @@ -38,6 +38,8 @@ public class ArdcVocabServiceImplTest extends BaseTestClass { protected ArdcVocabServiceImpl ardcVocabService; protected ObjectMapper mapper = new ObjectMapper(); + protected Map> resolvedPathCollection = new HashMap<>(); + @Mock RestTemplate mockRestTemplate; @@ -198,8 +200,6 @@ public void init() { this.ardcVocabService = new ArdcVocabServiceImpl(mockRestTemplate, new RetryTemplate()); this.ardcVocabService.vocabApiBase = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; - Map> resolvedPathCollection = new HashMap<>(); - resolvedPathCollection.put(VocabApiPaths.PARAMETER_VOCAB.name(), Map.of( PathName.vocabApi, "/aodn-discovery-parameter-vocabulary/version-1-6/concept.json", PathName.categoryApi, "/aodn-parameter-category-vocabulary/version-2-1/concept.json", @@ -220,8 +220,6 @@ public void init() { PathName.categoryDetailsApi, "/aodn-organisation-category-vocabulary/version-2-5/resource.json?uri=%s", PathName.vocabDetailsApi, "/aodn-organisation-vocabulary/version-2-5/resource.json?uri=%s" )); - - this.ardcVocabService.resolvedPathCollection = resolvedPathCollection; } @AfterEach void clear() { @@ -263,7 +261,7 @@ public void verifyParameterVocab() throws IOException, JSONException { mockRestTemplate = setupParameterVocabMockRestTemplate(mockRestTemplate); - List parameterVocabModelList = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name())); + List parameterVocabModelList = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PARAMETER_VOCAB.name())); assertEquals(4, parameterVocabModelList.size(), "Total equals"); Optional c = parameterVocabModelList @@ -357,7 +355,7 @@ public void verifyParameterVocab() throws IOException, JSONException { public void verifyPlatform() throws IOException, JSONException { mockRestTemplate = setupPlatformMockRestTemplate(mockRestTemplate); - List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name())); + List platformVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.PLATFORM_VOCAB.name())); // verify the contents randomly assertNotNull(platformVocabsFromArdc); @@ -397,7 +395,7 @@ public void verifyPlatform() throws IOException, JSONException { public void verifyOrganization() throws IOException, JSONException { mockRestTemplate = setupOrganizationMockRestTemplate(mockRestTemplate); - List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(this.ardcVocabService.resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name())); + List organisationVocabsFromArdc = ardcVocabService.getVocabTreeFromArdcByType(resolvedPathCollection.get(VocabApiPaths.ORGANISATION_VOCAB.name())); // verify the contents randomly assertNotNull(organisationVocabsFromArdc); diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java index 6f09a87c..683f6441 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java @@ -1,5 +1,6 @@ package au.org.aodn.esindexer.utils; +import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.service.ArdcVocabService; import au.org.aodn.esindexer.service.VocabService; import jakarta.annotation.PostConstruct; @@ -9,6 +10,7 @@ import org.springframework.scheduling.annotation.Scheduled; import java.io.IOException; +import java.util.Map; @Slf4j @@ -31,31 +33,61 @@ public void setArdcVocabService(ArdcVocabService ardcVocabService) { this.ardcVocabService = ardcVocabService; } + /* + The storedResolvedPathCollection is shared between the @PostConstruct method and the @Scheduled method. + If the scheduledRefreshVocabsData method runs while init is still processing, there could be concurrency issues. + To mitigate this, synchronize access to this shared resource with volatile keyword to ensure proper visibility. + The volatile modifier guarantees that any thread that reads a field will see the most recently written value + */ + private volatile Map> storedResolvedPathCollection; @PostConstruct public void init() throws IOException { // Check if the initialiseVocabsIndex flag is enabled if (initialiseVocabsIndex) { log.info("Initialising {} asynchronously", vocabsIndexName); - vocabService.populateVocabsDataAsync(ardcVocabService.getResolvedPathCollection()); + storedResolvedPathCollection = ardcVocabService.getResolvedPathCollection(); + vocabService.populateVocabsDataAsync(storedResolvedPathCollection); } } @Scheduled(cron = "0 0 0 * * *") - public void scheduledRefreshVocabsData() throws IOException { - log.info("Refreshing ARDC vocabularies data"); + public void scheduledRefreshVocabsData() { + try { + log.info("Refreshing ARDC vocabularies data"); + Map> latestResolvedPathCollection = ardcVocabService.getResolvedPathCollection(); - // call synchronous populating method, otherwise existing vocab caches will be emptied while new data hasn't been fully processed yet. - vocabService.populateVocabsData(ardcVocabService.getResolvedPathCollection()); + if (!latestResolvedPathCollection.equals(storedResolvedPathCollection)) { + log.info("Detected changes in the resolved path collection, updating vocabularies..."); + vocabService.populateVocabsData(latestResolvedPathCollection); + refreshCaches(); - // clear existing caches - vocabService.clearParameterVocabCache(); - vocabService.clearPlatformVocabCache(); - vocabService.clearOrganisationVocabCache(); + // Synchronize the update of the shared resource (storedResolvedPathCollection) + synchronized (this) { + storedResolvedPathCollection = latestResolvedPathCollection; + log.info("Updated storedResolvedPathCollection with the latest data."); + } + } else { + log.info("No changes detected in the resolved path collection. Skip updating caches"); + } + } catch (IOException e) { + log.error("Error refreshing vocabularies data: ", e); + } + } - // update the caches - vocabService.getParameterVocabs(); - vocabService.getPlatformVocabs(); - vocabService.getOrganisationVocabs(); + private void refreshCaches() { + try { + log.info("Clearing existing caches..."); + vocabService.clearParameterVocabCache(); + vocabService.clearPlatformVocabCache(); + vocabService.clearOrganisationVocabCache(); + + log.info("Updating vocabularies caches..."); + vocabService.getParameterVocabs(); + vocabService.getPlatformVocabs(); + vocabService.getOrganisationVocabs(); + } catch (IOException e) { + log.error("Error refreshing caches: ", e); + } } } From 137366b6aa608fb0c8c8ea4efb608339e2059125 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Mon, 9 Dec 2024 16:16:51 +1100 Subject: [PATCH 7/8] Extract specific version from current --- ardcvocabs/pom.xml | 5 - .../ardcvocabs/model/ArdcCurrentPaths.java | 29 + .../aodn/ardcvocabs/model/ArdcRootPaths.java | 29 - .../service/ArdcVocabServiceImpl.java | 75 +- .../service/ArdcVocabServiceImplTest.java | 30 - .../resources/databag/ardc/viewById22.html | 1616 ------ .../resources/databag/ardc/viewById24.html | 1616 ------ .../resources/databag/ardc/viewById25.html | 4446 ----------------- .../resources/databag/ardc/viewById26.html | 1189 ----- .../resources/databag/ardc/viewById28.html | 2109 -------- .../resources/databag/ardc/viewById29.html | 2153 -------- 11 files changed, 60 insertions(+), 13237 deletions(-) create mode 100644 ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java delete mode 100644 ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById22.html delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById24.html delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById25.html delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById26.html delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById28.html delete mode 100644 ardcvocabs/src/test/resources/databag/ardc/viewById29.html diff --git a/ardcvocabs/pom.xml b/ardcvocabs/pom.xml index 51df694a..01d40f92 100644 --- a/ardcvocabs/pom.xml +++ b/ardcvocabs/pom.xml @@ -60,11 +60,6 @@ org.springframework.retry spring-retry - - org.jsoup - jsoup - 1.18.1 - diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java new file mode 100644 index 00000000..0327b435 --- /dev/null +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java @@ -0,0 +1,29 @@ +package au.org.aodn.ardcvocabs.model; + +import lombok.Getter; + +@Getter +public enum ArdcCurrentPaths { + PARAMETER_VOCAB( + "/aodn-parameter-category-vocabulary/current/concept.json", + "/aodn-discovery-parameter-vocabulary/current/concept.json" + ), + PLATFORM_VOCAB( + "/aodn-platform-category-vocabulary/current/concept.json", + "/aodn-platform-vocabulary/current/concept.json" + ), + ORGANISATION_VOCAB( + "/aodn-organisation-category-vocabulary/current/concept.json", + "/aodn-organisation-vocabulary/current/concept.json" + ); + + + private final String categoryCurrent; + private final String vocabCurrent; + + ArdcCurrentPaths(String categoryRoot, String vocabRoot) { + String rootHostname = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; + this.categoryCurrent = rootHostname + categoryRoot; + this.vocabCurrent = rootHostname + vocabRoot; + } +} diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java deleted file mode 100644 index f9812a08..00000000 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcRootPaths.java +++ /dev/null @@ -1,29 +0,0 @@ -package au.org.aodn.ardcvocabs.model; - -import lombok.Getter; - -@Getter -public enum ArdcRootPaths { - PARAMETER_VOCAB( - "/viewById/24", - "/viewById/22" - ), - PLATFORM_VOCAB( - "/viewById/26", - "/viewById/25" - ), - ORGANISATION_VOCAB( - "/viewById/29", - "/viewById/28" - ); - - - private final String categoryRoot; - private final String vocabRoot; - - ArdcRootPaths(String categoryRoot, String vocabRoot) { - String rootHostname = "https://vocabs.ardc.edu.au"; - this.categoryRoot = rootHostname + categoryRoot; - this.vocabRoot = rootHostname + vocabRoot; - } -} diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java index 800c59d1..ee562f8a 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImpl.java @@ -1,17 +1,12 @@ package au.org.aodn.ardcvocabs.service; -import au.org.aodn.ardcvocabs.model.ArdcRootPaths; +import au.org.aodn.ardcvocabs.model.ArdcCurrentPaths; import au.org.aodn.ardcvocabs.model.PathName; import au.org.aodn.ardcvocabs.model.VocabApiPaths; import au.org.aodn.ardcvocabs.model.VocabModel; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; -import jakarta.annotation.PostConstruct; -import lombok.Getter; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -37,44 +32,43 @@ public class ArdcVocabServiceImpl implements ArdcVocabService { protected RestTemplate restTemplate; protected RetryTemplate retryTemplate; - protected static final String VERSION_REGEX = "^version-\\d+-\\d+$"; + protected static final String VERSION_REGEX = "/(version-\\d+-\\d+)(?:/|$)"; public Map> getResolvedPathCollection() { Map> resolvedPathCollection = new HashMap<>(); - for (ArdcRootPaths rootPath : ArdcRootPaths.values()) { + for (ArdcCurrentPaths currentPath : ArdcCurrentPaths.values()) { try { - // Fetch HTML contents for category and vocab - String categoryRootHtmlContent = fetchHtmlContent(rootPath.getCategoryRoot()); - String vocabRootHtmlContent = fetchHtmlContent(rootPath.getVocabRoot()); + ObjectNode categoryCurrentContent = fetchCurrentContents(currentPath.getCategoryCurrent()); + ObjectNode vocabCurrentContent = fetchCurrentContents(currentPath.getVocabCurrent()); - if (categoryRootHtmlContent != null && vocabRootHtmlContent != null) { + if (categoryCurrentContent != null && vocabCurrentContent != null) { // Extract versions - String categoryVersion = extractVersionFromHtmlContent(categoryRootHtmlContent); - String vocabVersion = extractVersionFromHtmlContent(vocabRootHtmlContent); + String categoryVersion = extractVersionFromCurrentContent(categoryCurrentContent); + String vocabVersion = extractVersionFromCurrentContent(vocabCurrentContent); if (categoryVersion != null && vocabVersion != null) { - log.info("Fetched ARDC category version for {}: {}", rootPath.name(), categoryVersion); - log.info("Fetched ARDC vocab version for {}: {}", rootPath.name(), vocabVersion); + log.info("Fetched ARDC category version for {}: {}", currentPath.name(), categoryVersion); + log.info("Fetched ARDC vocab version for {}: {}", currentPath.name(), vocabVersion); // Build and store resolved paths - Map resolvedPaths = buildResolvedPaths(rootPath, categoryVersion, vocabVersion); - resolvedPathCollection.put(rootPath.name(), resolvedPaths); + Map resolvedPaths = buildResolvedPaths(currentPath, categoryVersion, vocabVersion); + resolvedPathCollection.put(currentPath.name(), resolvedPaths); } else { - log.error("Failed to extract versions for {}", rootPath.name()); + log.error("Failed to extract versions for {}", currentPath.name()); } } else { - log.error("Failed to fetch HTML content for {}", rootPath.name()); + log.error("Failed to fetch HTML content for {}", currentPath.name()); } } catch (Exception e) { - log.error("Error initialising versions for {}: {}", rootPath.name(), e.getMessage(), e); + log.error("Error initialising versions for {}: {}", currentPath.name(), e.getMessage(), e); } } return resolvedPathCollection; } - private String fetchHtmlContent(String url) { + private ObjectNode fetchCurrentContents(String url) { try { - return restTemplate.getForObject(url, String.class); + return retryTemplate.execute(context -> restTemplate.getForObject(url, ObjectNode.class)); } catch (RestClientException e) { log.error("Failed to fetch HTML content from URL {}: {}", url, e.getMessage()); } catch (Exception e) { @@ -83,10 +77,10 @@ private String fetchHtmlContent(String url) { return null; } - protected Map buildResolvedPaths(ArdcRootPaths rootPath, String categoryVersion, String vocabVersion) { + protected Map buildResolvedPaths(ArdcCurrentPaths currentPaths, String categoryVersion, String vocabVersion) { Map resolvedPaths = new HashMap<>(); for (VocabApiPaths vocabApiPath : VocabApiPaths.values()) { - if (rootPath.name().equals(vocabApiPath.name())) { + if (currentPaths.name().equals(vocabApiPath.name())) { resolvedPaths.put(PathName.categoryApi, String.format(vocabApiPath.getCategoryApiTemplate(), categoryVersion)); resolvedPaths.put(PathName.categoryDetailsApi, String.format(vocabApiPath.getCategoryDetailsTemplate(), categoryVersion, "%s")); resolvedPaths.put(PathName.vocabApi, String.format(vocabApiPath.getVocabApiTemplate(), vocabVersion)); @@ -96,31 +90,24 @@ protected Map buildResolvedPaths(ArdcRootPaths rootPath, Strin return resolvedPaths; } - protected static String extractVersionFromHtmlContent(String htmlContent) { - if (htmlContent != null && !htmlContent.isEmpty()) { - // Parse HTML content with Jsoup - Document doc = Jsoup.parse(htmlContent); - - // Extract the first h4 element - // has(.box-tag.box-tag-green) query will ensure to select only the div element that has "Current" indicator - Element firstH4 = doc.selectFirst("div.col-md-4.panel-body:has(.box-tag.box-tag-green) h4:first-of-type"); - - if (firstH4 != null) { - String version = firstH4.text() - .toLowerCase() - .replaceAll("[ .]", "-"); - // Validate the version format - if (version.matches(VERSION_REGEX)) { + protected String extractVersionFromCurrentContent(ObjectNode currentContent) { + if (currentContent != null && !currentContent.isEmpty()) { + JsonNode node = currentContent.get("result"); + if (!about.apply(node).isEmpty()) { + Pattern pattern = Pattern.compile(VERSION_REGEX); + Matcher matcher = pattern.matcher(about.apply(node)); + + if (matcher.find()) { + String version = matcher.group(1); log.info("Valid Version Found: {}", version); return version; } else { - log.warn("Version does not match the required format: {}", version); + log.warn("Version does not match the required format: {}", about.apply(node)); } - } else { - log.warn("No matching h4 element found in the document."); } + } else { - log.warn("HTML content is empty or null."); + log.warn("Current content is empty or null."); } return null; } diff --git a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java index 20fa1164..8286e21e 100644 --- a/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java +++ b/ardcvocabs/src/test/java/au/org/aodn/ardcvocabs/service/ArdcVocabServiceImplTest.java @@ -226,36 +226,6 @@ public void init() { Mockito.reset(mockRestTemplate); } - @Test - void testFetchVersionWithCannedHtml() throws Exception { - String mockHtmlContent; - String version; - - mockHtmlContent = readResourceFile("/databag/ardc/viewById22.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-1-6", version, "Expected parsed version for viewById22.html is 'version-1-6'"); - - mockHtmlContent = readResourceFile("/databag/ardc/viewById24.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-2-1", version, "Expected parsed version for viewById24.html is 'version-2-1'"); - - mockHtmlContent = readResourceFile("/databag/ardc/viewById25.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-6-1", version, "Expected parsed version for viewById25.html is 'version-6-1'"); - - mockHtmlContent = readResourceFile("/databag/ardc/viewById26.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-1-2", version, "Expected parsed version for viewById26.html is 'version-1-2'"); - - mockHtmlContent = readResourceFile("/databag/ardc/viewById28.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-2-5", version, "Expected parsed version for viewById28.html is 'version-2-5'"); - - mockHtmlContent = readResourceFile("/databag/ardc/viewById29.html"); - version = ArdcVocabServiceImpl.extractVersionFromHtmlContent(mockHtmlContent); - assertEquals("version-2-5", version, "Expected parsed version for viewById29.html is 'version-2-5'"); - } - @Test public void verifyParameterVocab() throws IOException, JSONException { diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById22.html b/ardcvocabs/src/test/resources/databag/ardc/viewById22.html deleted file mode 100644 index 537cd0bb..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById22.html +++ /dev/null @@ -1,1616 +0,0 @@ - - - - - - - - - - - AODN Discovery Parameter Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Discovery Parameter Vocabulary

- Acronym: AODN Discovery Parameters
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 1.6

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-6 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 10 Aug 2023 view notes
- -
-
- - - - -
-
-

  Version 1.5

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-5 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 21 Oct 2022 view notes
- - -
-
- -
-
-

  Version 1.4

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-4 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 12 Dec 2018 view notes
- - -
-
- -
-
-

  Version 1.3

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-3 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 23 Feb 2018 view notes
- - -
-
- -
-
-

  Version 1.2

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 11 Aug 2016 view notes
- - -
-
- -
-
-

  Version 1.1

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-discovery-parameter-vocabulary_version-1-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 04 Nov 2015 view notes
- - -
-
- - - -
- - -
- -
An AODN controlled vocabulary describing discovery parameters. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Discovery Parameter Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-discovery-parameter-vocabulary" name="aodn-discovery-parameter-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-discovery-parameter-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-discovery-parameter-vocabulary/version-1-6',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has contributor - eMII_Finney.Kim_Admin -

- -

- - - Has author - Sebastien Mancini -

- -

- - - Has contributor - eMII_Mancini.Sebastien -

-
-
- - -
-
Used by
-
- -
- Used by IMOS. - -
-
-
- -
-
Examples of use
-
- -
-

IMOS use this vocabulary to provide standardised entry of discovery parameter information in metadata, and these terms are utilised in the parameter facet of the AODN Portal.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById24.html b/ardcvocabs/src/test/resources/databag/ardc/viewById24.html deleted file mode 100644 index 9c0d190a..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById24.html +++ /dev/null @@ -1,1616 +0,0 @@ - - - - - - - - - - - AODN Parameter Category Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Parameter Category Vocabulary

- Acronym: AODN Parameter Categories
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 2.1

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-2-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 10 Aug 2023 view notes
- -
-
- - - - -
-
-

  Version 2.0

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-2-0 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 21 Oct 2022 view notes
- - -
-
- -
-
-

  Version 1.4

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-4 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 11 Dec 2018 view notes
- - -
-
- -
-
-

  Version 1.3

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-3 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 27 Feb 2018 view notes
- - -
-
- -
-
-

  Version 1.2

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 23 Feb 2018 view notes
- - -
-
- -
-
-

  Version 1.1

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-parameter-category-vocabulary_version-1-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 11 Aug 2016 view notes
- - -
-
- - - -
- - -
- -
A classification scheme to support faceted searching across parameter types in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Parameter Category Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-parameter-category-vocabulary" name="aodn-parameter-category-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-parameter-category-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-parameter-category-vocabulary/version-2-1',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has contributor - eMII_Finney.Kim_Admin -

- -

- - - Has author - Sebastien Mancini -

- -

- - - Has contributor - eMII_Mancini.Sebastien -

-
-
- - -
-
Used by
-
- -
- Used by IMOS. - -
-
-
- -
-
Examples of use
-
- -
-

IMOS use this vocabulary to provide high level classification of parameters in the AODN Portal.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById25.html b/ardcvocabs/src/test/resources/databag/ardc/viewById25.html deleted file mode 100644 index 48cadb5d..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById25.html +++ /dev/null @@ -1,4446 +0,0 @@ - - - - - - - - - - - AODN Platform Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Platform Vocabulary

- Acronym: AODN Platforms
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 6.1

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-6-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 24 Jul 2024 view notes
- -
-
- - - - -
-
-

  Version 6.0

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-6-0 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 15 Mar 2024 view notes
- - -
-
- -
-
-

  Version 5.5

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-5 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 17 Oct 2023 view notes
- - -
-
- -
-
-

  Version 5.4

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-4 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 28 Aug 2023 view notes
- - -
-
- -
-
-

  Version 5.3

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-3 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 05 Jul 2023 view notes
- - -
-
- -
-
-

  Version 5.2

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-vocabulary_version-5-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 30 Mar 2023 view notes
- - -
-
- - - -
- - -
- -
An AODN controlled vocabulary describing platforms. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Platform Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-platform-vocabulary" name="aodn-platform-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-platform-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/version-6-1',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has contributor - eMII_Finney.Kim_Admin -

- -

- - - Has contributor - Natalia_Atkins -

- -

- - - Has author - Sebastien Mancini -

- -

- - - Has contributor - eMII_Atkins.Natalia -

- -

- - - Has contributor - Kim_Finney -

-
-
- - -
-
Used by
-
- -
- Used by IMOS. - -
-
-
- -
-
Examples of use
-
- -
-

IMOS use this vocabulary to provide standardised entry of instrument information in metadata, and these terms are utilised in the platform facet of the AODN Portal. The vocabulary also provides a check for data ingestion in several IMOS Sub-facilities.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById26.html b/ardcvocabs/src/test/resources/databag/ardc/viewById26.html deleted file mode 100644 index 19dd4c78..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById26.html +++ /dev/null @@ -1,1189 +0,0 @@ - - - - - - - - - - - AODN Platform Category Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Platform Category Vocabulary

- Acronym: AODN Platform Categories
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 1.2

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 02 Jan 2020 view notes
- -
-
- - - - -
-
-

  Version 1.1

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 03 Jul 2017 view notes
- - -
-
- -
-
-

  Version 1.0

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-platform-category-vocabulary_version-1-0 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 23 Sep 2015
- - -
-
- -
- - -
- -
A classification scheme to support faceted searching across platform types in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Platform Category Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-platform-category-vocabulary" name="aodn-platform-category-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-platform-category-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-category-vocabulary/version-1-2',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has contributor - eMII_Finney.Kim_Admin -

- -

- - - Has contributor - Natalia_Atkins -

- -

- - - Has author - Sebastien Mancini -

- -

- - - Has contributor - eMII_Atkins.Natalia -

-
-
- - - - -
-
Examples of use
-
- -
-

Department of Climate Change, Energy, the Environment and Water use this vocabulary to describe research outputs for reporting, search and discovery.

-

IMOS use this vocabulary to provide high level classification of platforms in the AODN Portal.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById28.html b/ardcvocabs/src/test/resources/databag/ardc/viewById28.html deleted file mode 100644 index 1ddc76d1..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById28.html +++ /dev/null @@ -1,2109 +0,0 @@ - - - - - - - - - - - AODN Organisation Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Organisation Vocabulary

- Acronym: AODN Organisations
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 2.5

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-5 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 10 Nov 2023 view notes
- -
-
- - - - -
-
-

  Version 2.4

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-4 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 18 Jan 2023 view notes
- - -
-
- -
-
-

  Version 2.3

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-3 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 13 Aug 2021 view notes
- - -
-
- -
-
-

  Version 2.2

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 16 Sep 2020 view notes
- - -
-
- -
-
-

  Version 2.1

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 07 Jan 2020 view notes
- - -
-
- -
-
-

  Version 2.0

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-vocabulary_version-2-0 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 27 Nov 2018 view notes
- - -
-
- - - -
- - -
- -
An AODN controlled vocabulary describing organisational entities. A classified version of the terms is used to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Organisation Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-organisation-vocabulary" name="aodn-organisation-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-organisation-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-organisation-vocabulary/version-2-5',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has contributor - eMII_Finney.Kim -

- -

- - - Has author - Natalia Atkins -

- -

- - - Has contributor - Natalia_Atkins -

- -

- - - Has contributor - eMII_Atkins.Natalia -

-
-
- - -
-
Used by
-
- -
- Used by IMOS. - -
-
-
- -
-
Examples of use
-
- -
-

IMOS use this vocabulary to provide consistent entry of organisation details in metadata, and to support faceted searching in the AODN Portal.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - diff --git a/ardcvocabs/src/test/resources/databag/ardc/viewById29.html b/ardcvocabs/src/test/resources/databag/ardc/viewById29.html deleted file mode 100644 index 7369e55c..00000000 --- a/ardcvocabs/src/test/resources/databag/ardc/viewById29.html +++ /dev/null @@ -1,2153 +0,0 @@ - - - - - - - - - - - AODN Organisation Category Vocabulary - Research Vocabularies Australia - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
- -
-
-
- - - - - - Using search - - - Browse all vocabularies - - - | - - - concepts - -
-
-
-
-
-
- - Help -
-
-
-
-
-
- -
-
- -

AODN Organisation Category Vocabulary

- Acronym: AODN Organisation Categories
- Publisher Australian Ocean Data Network (AODN) -
- Created: 23 Sep 2015 - 𝕏 -
-
-
-
-
-
- -
-
- -
- - -
-
-

- - Version 2.5

- current -
-
-
- - Download - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-5 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 10 Nov 2023 view notes
- -
-
- - - - -
-
-

  Version 2.4

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-4 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 18 Jan 2023 view notes
- - -
-
- -
-
-

  Version 2.3

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-3 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 13 Aug 2021 view notes
- - -
-
- -
-
-

  Version 2.2

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- http://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-2 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 16 Sep 2020 view notes
- - -
-
- -
-
-

  Version 2.1

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-1 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 07 Jan 2020 view notes
- - -
-
- -
-
-

  Version 2.0

- superseded -
-
-
- Download - - - - - -
- -
- SPARQL Endpoint: -

- https://vocabs.ardc.edu.au/repository/api/sparql/aodn_aodn-organisation-category-vocabulary_version-2-0 -
- - Open SPARQL Endpoint in YASGUI - -
- Learn More -

-
-
-
- released: 27 Nov 2018 view notes
- - -
-
- - - -
- - -
- -
An AODN controlled vocabulary describing organisation categories for classifying organisational entities, to support faceted searching in the AODN Portal (https://portal.aodn.org.au/).
-
Revision Cycle
-

Periodic

-
Languages
-

- English -

-
Licence
-

- CC-BY
-

-
-
-
-
- - -
-
-
-

- - Using browse - -

- - - - - - - - - - - - - - - - - - - - -
- - - -   - - - - - - - - - - - -
- - Concept - - - - -
-
-
- -
-
-
-
-
-
-
Use this code snippet to describe or - discover resources with - AODN Organisation Category Vocabulary in your system -

Example: Search for and select concepts - in this vocabulary - - -
- -
-
-
-<input type="text" id="aodn-organisation-category-vocabulary" name="aodn-organisation-category-vocabulary" value="" size="80" autocomplete="off">
-<script>
-    $("#aodn-organisation-category-vocabulary").vocab_widget({
-        mode: 'search',
-        cache: false,
-        repository: 'http://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-organisation-category-vocabulary/version-2-5',
-        target_field: 'label',
-        endpoint: 'https://vocabs.ardc.edu.au/apps/vocab_widget/proxy/'
-    });
-</script>
-                        
-
-
- - - - -
-
-
- -
-
-
Related
-
- -
Related people and organisations
- -

- - - Has author - Natalia Atkins -

- -

- - - Has contributor - Sebastien Mancini -

-
-
- - -
-
Used by
-
- -
- Used by IMOS. - -
-
-
- -
-
Examples of use
-
- -
-

IMOS use this vocabulary to provide high level classification of organisations in the AODN Portal.

- - -
-
-
- -
- - - -
- -
-
-
-
-
- -
- - - From b54a8a7838b7faf6ff4af7f409debc3fab63b080 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Date: Mon, 9 Dec 2024 16:38:08 +1100 Subject: [PATCH 8/8] minor update --- .../au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java | 8 ++++---- .../au/org/aodn/esindexer/utils/VocabsIndexUtils.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java index 0327b435..1644c25b 100644 --- a/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java +++ b/ardcvocabs/src/main/java/au/org/aodn/ardcvocabs/model/ArdcCurrentPaths.java @@ -21,9 +21,9 @@ public enum ArdcCurrentPaths { private final String categoryCurrent; private final String vocabCurrent; - ArdcCurrentPaths(String categoryRoot, String vocabRoot) { - String rootHostname = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; - this.categoryCurrent = rootHostname + categoryRoot; - this.vocabCurrent = rootHostname + vocabRoot; + ArdcCurrentPaths(String categoryCurrent, String vocabCurrent) { + String baseUrl = "https://vocabs.ardc.edu.au/repository/api/lda/aodn"; + this.categoryCurrent = baseUrl + categoryCurrent; + this.vocabCurrent = baseUrl + vocabCurrent; } } diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java index 683f6441..3dcb15e6 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/VocabsIndexUtils.java @@ -62,7 +62,7 @@ public void scheduledRefreshVocabsData() { vocabService.populateVocabsData(latestResolvedPathCollection); refreshCaches(); - // Synchronize the update of the shared resource (storedResolvedPathCollection) + // update the head if there are new versions synchronized (this) { storedResolvedPathCollection = latestResolvedPathCollection; log.info("Updated storedResolvedPathCollection with the latest data.");