Skip to content

Commit

Permalink
XSL utility / Add function to retrieve thesaurus URI
Browse files Browse the repository at this point in the history
RDF based schema plugins may need the URI of vocabularies in a number of places. This utility is used in the DCAT-AP plugin when building concept elements in thesaurus-transformation.xsl:

eg.
```
  <dct:accessRights xmlns:dct="http://purl.org/dc/terms/">
    <skos:Concept xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="http://publications.europa.eu/resource/authority/access-right/PUBLIC">
      <skos:prefLabel xml:lang="en">public</skos:prefLabel>
      <skos:prefLabel xml:lang="es">public</skos:prefLabel>
      <skos:inScheme rdf:resource="http://publications.europa.eu/resource/authority/access-right" />
    </skos:Concept>
  </dct:accessRights>
```
  • Loading branch information
fxprunayre committed Oct 25, 2024
1 parent 573d4be commit 43a57af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/src/main/java/org/fao/geonet/util/XslUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ public static String getThesaurusIdByTitle(String title) {

return thesaurus == null ? "" : "geonetwork.thesaurus." + thesaurus.getKey();
}

/**
* Retrieve the thesaurus title using the thesaurus key.
*
Expand All @@ -1455,6 +1455,15 @@ public static String getThesaurusTitleByKey(String id) {
}


public static String getThesaurusUriByKey(String id) {
ApplicationContext applicationContext = ApplicationContextHolder.get();
ThesaurusManager thesaurusManager = applicationContext.getBean(ThesaurusManager.class);
Thesaurus thesaurus = thesaurusManager.getThesaurusByName(id);
return thesaurus == null ? "" : thesaurus.getDefaultNamespace();
}



/**
* Utility method to retrieve the name (label) for an iso language using it's code for a specific language.
* <p>
Expand Down Expand Up @@ -1594,7 +1603,7 @@ private static List<Element> buildRecordLink(List<Hit> hits, String type) {
public static String escapeForJson(String value) {
return StringEscapeUtils.escapeJson(value);
}

public static String getWebAnalyticsService() {
ApplicationContext applicationContext = ApplicationContextHolder.get();
WebAnalyticsConfiguration webAnalyticsConfiguration = applicationContext.getBean(WebAnalyticsConfiguration.class);
Expand Down

0 comments on commit 43a57af

Please sign in to comment.