Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Apply the [patches](core-geonetwork-patches) to the GeoNetwork core. You may nee
git am --ignore-space-change --ignore-whitespace --reject --whitespace=fix schemas/dcat-ap/core-geonetwork-patches/*.patch
```

These patches were generated using `git format-patch -1` after including the necessary changes in one commit. If `core-geonetwork` would clash with the patches, they need to be regenerated:
- After running the above `git am` command, `.json.rej` are generated
- Make sure the unapplied changes are aligned with the new codebase
- Make a new commit that contains all changes generated by the patches and the above fixes
- Generate a new patch using `git format-patch -1`, update the patch file and commit it to `main`

Build and run the application following the
[Software Development Documentation](https://github.com/geonetwork/core-geonetwork/tree/main/software_development). You'll need to have Java JDK 11 and [Maven](https://maven.apache.org/install.html) installed.

Expand Down
153 changes: 77 additions & 76 deletions core-geonetwork-patches/current.patch

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gn-schemas</artifactId>
<groupId>org.geonetwork-opensource.schemas</groupId>
<version>4.4.9-0</version>
<version>4.4.11-0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,24 @@ private Set<AssociatedResource> getAssociatedVirtualCatalog(Element metadata) {
/**
* For next records, resolve dcat:next elements
*/
private Set<AssociatedResource> getAssociatedNext(Element metadata) {
Set<AssociatedResource> results = getAssociatedResourcesByXpath(metadata, "*//dcat:next/@rdf:resource");
private Set<AssociatedResource> getAssociatedPrevious(Element metadata) {
Set<AssociatedResource> results = getAssociatedResourcesByXpath(metadata, "*//dcat:prev/@rdf:resource");
return results.stream()
.peek(ar -> ar.setAssociationType("nextResource"))
.peek(ar -> ar.setAssociationType("revisionOf"))
.collect(Collectors.toSet());
}

/**
* For previous records, find datasets that point to the current one with a dcat:next
*/
private Set<AssociatedResource> getAssociatedPrevious(Element metadata) {
private Set<AssociatedResource> getAssociatedNext(Element metadata) {
try {
String currentUuid = getCurrentUuid(metadata);
if (currentUuid == null) {
return Collections.emptySet();
}
var searchManager = ApplicationContextHolder.get().getBean(EsSearchManager.class);
var response = searchManager.query(String.format("+nextUUIDInSeries:\"%s\"", currentUuid), null,
var response = searchManager.query(String.format("+previousUUIDInSeries:\"%s\"", currentUuid), null,
Sets.newHashSet("uuid", "resourceTitleObject.default"), 0, 100);

if (response.hits().hits().isEmpty()) {
Expand All @@ -175,15 +175,15 @@ private Set<AssociatedResource> getAssociatedPrevious(Element metadata) {
AssociatedResource ar = new AssociatedResource(
(String) associatedRecord.get("uuid"),
"",
"previousResource",
"nextResource",
null,
((Map<String, String>) associatedRecord.get("resourceTitleObject")).get("default")
);
res.add(ar);
}
return res;
} catch (Exception e) {
Log.error(Log.JEEVES, "GET associated previous resources error: " + e.getMessage(), e);
Log.error(Log.JEEVES, "GET associated next resources error: " + e.getMessage(), e);
}
return Collections.emptySet();
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/plugin/dcat-ap/config/associated-panel/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"isTemplate": "n"
},
"searchParamsPerType": {
"revisionOf-*": {
"type": [
"dataset",
"service"
]
},
"nextResource-*": {
"type": [
"dataset",
Expand Down
36 changes: 34 additions & 2 deletions src/main/plugin/dcat-ap/index-fields/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@
<xsl:value-of select="dcatutil:getUUIDByURI(normalize-space(@rdf:resource))"/>
</nextUUIDInSeries>
</xsl:for-each>
<xsl:for-each select="dcat:prev[normalize-space(@rdf:resource) != '']">
<previousUUIDInSeries>
<xsl:value-of select="dcatutil:getUUIDByURI(normalize-space(@rdf:resource))"/>
</previousUUIDInSeries>
</xsl:for-each>
<!-- Index more fields in this element -->
<xsl:apply-templates mode="index-extra-fields" select="."/>
</doc>
Expand Down Expand Up @@ -366,8 +371,34 @@
Keyword values are pulled from the thesaurus defined in the editor.
-->
<xsl:template mode="index-reference" match="dcat:Dataset|dcat:DataService|dcat:DatasetSeries|dcat:Catalog">
<xsl:for-each-group select="*[not(skos:Concept) and name() = $editorConfig/editor/fields/for[@use='thesaurus-list-picker']/@name]" group-by="name()">
<xsl:variable name="thesaurusId" select="$editorConfig/editor/fields/for[@name = name(current-group()[1])]/directiveAttributes/@thesaurus"/>
<!--
eg.
<for name="dcat:theme" use="thesaurus-list-picker">
<for name="dct:accessRights" xpath="dcat:Dataset" use="thesaurus-list-picker">
<for name="dct:conformsTo" xpath="dcat:Dataset" use="thesaurus-list-picker">
<for name="dct:conformsTo" xpath="mobilitydcatap:mobilityDataStandard" use="thesaurus-list-picker">
-->
<xsl:variable name="editorFieldsUsingThesaurusListPicker" select="$editorConfig/editor/fields/for[@use='thesaurus-list-picker']"/>
<xsl:variable name="separator" select="'/'"/>

<xsl:for-each-group select="*[not(skos:Concept) and name() = $editorFieldsUsingThesaurusListPicker/@name]"
group-by="string-join((name(..), name()), $separator)">
<xsl:variable name="keyToken" select="tokenize(current-grouping-key(), $separator)"/>
<xsl:variable name="elementName" select="$keyToken[2]"/>
<xsl:variable name="parentName" select="$keyToken[1]"/>

<xsl:variable name="fieldConfigurationWithContext"
select="$editorFieldsUsingThesaurusListPicker[
@name = $elementName and @xpath = $parentName
]"/>
<xsl:variable name="fieldConfiguration"
select="if ($fieldConfigurationWithContext) then $fieldConfigurationWithContext
else $editorFieldsUsingThesaurusListPicker[@name = $elementName and not(@xpath)]"/>

<xsl:variable name="thesaurusId"
select="$fieldConfiguration/directiveAttributes/@thesaurus"/>


<xsl:variable name="key">
<xsl:if test="$thesaurusId != ''">
<xsl:value-of select="tokenize($thesaurusId[1], '\.')[last()]"/>
Expand All @@ -381,6 +412,7 @@
[
<xsl:for-each select="current-group()">
<xsl:variable name="resourceUri" select="@rdf:resource"/>

<xsl:variable name="defaultLabel" select="java:getKeywordValueByUri($resourceUri, $thesaurusId, $defaultMainLanguage2Char)"/>
{
"default": "<xsl:value-of select="util:escapeForJson($defaultLabel)"/>",
Expand Down
11 changes: 8 additions & 3 deletions src/main/plugin/dcat-ap/loc/dut/codelists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@

<codelists>
<codelist name="dcat:Resource" alias="associationType">
<entry>
<!--<entry>
<code>nextResource</code>
<label>Volgende resource</label>
<description>Volgende resource in reeks</description>
<label>Volgende Resource</label>
<description>Volgende Resource in reeks</description>
</entry>-->
<entry>
<code>revisionOf</code>
<label>Vorherige Resource</label>
<description>Vorherige Resource in series</description>
</entry>
</codelist>
</codelists>
7 changes: 6 additions & 1 deletion src/main/plugin/dcat-ap/loc/eng/codelists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@

<codelists>
<codelist name="dcat:Resource" alias="associationType">
<entry>
<!--<entry>
<code>nextResource</code>
<label>Next resource</label>
<description>Next resource in series</description>
</entry>-->
<entry>
<code>revisionOf</code>
<label>Previous resource</label>
<description>Previous resource in series</description>
</entry>
</codelist>
</codelists>
9 changes: 7 additions & 2 deletions src/main/plugin/dcat-ap/loc/fre/codelists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@

<codelists>
<codelist name="dcat:Resource" alias="associationType">
<entry>
<!--<entry>
<code>nextResource</code>
<label>Ressource suivante</label>
<label>Version suivante</label>
<description>Ressource suivante dans la série</description>
</entry>-->
<entry>
<code>revisionOf</code>
<label>Version précédente</label>
<description>Ressource précédente dans la série</description>
</entry>
</codelist>
</codelists>
7 changes: 6 additions & 1 deletion src/main/plugin/dcat-ap/loc/ger/codelists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@

<codelists>
<codelist name="dcat:Resource" alias="associationType">
<entry>
<!--<entry>
<code>nextResource</code>
<label>Nächste Ressource</label>
<description>Nächste Ressource in der Reihe</description>
</entry>-->
<entry>
<code>revisionOf</code>
<label>Vorherige Ressource</label>
<description>Vorherige Ressource in series</description>
</entry>
</codelist>
</codelists>
5 changes: 4 additions & 1 deletion src/main/plugin/dcat-ap/process/parent-remove.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ Stylesheet used to remove a reference to a parent record.
-->
<xsl:stylesheet version="2.0"
xmlns:dcat="http://www.w3.org/ns/dcat#"
xmlns:dcatutil="java:org.fao.geonet.schema.dcatap.util.XslUtil"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:geonet="http://www.fao.org/geonetwork">
<!-- Parent metadata record UUID -->
<xsl:param name="parentUuid"/>

<xsl:variable name="seriesURI" select="dcatutil:getRecordResourceURI($parentUuid)"/>

<!-- Do a copy of every nodes and attributes -->
<xsl:template match="@*|node()">
Expand All @@ -41,5 +44,5 @@ Stylesheet used to remove a reference to a parent record.
</xsl:template>

<!-- Remove geonet:* elements or any DCAT inSeries reference. -->
<xsl:template match="geonet:*|dcat:inSeries" priority="2"/>
<xsl:template match="geonet:*|dcat:inSeries[@rdf:resource = $seriesURI]" priority="2"/>
</xsl:stylesheet>
7 changes: 4 additions & 3 deletions src/main/plugin/dcat-ap/process/sibling-add.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</xsl:for-each>
</xsl:template>

<xsl:template match="*[name() = ('dcat:Dataset', 'dcat:DataService', 'dcat:DatasetSeries') and $associationType = 'nextResource']">
<xsl:template match="*[name() = ('dcat:Dataset', 'dcat:DataService', 'dcat:DatasetSeries') and $associationType = ('nextResource', 'revisionOf')]">
<xsl:variable name="resourceWithNext">
<xsl:copy>
<xsl:copy-of select="@*"/>
Expand All @@ -102,10 +102,11 @@
</xsl:if>
</xsl:for-each>
</xsl:variable>

<xsl:for-each select="$uriToAdd">
<dcat:next>
<xsl:element name="{if ($associationType = 'nextResource') then 'dcat:next' else 'dcat:prev'}">
<xsl:attribute name="rdf:resource" select="uri"/>
</dcat:next>
</xsl:element>
</xsl:for-each>
</xsl:copy>
</xsl:variable>
Expand Down
1 change: 1 addition & 0 deletions src/main/plugin/dcat-ap/process/sibling-remove.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
dcat:CatalogRecord[starts-with(@rdf:about, 'http') and @rdf:about = $uuidref]"/>

<xsl:template match="dcat:next[@rdf:resource = $uriRef]"/>
<xsl:template match="dcat:prev[@rdf:resource = $uriRef]"/>

<xsl:template match="@*|*|text()">
<xsl:copy>
Expand Down
4 changes: 1 addition & 3 deletions utility/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG GN_VERSION=4.4.9
ARG GN_VERSION=4.4.11
FROM geonetwork:${GN_VERSION}

USER jetty

# Remove the existing vanilla GeoNetwork
RUN rm -rf /opt/geonetwork/*

Expand Down
4 changes: 2 additions & 2 deletions utility/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
retries: 5

elasticsearch:
image: elasticsearch:8.14.3
image: elasticsearch:8.19.13
container_name: es
ports:
- "9200:9200"
Expand Down Expand Up @@ -55,7 +55,7 @@ services:
timeout: 5s
retries: 20
environment:
WEBAPP_CONTEXT_PATH: /
WEBAPP_CONTEXT_PATH: /ROOT
GEONETWORK_DB_TYPE: postgres
GEONETWORK_DB_HOST: database
GEONETWORK_DB_PORT: 5432
Expand Down
Loading