diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a4ed3857..2f0da84c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+## [1.17.1]
+
+❗Manual check of custom and customized metadata schemas is required.
+
+### Fixed
+
+- Use `dcterms:hasVersion` has been changed to `dcat:version`
+
## [1.17.0]
### Added
@@ -368,3 +376,4 @@ The first release of reference FAIR Data Point implementation.
[1.16.1]: /../../tree/v1.16.1
[1.16.2]: /../../tree/v1.16.2
[1.17.0]: /../../tree/v1.17.0
+[1.17.1]: /../../tree/v1.17.1
diff --git a/SECURITY.md b/SECURITY.md
index d73b87f11..6b136e275 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -6,7 +6,7 @@ We support the latest major and minor version with patch versions that fix vulne
| Version | Supported |
|---------| ------------------ |
-| 1.17.0 | :white_check_mark: |
+| 1.17.1 | :white_check_mark: |
| < 1.17 | :x: |
## Current Recommendations
diff --git a/pom.xml b/pom.xml
index abf2ff5ba..a1527d2ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
nl.dtls
fairdatapoint
- 1.17.0
+ 1.17.1
jar
FairDataPoint
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/settings/data/SettingsFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/settings/data/SettingsFixtures.java
index 2af1f1ca9..883105b3f 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/settings/data/SettingsFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/settings/data/SettingsFixtures.java
@@ -80,7 +80,7 @@ public class SettingsFixtures {
.builder()
.type(SearchFilterType.LITERAL)
.label("Version")
- .predicate("http://purl.org/dc/terms/hasVersion")
+ .predicate("http://www.w3.org/ns/dcat#version")
.queryFromRecords(true)
.presetValues(Collections.emptyList())
.build();
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0015_FixMetadataVersion.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0015_FixMetadataVersion.java
new file mode 100644
index 000000000..b09519216
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0015_FixMetadataVersion.java
@@ -0,0 +1,123 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.mongo.migration.production;
+
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.model.Filters;
+import com.mongodb.client.model.Updates;
+import io.mongock.api.annotations.ChangeUnit;
+import io.mongock.api.annotations.Execution;
+import io.mongock.api.annotations.RollbackExecution;
+import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.entity.schema.SemVer;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
+import org.bson.Document;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.mongodb.core.MongoTemplate;
+
+@ChangeUnit(
+ id = "Migration_0015_FixMetadataVersion",
+ order = "0015",
+ author = "migrationBot"
+)
+@Profile(Profiles.PRODUCTION)
+public class Migration_0015_FixMetadataVersion {
+
+ private static final String FIELD_UUID = "uuid";
+ private static final String FIELD_VER_UUID = "versionUuid";
+ private static final String FIELD_LATEST = "latest";
+ private static final String FIELD_VERSION = "versionString";
+ private static final String FIELD_DEF = "definition";
+ private static final String COL_SCHEMAS = "metadataSchema";
+
+ private final MongoTemplate database;
+
+ private String previousVersionUuid;
+
+ public Migration_0015_FixMetadataVersion(MongoTemplate template) {
+ this.database = template;
+ }
+
+ @Execution
+ public void run() {
+ final MongoCollection schemasCol = database.getCollection(COL_SCHEMAS);
+ final Document latestResourcesSchema = schemasCol.find(
+ Filters.and(
+ Filters.eq(FIELD_UUID, KnownUUIDs.SCHEMA_RESOURCE_UUID),
+ Filters.eq(FIELD_LATEST, true)
+ )
+ ).first();
+ if (latestResourcesSchema == null) {
+ return;
+ }
+ previousVersionUuid = latestResourcesSchema.getString(FIELD_VER_UUID);
+ latestResourcesSchema.put(
+ FIELD_DEF,
+ latestResourcesSchema
+ .getString(FIELD_DEF)
+ .replace(
+ """
+ sh:path dct:hasVersion ;
+ sh:name "version" ;
+ sh:nodeKind sh:Literal ;
+ """,
+ """
+ sh:path dcat:version ;
+ sh:nodeKind sh:Literal ;
+ """
+ )
+ );
+ latestResourcesSchema.remove("_id");
+ latestResourcesSchema.put(FIELD_VER_UUID, KnownUUIDs.SCHEMA_V2_RESOURCE_UUID);
+ latestResourcesSchema.put(FIELD_LATEST, true);
+ final SemVer semVer = new SemVer(latestResourcesSchema.getString(FIELD_VERSION));
+ semVer.setPatch(semVer.getPatch() + 1);
+ latestResourcesSchema.put(FIELD_VERSION, semVer.toString());
+ schemasCol.updateMany(
+ Filters.and(
+ Filters.eq(FIELD_UUID, KnownUUIDs.SCHEMA_RESOURCE_UUID),
+ Filters.eq(FIELD_VER_UUID, previousVersionUuid)
+ ),
+ Updates.set(FIELD_LATEST, false)
+ );
+ schemasCol.insertOne(latestResourcesSchema);
+ }
+
+ @RollbackExecution
+ public void rollback() {
+ final MongoCollection schemasCol = database.getCollection(COL_SCHEMAS);
+ schemasCol.deleteOne(
+ Filters.and(
+ Filters.eq(FIELD_UUID, KnownUUIDs.SCHEMA_RESOURCE_UUID),
+ Filters.eq(FIELD_VER_UUID, KnownUUIDs.SCHEMA_V2_RESOURCE_UUID)
+ )
+ );
+ schemasCol.updateOne(
+ Filters.and(
+ Filters.eq(FIELD_UUID, KnownUUIDs.SCHEMA_RESOURCE_UUID),
+ Filters.eq(FIELD_VER_UUID, previousVersionUuid)
+ ),
+ Updates.set(FIELD_LATEST, true)
+ );
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0005_FixMetadataVersion.java b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0005_FixMetadataVersion.java
new file mode 100644
index 000000000..78281e1de
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0005_FixMetadataVersion.java
@@ -0,0 +1,76 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.database.rdf.migration.production;
+
+import lombok.extern.slf4j.Slf4j;
+import nl.dtls.fairdatapoint.vocabulary.DCAT3;
+import nl.dtls.rdf.migration.entity.RdfMigrationAnnotation;
+import nl.dtls.rdf.migration.runner.RdfProductionMigration;
+import org.eclipse.rdf4j.model.Statement;
+import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
+import org.eclipse.rdf4j.repository.Repository;
+import org.eclipse.rdf4j.repository.RepositoryConnection;
+import org.eclipse.rdf4j.repository.RepositoryException;
+import org.eclipse.rdf4j.repository.RepositoryResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.s;
+
+@RdfMigrationAnnotation(
+ number = 5,
+ name = "Fix Metadata Version",
+ description = "Use dcat:version instead of dcterms:hasVersion")
+@Slf4j
+@Service
+public class Rdf_Migration_0005_FixMetadataVersion implements RdfProductionMigration {
+
+ private static final String MSG_ADD = "Adding: {} {} {}";
+ private static final String MSG_REMOVE = "Removing: {} {} {}";
+
+ @Autowired
+ private Repository repository;
+
+ public void runMigration() {
+ updateVersionStatements();
+ }
+
+ private void updateVersionStatements() {
+ // change dcterms:hasVersion to dcat:version property (if object is literal)
+ try (RepositoryConnection conn = repository.getConnection()) {
+ final RepositoryResult queryResult = conn.getStatements(null, DCTERMS.HAS_VERSION, null);
+ while (queryResult.hasNext()) {
+ final Statement st = queryResult.next();
+ if (st.getObject().isLiteral()) {
+ log.debug(MSG_ADD, st.getSubject(), DCAT3.VERSION, st.getObject());
+ conn.add(s(st.getSubject(), DCAT3.VERSION, st.getObject(), st.getSubject()));
+ log.debug(MSG_REMOVE, st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ }
+ }
+ catch (RepositoryException exception) {
+ log.error(exception.getMessage(), exception);
+ }
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java b/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java
index a25f83997..9795efbd4 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java
+++ b/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java
@@ -22,6 +22,7 @@
*/
package nl.dtls.fairdatapoint.entity.metadata;
+import nl.dtls.fairdatapoint.vocabulary.DCAT3;
import nl.dtls.fairdatapoint.vocabulary.FDP;
import nl.dtls.fairdatapoint.vocabulary.Sio;
import org.eclipse.rdf4j.model.IRI;
@@ -79,7 +80,7 @@ public static void setDescription(Model metadata, IRI uri, Literal description)
}
public static void setVersion(Model metadata, IRI uri, Literal version) {
- update(metadata, uri, DCTERMS.HAS_VERSION, version);
+ update(metadata, uri, DCAT3.VERSION, version);
}
public static void setLanguage(Model metadata, IRI uri, IRI language) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/index/event/MetadataRetrievalUtils.java b/src/main/java/nl/dtls/fairdatapoint/service/index/event/MetadataRetrievalUtils.java
index efcf95d61..5fce7c74d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/index/event/MetadataRetrievalUtils.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/index/event/MetadataRetrievalUtils.java
@@ -30,6 +30,7 @@
import nl.dtls.fairdatapoint.entity.index.http.ExchangeDirection;
import nl.dtls.fairdatapoint.entity.index.http.ExchangeState;
import nl.dtls.fairdatapoint.service.index.entry.IndexEntryService;
+import nl.dtls.fairdatapoint.vocabulary.DCAT3;
import nl.dtls.fairdatapoint.vocabulary.FDP;
import nl.dtls.fairdatapoint.vocabulary.R3D;
import org.eclipse.rdf4j.model.IRI;
@@ -73,7 +74,7 @@ public class MetadataRetrievalUtils {
private static final Map MAPPING = Map.of(
DCTERMS.TITLE, "title",
DCTERMS.DESCRIPTION, "description",
- DCTERMS.HAS_VERSION, "version",
+ DCAT3.VERSION, "version",
DCTERMS.PUBLISHER, "publisher",
R3D.COUNTRY, "country"
);
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java b/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java
index b1e055f88..a44b39791 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java
@@ -35,6 +35,7 @@
import nl.dtls.fairdatapoint.service.schema.MetadataSchemaShaclUtils;
import nl.dtls.fairdatapoint.util.KnownUUIDs;
import nl.dtls.fairdatapoint.vocabulary.DATACITE;
+import nl.dtls.fairdatapoint.vocabulary.DCAT3;
import nl.dtls.fairdatapoint.vocabulary.FDP;
import nl.dtls.fairdatapoint.vocabulary.R3D;
import org.bson.BasicBSONObject;
@@ -450,7 +451,7 @@ public static List repositoryStatements(String persistentUrl, IRI lic
FactoryDefaults.add(s, RDF.TYPE, i("http://www.w3.org/ns/dcat#Resource"), baseUrl);
FactoryDefaults.add(s, DCTERMS.TITLE, l(DEFAULT_FDP_TITLE), baseUrl);
FactoryDefaults.add(s, RDFS.LABEL, l(DEFAULT_FDP_TITLE), baseUrl);
- FactoryDefaults.add(s, DCTERMS.HAS_VERSION, l(1.0f), baseUrl);
+ FactoryDefaults.add(s, DCAT3.VERSION, l(1.0f), baseUrl);
FactoryDefaults.add(s, FDP.METADATAISSUED, l(OffsetDateTime.now()), baseUrl);
FactoryDefaults.add(s, FDP.METADATAMODIFIED, l(OffsetDateTime.now()), baseUrl);
FactoryDefaults.add(s, DCTERMS.LICENSE, license, baseUrl);
@@ -488,7 +489,7 @@ public static List fdpStatements(String persistentUrl, IRI license,
FactoryDefaults.add(s, RDF.TYPE, DCAT.RESOURCE, baseUrl);
FactoryDefaults.add(s, DCTERMS.TITLE, l(DEFAULT_FDP_TITLE), baseUrl);
FactoryDefaults.add(s, RDFS.LABEL, l(DEFAULT_FDP_TITLE), baseUrl);
- FactoryDefaults.add(s, DCTERMS.HAS_VERSION, l(1.0f), baseUrl);
+ FactoryDefaults.add(s, DCAT3.VERSION, l(1.0f), baseUrl);
FactoryDefaults.add(s, FDP.METADATAISSUED, l(OffsetDateTime.now()), baseUrl);
FactoryDefaults.add(s, FDP.METADATAMODIFIED, l(OffsetDateTime.now()), baseUrl);
FactoryDefaults.add(s, DCTERMS.LICENSE, license, baseUrl);
diff --git a/src/main/java/nl/dtls/fairdatapoint/util/KnownUUIDs.java b/src/main/java/nl/dtls/fairdatapoint/util/KnownUUIDs.java
index 4a527b7be..9824653e7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/util/KnownUUIDs.java
+++ b/src/main/java/nl/dtls/fairdatapoint/util/KnownUUIDs.java
@@ -69,6 +69,9 @@ public class KnownUUIDs {
public static final String SCHEMA_V1_RESOURCE_UUID =
"71d77460-f919-4f72-b265-ed26567fe361";
+ public static final String SCHEMA_V2_RESOURCE_UUID =
+ "4c65bdf7-bb56-4bca-ae22-74977b148b16";
+
public static final String SCHEMA_V1_FDP_UUID =
"4e64208d-f102-45a0-96e3-17b002e6213e";
diff --git a/src/main/java/nl/dtls/fairdatapoint/vocabulary/DCAT3.java b/src/main/java/nl/dtls/fairdatapoint/vocabulary/DCAT3.java
new file mode 100644
index 000000000..fa241011e
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/vocabulary/DCAT3.java
@@ -0,0 +1,37 @@
+/**
+ * The MIT License
+ * Copyright © 2017 DTL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package nl.dtls.fairdatapoint.vocabulary;
+
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.vocabulary.DCAT;
+
+import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;
+
+/**
+ * Temporary solution for DCAT3 which currently not supported in RDR4J vocabularies
+ *
+ * @TODO: remove once RDF4J supports DCAT3
+ */
+public class DCAT3 extends DCAT {
+ public static final IRI VERSION = i(NAMESPACE + "version");
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 680fcbcf3..f791ac405 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -64,7 +64,7 @@ metadataProperties:
openapi:
title: FAIR Data Point API
- version: 1.17.0
+ version: 1.17.1
description: "The reference implementation of the metadata registration service: A service implementing the API specification. It contains an authentication system to allow maintainers to define and update metadata. Read-only access to the data is public."
contact:
name: Luiz Bonino
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/shape-resource.ttl
index 2587f288d..bc54d66af 100644
--- a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/shape-resource.ttl
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/schema/data/shape-resource.ttl
@@ -26,7 +26,7 @@
sh:maxCount 1 ;
dash:editor dash:BlankNodeEditor ;
], [
- sh:path dct:hasVersion ;
+ sh:path dcat:version ;
sh:name "version" ;
sh:nodeKind sh:Literal ;
sh:minCount 1 ;
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl
index 7e8c3cc74..e5f5df490 100644
--- a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-resource.ttl
@@ -26,7 +26,7 @@
sh:maxCount 1 ;
dash:editor dash:BlankNodeEditor ;
], [
- sh:path dct:hasVersion ;
+ sh:path dcat:version ;
sh:name "version" ;
sh:nodeKind sh:Literal ;
sh:minCount 1 ;