diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 626dd882e..e06776de9 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -5,3 +5,13 @@ updates:
schedule:
interval: "daily"
target-branch: "develop"
+ labels:
+ - "dependencies"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ target-branch: "develop"
+ labels:
+ - "dependencies"
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e194cbce2..5cd7168f9 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -12,11 +12,13 @@ jobs:
env:
PUBLIC_IMAGE: fairdata/fairdatapoint
PRIVATE_IMAGE: ${{ secrets.PRIVATE_REGISTRY_URL }}/fairdatapoint
+ DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
+ PRIVATE_REGISTRY_URL: ${{ secrets.PRIVATE_REGISTRY_URL }}
TAG_DEVELOP: develop
TAG_LATEST: latest
- JDK_VERSION: 16
- JDK_FILE: openjdk-16.0.1_linux-x64_bin.tar.gz
- JDK_URL: https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz
+ JDK_VERSION: 17
+ JDK_FILE: openjdk-17_linux-x64_bin.tar.gz
+ JDK_URL: https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz
services:
mongo:
@@ -36,13 +38,13 @@ jobs:
# (1) -> Prepare cache and Java
- name: Cache ~/.m2
- uses: actions/cache@v1
+ uses: actions/cache@v2.1.7
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Cache JDK folder
- uses: actions/cache@v1
+ uses: actions/cache@v2.1.7
with:
path: ~/jdk
key: ${{ env.JDK_FILE }}
@@ -56,10 +58,12 @@ jobs:
cp ~/jdk/$JDK_FILE .
- name: Setup Java
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v2.5.0
with:
+ distribution: 'jdkfile'
java-version: ${{ env.JDK_VERSION }}
jdkFile: ${{ env.JDK_FILE }}
+ architecture: x64
- name: Verify Maven and Java
run: |
@@ -88,28 +92,33 @@ jobs:
- name: Docker build
run: |
docker pull $PUBLIC_IMAGE:$TAG_DEVELOP
- docker build --cache-from $PUBLIC_IMAGE:$TAG_DEVELOP -t $PRIVATE_IMAGE:$GITHUB_SHA .
+ docker build --cache-from $PUBLIC_IMAGE:$TAG_DEVELOP -t ${PRIVATE_IMAGE#/}:$GITHUB_SHA .
# (5) -> Docker image tagging
- - name: Docker login
- if: github.event_name == 'push'
+ - name: Docker login (private)
+ if: github.event_name == 'push' && env.PRIVATE_REGISTRY_URL != ''
run: |
- docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD"
docker login -u "$PRIVATE_REGISTRY_USERNAME" -p "$PRIVATE_REGISTRY_PASSWORD" "$PRIVATE_REGISTRY_URL"
env:
- DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
- DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
PRIVATE_REGISTRY_URL: ${{ secrets.PRIVATE_REGISTRY_URL }}
PRIVATE_REGISTRY_USERNAME: ${{ secrets.PRIVATE_REGISTRY_USERNAME }}
PRIVATE_REGISTRY_PASSWORD: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }}
+ - name: Docker login (public)
+ if: github.event_name == 'push' && env.DOCKER_HUB_USERNAME != ''
+ run: |
+ docker login -u "$DOCKER_HUB_USERNAME" -p "$DOCKER_HUB_PASSWORD"
+ env:
+ DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
+ DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
+
- name: Docker push - commit SHA (private)
- if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
+ if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') && env.PRIVATE_REGISTRY_URL != ''
run: |
docker push $PRIVATE_IMAGE:$GITHUB_SHA
- name: Docker tag and push - branch (private)
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && !contains(github.ref, 'release')
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && !contains(github.ref, 'release') && env.PRIVATE_REGISTRY_URL != ''
run: |
GITHUB_BRANCH=`echo $GITHUB_REF | cut -d/ -f3- | sed 's#/#-#g'`
docker image tag $PRIVATE_IMAGE:$GITHUB_SHA $PRIVATE_IMAGE:$GITHUB_BRANCH
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 877ae9f54..a7040a071 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,24 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+## [1.13.0]
+
+### Added
+
+- Profile resources contain `rdfs:label` with Shape name
+
+### Changed
+
+- Replaced `**` wildcards with safer pattern
+- Added restriction to URL prefixes of Resource Definitions (`[a-zA-Z_-]*`)
+- Upgrade Java JDK from 16 to 17
+- Updated SpringDoc OpenAPI UI and several other dependencies
+- Compliance with FDP-O ontology (`fdp-o:FAIRDataPoint`)
+
+### Fixed
+
+- Missing `xsd` prefix in some default shapes
+
## [1.12.4]
### Changed
@@ -268,3 +286,4 @@ The first release of reference FAIR Data Point implementation.
[1.12.2]: /../../tree/v1.12.2
[1.12.3]: /../../tree/v1.12.3
[1.12.4]: /../../tree/v1.12.4
+[1.13.0]: /../../tree/v1.13.0
diff --git a/Dockerfile b/Dockerfile
index f710ae55d..286e22579 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,7 +21,7 @@
# THE SOFTWARE.
#
-FROM openjdk:16-jdk-slim
+FROM openjdk:17-jdk-slim
WORKDIR /fdp
diff --git a/Dockerfile.build b/Dockerfile.build
index 10521f7d6..d65fd5646 100644
--- a/Dockerfile.build
+++ b/Dockerfile.build
@@ -22,7 +22,7 @@
#
################################################################################
# BUILD STAGE
-FROM maven:3-openjdk-16 as builder
+FROM maven:3-openjdk-17-slim as builder
WORKDIR /builder
@@ -32,7 +32,7 @@ RUN mvn --quiet -B -U --fail-fast -DskipTests package
################################################################################
# RUN STAGE
-FROM openjdk:16-jdk-slim
+FROM openjdk:17-jdk-slim
WORKDIR /fdp
diff --git a/README.md b/README.md
index 64f208c73..44066b536 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ the [FAIR Data Point software specification](https://specs.fairdatapoint.org) do
## Usage
More information about FDP, how to deploy it and use it can be found in
-the [FDP Deployment Documentation](https://fairdatapoint.readthedocs.io/).
+the [FDP Deployment and REST API usage Documentation](https://fairdatapoint.readthedocs.io/).
## Related GitHub Projects
@@ -33,16 +33,16 @@ details of API calls can be found there. It also allows trying out API calls dir
document please visit the following url via web
browser [localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html) (for local deployment)
or `https://your.domain.tld/swagger-ui.html` for your deployment (
-e.g. [app.fairdatapoint.org/swagger-ui.html](https://app.fairdatapoint.org/swagger-ui.html)).
+e.g. [app.fairdatapoint.org/swagger-ui.html](https://app.fairdatapoint.org/swagger-ui.html)). More detailed descriptions and examples of these API calls is available in the [Deployment and Usage instructions](https://fairdatapoint.readthedocs.io/)
## Development
### Technology Stack
-- **Java** (JDK 16)
+- **Java** (JDK 17)
- **MongoDB** (4.2)
- **Maven** (3.2.5 or higher)
-- **Docker** (17.09.0-ce or higher) - *for building Docker image only*
+- **Docker** (19.03.0-ce or higher) - *for building Docker image only*
### Build & Run
@@ -114,8 +114,7 @@ documentation.
## Contributing
We maintain a [CHANGELOG](CHANGELOG.md), you should also take a look at our [Contributing guidelines](CONTRIBUTING.md)
-and
-[Code of Conduct](CODE_OF_CONDUCT.md).
+and [Code of Conduct](CODE_OF_CONDUCT.md).
## License
diff --git a/pom.xml b/pom.xml
index 10260ef2a..a27c2da15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,12 +5,12 @@
org.springframework.boot
spring-boot-starter-parent
- 2.5.3
+ 2.6.3
nl.dtls
fairdatapoint
- 1.12.4
+ 1.13.0
jar
FairDataPoint
@@ -47,22 +47,21 @@
UTF-8
- 16
- 16
+ 17
+ 17
1.1.0.RELEASE
5.2.4.RELEASE
- 1.5.2
- 4.3.8
- 4.2.3
- 3.2.3
- 3.7.2
+ 1.6.5
+ 5.0.35
+ 3.3.1
+ 3.7.4
1.4.9
0.11.2
- 1.18.20
+ 1.18.22
0.1.2-SNAPSHOT
2.17.1
@@ -105,7 +104,7 @@
- com.github.cloudyrock.mongock
+ io.mongock
mongock-bom
${mongock.version}
pom
@@ -180,18 +179,13 @@
- com.github.cloudyrock.mongock
- mongock-spring-v5
+ io.mongock
+ mongock-springboot
- com.github.cloudyrock.mongock
+ io.mongock
mongodb-springdata-v3-driver
-
- org.mongodb
- mongodb-driver-sync
- ${mongodb.driver-sync.version}
-
org.springframework.data
spring-data-mongodb
@@ -417,8 +411,8 @@
https://raw.githubusercontent.com/re3data/ontology/master/r3dOntology.ttl
- https://raw.githubusercontent.com/DTL-FAIRData/FDP-O/develop/fdp-ontology.owl
- http://rdf.biosemantics.org/ontologies/fdp-o#
+ https://raw.githubusercontent.com/FAIRDataTeam/FDP-O/v1.1/fdp-ontology.owl
+ https://w3id.org/fdp/fdp-o#
fdp
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
index 3eaa1a361..8ace07af6 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/dashboard/DashboardController.java
@@ -58,8 +58,8 @@ public class DashboardController {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity> getDashboard(HttpServletRequest request) throws MetadataServiceException {
IRI uri = i(getRequestURL(request, persistentUrl));
- IRI repositoryUri = removeLastPartOfIRI(uri);
- List dto = dashboardService.getDashboard(repositoryUri);
+ IRI fdpUri = removeLastPartOfIRI(uri);
+ List dto = dashboardService.getDashboard(fdpUri);
return new ResponseEntity<>(dto, HttpStatus.OK);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
index b54fd6542..55e8cee6c 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericController.java
@@ -38,7 +38,6 @@
import nl.dtls.fairdatapoint.service.metadata.exception.MetadataServiceException;
import nl.dtls.fairdatapoint.service.metadata.factory.MetadataServiceFactory;
import nl.dtls.fairdatapoint.service.metadata.state.MetadataStateService;
-import nl.dtls.fairdatapoint.service.openapi.OpenApiService;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionService;
import nl.dtls.fairdatapoint.service.shape.ShapeService;
import nl.dtls.fairdatapoint.service.user.CurrentUserService;
@@ -55,11 +54,11 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletRequest;
import java.net.URI;
import java.util.LinkedList;
import java.util.Optional;
+import static java.lang.String.format;
import static java.util.stream.Collectors.toList;
import static nl.dtls.fairdatapoint.util.HttpUtil.*;
import static nl.dtls.fairdatapoint.util.RdfIOUtil.changeBaseUri;
@@ -98,27 +97,32 @@ public class GenericController {
private GenericMetadataRepository metadataRepository;
@Operation(hidden = true)
- @GetMapping(path = "**/spec", produces = {"!application/json"})
- public Model getFormMetadata() {
+ @GetMapping(path = {"/spec", "{oUrlPrefix:[^.]+}/spec"}, produces = {"!application/json"})
+ public Model getFormMetadata(
+ @PathVariable final Optional oUrlPrefix
+ ) {
return shapeService.getShaclFromShapes();
}
@Operation(hidden = true, deprecated = true)
- @GetMapping(path = "**/expanded", produces = {"!application/json"})
- public Model getMetaDataExpanded(HttpServletRequest request) throws MetadataServiceException {
+ @GetMapping(path = {"/expanded", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}/expanded"}, produces = {"!application/json"})
+ public Model getMetaDataExpanded(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId
+ ) throws MetadataServiceException {
// 1. Init
- String uri = getRequestURL(request, persistentUrl);
Model resultRdf = new LinkedHashModel();
- String urlPrefix = getResourceNameForDetail(uri);
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 2. Get entity
- IRI entityUri = i(getRequestURL(request, persistentUrl));
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model entity = metadataService.retrieve(entityUri);
resultRdf.addAll(entity);
- // 3. Check if it is draft
+ // 3. Check if it is DRAFT
Metadata state = metadataStateService.get(entityUri);
Optional oCurrentUser = currentUserService.getCurrentUser();
if (state.getState().equals(MetadataState.DRAFT) && oCurrentUser.isEmpty()) {
@@ -145,19 +149,22 @@ public Model getMetaDataExpanded(HttpServletRequest request) throws MetadataServ
}
@Operation(hidden = true)
- @GetMapping(path = "**", produces = {"!application/json"})
- public Model getMetaData(HttpServletRequest request) throws MetadataServiceException {
+ @GetMapping(path = {"", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}"}, produces = {"!application/json"})
+ public Model getMetaData(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId
+ ) throws MetadataServiceException {
// 1. Init
- String uri = getRequestURL(request, persistentUrl);
Model resultRdf = new LinkedHashModel();
- String urlPrefix = getResourceNameForDetail(uri);
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get resource definition
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 3. Get entity
- IRI entityUri = i(getRequestURL(request, persistentUrl));
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model entity = metadataService.retrieve(entityUri);
resultRdf.addAll(entity);
@@ -188,11 +195,12 @@ public Model getMetaData(HttpServletRequest request) throws MetadataServiceExcep
}
@Operation(hidden = true)
- @PostMapping(path = "**", produces = {"!application/json"})
- public ResponseEntity storeMetaData(HttpServletRequest request,
- @RequestBody String reqBody,
- @RequestHeader(value = "Content-Type", required = false) String contentType)
- throws MetadataServiceException {
+ @PostMapping(path = "{urlPrefix:[^.]+}", produces = {"!application/json"})
+ public ResponseEntity storeMetaData(
+ @PathVariable final String urlPrefix,
+ @RequestBody String reqBody,
+ @RequestHeader(value = "Content-Type", required = false) String contentType
+ ) throws MetadataServiceException {
// 1. Check if user is authenticated
// - it can't be in SecurityConfig because the authentication is done based on content-type
Optional oUser = currentUserService.getCurrentUser();
@@ -201,12 +209,12 @@ public ResponseEntity storeMetaData(HttpServletRequest request,
}
// 2. Init
- String urlPrefix = getResourceNameForList(getRequestURL(request, persistentUrl));
+ //String urlPrefix = getResourceNameForList(getRequestURL(request, persistentUrl));
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 3. Generate URI
- IRI uri = generateNewIRI(request, persistentUrl);
+ IRI uri = generateNewMetadataIRI(persistentUrl, urlPrefix);
// 4. Parse reqDto
RDFFormat rdfContentType = getRdfContentType(contentType);
@@ -226,18 +234,21 @@ public ResponseEntity storeMetaData(HttpServletRequest request,
}
@Operation(hidden = true)
- @PutMapping(path = "**", produces = {"!application/json"})
- public ResponseEntity updateMetaData(HttpServletRequest request,
- @RequestBody String reqBody,
- @RequestHeader(value = "Content-Type", required = false) String contentType)
- throws MetadataServiceException {
+ @PutMapping(path = {"", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}"}, produces = {"!application/json"})
+ public ResponseEntity updateMetaData(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId,
+ @RequestBody String reqBody,
+ @RequestHeader(value = "Content-Type", required = false) String contentType
+ ) throws MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForDetail(getRequestURL(request, persistentUrl));
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 2. Extract URI
- IRI uri = i(getRequestURL(request, persistentUrl));
+ IRI uri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
// 3. Parse reqDto
RDFFormat rdfContentType = getRdfContentType(contentType);
@@ -258,21 +269,24 @@ public ResponseEntity updateMetaData(HttpServletRequest request,
}
@Operation(hidden = true)
- @DeleteMapping(path = "**")
+ @DeleteMapping(path = "{urlPrefix:[^.]+}/{recordId:[^.]+}")
@ResponseStatus(HttpStatus.NO_CONTENT)
- public ResponseEntity deleteMetadata(HttpServletRequest request) throws MetadataServiceException {
+ public ResponseEntity deleteMetadata(
+ @PathVariable final String urlPrefix,
+ @PathVariable final String recordId
+ ) throws MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForDetail(getRequestURL(request, persistentUrl));
+ //String urlPrefix = getResourceNameForDetail(getRequestURL(request, persistentUrl));
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 2. Skip if Repository (we don't support delete for repository)
- if (rd.getName().equals("Repository")) {
+ if (rd.isRoot()) {
return ResponseEntity.notFound().build();
}
// 3. Extract URI
- IRI uri = i(getRequestURL(request, persistentUrl));
+ IRI uri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
// 4. Store metadata
metadataService.delete(uri, rd);
@@ -282,21 +296,22 @@ public ResponseEntity deleteMetadata(HttpServletRequest request) throws Me
}
@Operation(hidden = true)
- @GetMapping(path = "**/page/{childPrefix}", produces = {"!application/json"})
+ @GetMapping(path = {"page/{childPrefix}", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}/page/{childPrefix}"}, produces = {"!application/json"})
public ResponseEntity getMetaDataChildren(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId,
@PathVariable final String childPrefix,
@RequestParam(defaultValue = "0") final int page,
- @RequestParam(defaultValue = "10") final int size,
- HttpServletRequest request
+ @RequestParam(defaultValue = "10") final int size
) throws MetadataServiceException, MetadataRepositoryException {
// 1. Init
- String requestUrl = getRequestURL(request, persistentUrl);
Model resultRdf = new LinkedHashModel();
- String urlPrefix = getResourceNameForChild(requestUrl);
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get entity
- IRI entityUri = getEntityIriForPagination(requestUrl);
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model entity = metadataService.retrieve(entityUri);
// 3. Check if it is draft
@@ -343,7 +358,7 @@ public ResponseEntity getMetaDataChildren(
// 4.4 Set Link headers and send response
HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set("Link", createLinkHeader(requestUrl, childrenCount, page, size));
+ responseHeaders.set("Link", createLinkHeader(entityUri.stringValue(), childPrefix, childrenCount, page, size));
return ResponseEntity.ok().headers(responseHeaders).body(resultRdf);
}
}
@@ -352,31 +367,6 @@ public ResponseEntity getMetaDataChildren(
return ResponseEntity.ok(resultRdf);
}
- private String getResourceNameForList(String url) {
- url = url.replace(persistentUrl, "");
-
- String[] parts = url.split("/");
- if (parts.length != 2) {
- throw new ValidationException("Unsupported URL");
- }
- return parts[1];
- }
-
- private String getResourceNameForDetail(String url) {
- url = url.replace(persistentUrl, "");
-
- // If URL is a repository -> return empty string
- if (url.equals("")) {
- return "";
- }
-
- String[] parts = url.split("/");
- if (parts.length != 3) {
- throw new ValidationException("Unsupported URL");
- }
- return parts[1];
- }
-
private String getResourceNameForChild(String url) {
url = url.replace(persistentUrl, "");
String[] parts = url.split("/");
@@ -393,30 +383,19 @@ private String getResourceNameForChild(String url) {
return parts[1];
}
- private IRI getEntityIriForPagination(String url) {
- String[] parts = url.split("/");
-
- StringBuilder sb = new StringBuilder(parts[0]);
- for (int i = 1; i < parts.length - 2; i++) {
- sb.append("/");
- sb.append(parts[i]);
- }
- return i(sb.toString());
- }
-
- private String createLinkHeader(String requestUrl, int childrenCount, int page, int size) {
+ private String createLinkHeader(String entityUrl, String childPrefix, int childrenCount, int page, int size) {
var links = new LinkedList();
var lastPage = (int) Math.ceil((float) childrenCount / size) - 1;
- links.add(createLink(requestUrl, 0, size, "first"));
- links.add(createLink(requestUrl, lastPage, size, "last"));
+ links.add(createLink(entityUrl, childPrefix, 0, size, "first"));
+ links.add(createLink(entityUrl, childPrefix, lastPage, size, "last"));
if (page > 0 && page <= lastPage) {
- links.add(createLink(requestUrl, page - 1, size, "prev"));
+ links.add(createLink(entityUrl, childPrefix, page - 1, size, "prev"));
}
if (page < lastPage && page >= 0) {
- links.add(createLink(requestUrl, page + 1, size, "next"));
+ links.add(createLink(entityUrl, childPrefix, page + 1, size, "next"));
}
return String.join(", ", links);
@@ -431,7 +410,7 @@ private Optional retrieveChildModel(MetadataService childMetadataService,
}
}
- private String createLink(String requestUrl, int page, int size, String rel) {
- return "<" + requestUrl + "/?page=" + page + "&size=" + size + ">; rel=\"" + rel + "\"";
+ private String createLink(String entityUrl, String childPrefix, int page, int size, String rel) {
+ return format("<%s/page/%s?page=%d&size=%d>; rel=\"%s\"", entityUrl, childPrefix, page, size, rel);
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
index 0d6edb289..99e8f357c 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMemberController.java
@@ -41,14 +41,11 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getMetadataIdentifier;
-import static nl.dtls.fairdatapoint.util.HttpUtil.getRequestURL;
-import static nl.dtls.fairdatapoint.util.RdfUtil.removeLastPartOfIRI;
-import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;
+import static nl.dtls.fairdatapoint.util.HttpUtil.getMetadataIRI;
@Tag(name = "Authentication and Authorization")
@RestController
@@ -65,16 +62,16 @@ public class GenericMemberController {
private MetadataServiceFactory metadataServiceFactory;
@Operation(hidden = true)
- @GetMapping(path = "**/members", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity> getMembers(HttpServletRequest request)
- throws ResourceNotFoundException, MetadataServiceException {
+ @GetMapping(path = "{urlPrefix:[^.]+}/{recordId:[^.]+}/members", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity> getMembers(
+ @PathVariable final String urlPrefix,
+ @PathVariable final String recordId
+ ) throws ResourceNotFoundException, MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForList(getRequestURL(request, persistentUrl));
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get and check existence entity
- IRI uri = i(getRequestURL(request, persistentUrl));
- IRI entityUri = removeLastPartOfIRI(uri);
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model metadata = metadataService.retrieve(entityUri);
// 3. Get members
@@ -84,18 +81,18 @@ public ResponseEntity> getMembers(HttpServletRequest request)
}
@Operation(hidden = true)
- @PutMapping(path = "**/members/{userUuid}", produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity putMember(@PathVariable final String userUuid,
- HttpServletRequest request,
- @RequestBody @Valid MemberCreateDTO reqBody)
- throws MetadataServiceException {
+ @PutMapping(path = "{urlPrefix:[^.]+}/{recordId:[^.]+}/members/{userUuid}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity putMember(
+ @PathVariable final String urlPrefix,
+ @PathVariable final String recordId,
+ @PathVariable final String userUuid,
+ @RequestBody @Valid MemberCreateDTO reqBody
+ ) throws MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForDetail(getRequestURL(request, persistentUrl));
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get and check existence entity
- IRI uri = i(getRequestURL(request, persistentUrl));
- IRI entityUri = removeLastPartOfIRI(removeLastPartOfIRI(uri));
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model metadata = metadataService.retrieve(entityUri);
// 3. Create / Update member
@@ -106,17 +103,18 @@ public ResponseEntity putMember(@PathVariable final String userUuid,
}
@Operation(hidden = true)
- @DeleteMapping(path = "**/members/{userUuid}")
+ @DeleteMapping(path = "{urlPrefix:[^.]+}/{recordId:[^.]+}/members/{userUuid}")
@ResponseStatus(HttpStatus.NO_CONTENT)
- public ResponseEntity deleteMember(@PathVariable final String userUuid, HttpServletRequest request)
- throws ResourceNotFoundException, MetadataServiceException {
+ public ResponseEntity deleteMember(
+ @PathVariable final String urlPrefix,
+ @PathVariable final String recordId,
+ @PathVariable final String userUuid
+ ) throws ResourceNotFoundException, MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForDetail(getRequestURL(request, persistentUrl));
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get and check existence entity
- IRI uri = i(getRequestURL(request, persistentUrl));
- IRI entityUri = removeLastPartOfIRI(removeLastPartOfIRI(uri));
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model metadata = metadataService.retrieve(entityUri);
// 3. Delete member
@@ -124,24 +122,4 @@ public ResponseEntity deleteMember(@PathVariable final String userUuid, Ht
memberService.deleteMember(entityId, Metadata.class, userUuid);
return ResponseEntity.noContent().build();
}
-
- private String getResourceNameForList(String url) throws MetadataServiceException {
- url = url.replace(persistentUrl, "");
-
- String[] parts = url.split("/");
- if (!(parts.length == 2 || parts.length == 4)) {
- throw new MetadataServiceException("Unsupported URL");
- }
- return parts[1];
- }
-
- private String getResourceNameForDetail(String url) throws MetadataServiceException {
- url = url.replace(persistentUrl, "");
-
- String[] parts = url.split("/");
- if (parts.length != 5) {
- throw new MetadataServiceException("Unsupported URL");
- }
- return parts[parts.length - 4];
- }
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
index 64ffa7cf6..e730a3cef 100644
--- a/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
+++ b/src/main/java/nl/dtls/fairdatapoint/api/controller/metadata/GenericMetaController.java
@@ -42,21 +42,16 @@
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Optional;
import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getMetadataIdentifier;
import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getTitle;
-import static nl.dtls.fairdatapoint.util.HttpUtil.getRequestURL;
+import static nl.dtls.fairdatapoint.util.HttpUtil.getMetadataIRI;
import static nl.dtls.fairdatapoint.util.RdfUtil.getStringObjectBy;
-import static nl.dtls.fairdatapoint.util.RdfUtil.removeLastPartOfIRI;
import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;
@Tag(name = "Metadata")
@@ -80,18 +75,21 @@ public class GenericMetaController {
private ResourceDefinitionService resourceDefinitionService;
@Operation(hidden = true)
- @RequestMapping(path = "**/meta", method = RequestMethod.GET)
- public MetaDTO getMeta(HttpServletRequest request) throws MetadataServiceException {
+ @GetMapping(path = {"meta", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}/meta"})
+ public MetaDTO getMeta(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId
+ ) throws MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForList(getRequestURL(request, persistentUrl));
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get resource definition
ResourceDefinition rd = resourceDefinitionService.getByUrlPrefix(urlPrefix);
// 3. Get and check existence entity
- IRI uri = i(getRequestURL(request, persistentUrl));
- IRI entityUri = removeLastPartOfIRI(uri);
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model entity = metadataService.retrieve(entityUri);
// 4. Get member
@@ -124,15 +122,19 @@ public MetaDTO getMeta(HttpServletRequest request) throws MetadataServiceExcepti
}
@Operation(hidden = true)
- @RequestMapping(path = "**/meta/state", method = RequestMethod.PUT)
- public MetaStateChangeDTO putMetaState(HttpServletRequest request, @RequestBody @Valid MetaStateChangeDTO reqDto) throws MetadataServiceException {
+ @PutMapping(path = {"meta/state", "{oUrlPrefix:[^.]+}/{oRecordId:[^.]+}/meta/state"})
+ public MetaStateChangeDTO putMetaState(
+ @PathVariable final Optional oUrlPrefix,
+ @PathVariable final Optional oRecordId,
+ @RequestBody @Valid MetaStateChangeDTO reqDto
+ ) throws MetadataServiceException {
// 1. Init
- String urlPrefix = getResourceNameForList(getRequestURL(request, persistentUrl));
+ String urlPrefix = oUrlPrefix.orElse("");
+ String recordId = oRecordId.orElse("");
MetadataService metadataService = metadataServiceFactory.getMetadataServiceByUrlPrefix(urlPrefix);
// 2. Get and check existence entity
- IRI uri = i(getRequestURL(request, persistentUrl));
- IRI entityUri = removeLastPartOfIRI(removeLastPartOfIRI(uri));
+ IRI entityUri = getMetadataIRI(persistentUrl, urlPrefix, recordId);
Model model = metadataService.retrieve(entityUri);
// 3. Get state
diff --git a/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java b/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java
index 934890d77..13fa92254 100644
--- a/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java
+++ b/src/main/java/nl/dtls/fairdatapoint/config/MongoConfig.java
@@ -22,9 +22,10 @@
*/
package nl.dtls.fairdatapoint.config;
-import com.github.cloudyrock.mongock.config.LegacyMigration;
-import com.github.cloudyrock.mongock.driver.mongodb.springdata.v3.SpringDataMongoV3Driver;
-import com.github.cloudyrock.spring.v5.MongockSpring5;
+import io.mongock.api.config.LegacyMigration;
+import io.mongock.driver.mongodb.springdata.v3.SpringDataMongoV3Driver;
+import io.mongock.runner.springboot.MongockSpringboot;
+import io.mongock.runner.springboot.base.MongockInitializingBeanRunner;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,16 +48,16 @@ public class MongoConfig {
private ResourceDefinitionTargetClassesCache targetClassesCache;
@Bean("mongockRunner")
- public MongockSpring5.MongockApplicationRunner mongockApplicationRunner(
+ public MongockInitializingBeanRunner mongockApplicationRunner(
ApplicationContext springContext,
MongoTemplate mongoTemplate) {
- return MongockSpring5.builder()
+ return MongockSpringboot.builder()
.setDriver(SpringDataMongoV3Driver.withDefaultLock(mongoTemplate))
- .addChangeLogsScanPackage("nl.dtls.fairdatapoint.database.mongo.migration.production")
+ .addMigrationScanPackage("nl.dtls.fairdatapoint.database.mongo.migration.production")
.setSpringContext(springContext)
.setLegacyMigration(new LegacyMigration("dbchangelog"))
.addDependency(ResourceDefinitionCache.class, resourceDefinitionCache)
.addDependency(ResourceDefinitionTargetClassesCache.class, targetClassesCache)
- .buildApplicationRunner();
+ .buildInitializingBeanRunner();
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/config/WebConfig.java b/src/main/java/nl/dtls/fairdatapoint/config/WebConfig.java
index 3a985c09b..4d798ff9d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/config/WebConfig.java
+++ b/src/main/java/nl/dtls/fairdatapoint/config/WebConfig.java
@@ -72,15 +72,6 @@ public void configureContentNegotiation(ContentNegotiationConfigurer configurer)
configurer.favorParameter(true);
}
- @Override
- public void addResourceHandlers(final ResourceHandlerRegistry registry) {
- // Swagger
- registry.setOrder(Integer.MIN_VALUE + 1).addResourceHandler("/webjars/**")
- .addResourceLocations(CLASSPATH_RESOURCE_LOCATION+"/webjars/")
- .resourceChain(true)
- .addResolver(new WebJarsResourceResolver());
- }
-
@Bean
@Primary
public ObjectMapper objectMapper() {
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/common/migration/Migration.java b/src/main/java/nl/dtls/fairdatapoint/database/common/migration/Migration.java
index 5246c0895..f88a946cb 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/common/migration/Migration.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/common/migration/Migration.java
@@ -24,6 +24,6 @@
public interface Migration {
- void runMigration();
+ void runMigration() throws Exception;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/MigrationRunner.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/MigrationRunner.java
index e816fea38..b7366e762 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/MigrationRunner.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/MigrationRunner.java
@@ -32,6 +32,8 @@
import nl.dtls.fairdatapoint.database.mongo.migration.development.resource.ResourceDefinitionMigration;
import nl.dtls.fairdatapoint.database.mongo.migration.development.shape.ShapeMigration;
import nl.dtls.fairdatapoint.database.mongo.migration.development.user.UserMigration;
+import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
+import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
@@ -69,6 +71,12 @@ public class MigrationRunner {
@Autowired
private EventMigration eventMigration;
+ @Autowired
+ private ResourceDefinitionTargetClassesCache resourceDefinitionTargetClassesCache;
+
+ @Autowired
+ private ResourceDefinitionCache resourceDefinitionCache;
+
@PostConstruct
public void run() {
userMigration.runMigration();
@@ -80,6 +88,8 @@ public void run() {
metadataMigration.runMigration();
indexEntryMigration.runMigration();
eventMigration.runMigration();
+ resourceDefinitionTargetClassesCache.computeCache();
+ resourceDefinitionCache.computeCache();
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/membership/data/MembershipFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/membership/data/MembershipFixtures.java
index 726dfc004..fdb953484 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/membership/data/MembershipFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/membership/data/MembershipFixtures.java
@@ -25,6 +25,7 @@
import nl.dtls.fairdatapoint.database.mongo.migration.development.resource.data.ResourceDefinitionFixtures;
import nl.dtls.fairdatapoint.entity.membership.Membership;
import nl.dtls.fairdatapoint.entity.membership.MembershipPermission;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -40,7 +41,7 @@ public class MembershipFixtures {
public Membership owner() {
return new Membership(
- "49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8",
+ KnownUUIDs.MEMBERSHIP_OWNER_UUID,
"Owner",
new ArrayList<>() {{
add(WRITE);
@@ -49,22 +50,22 @@ public Membership owner() {
add(ADMINISTRATION);
}},
new ArrayList<>() {{
- add(ResourceDefinitionFixtures.CATALOG_DEFINITION_UUID);
- add(ResourceDefinitionFixtures.DATASET_DEFINITION_UUID);
- add(ResourceDefinitionFixtures.DISTRIBUTION_DEFINITION_UUID);
+ add(KnownUUIDs.RD_CATALOG_UUID);
+ add(KnownUUIDs.RD_DATASET_UUID);
+ add(KnownUUIDs.RD_DISTRIBUTION_UUID);
}}
);
}
public Membership dataProvider() {
return new Membership(
- "87a2d984-7db2-43f6-805c-6b0040afead5",
+ KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID,
"Data Provider",
new ArrayList<>() {{
add(CREATE);
}},
new ArrayList<>() {{
- add(ResourceDefinitionFixtures.CATALOG_DEFINITION_UUID);
+ add(KnownUUIDs.RD_CATALOG_UUID);
}}
);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/metadata/data/MetadataFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/metadata/data/MetadataFixtures.java
index 823318d20..dff6f4e15 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/metadata/data/MetadataFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/metadata/data/MetadataFixtures.java
@@ -35,7 +35,7 @@ public class MetadataFixtures {
@Qualifier("persistentUrl")
private String persistentUrl;
- public Metadata repositoryMetadata() {
+ public Metadata fdpMetadata() {
return
new Metadata(
null,
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/ResourceDefinitionMigration.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/ResourceDefinitionMigration.java
index 3ed4b6f89..f6064d07d 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/ResourceDefinitionMigration.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/ResourceDefinitionMigration.java
@@ -45,7 +45,7 @@ public class ResourceDefinitionMigration implements Migration {
public void runMigration() {
resourceDefinitionRepository.deleteAll();
- ResourceDefinition repositoryDef = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition repositoryDef = resourceDefinitionFixtures.fdpDefinition();
resourceDefinitionRepository.save(repositoryDef);
ResourceDefinition catalogDef = resourceDefinitionFixtures.catalogDefinition();
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/data/ResourceDefinitionFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/data/ResourceDefinitionFixtures.java
index b0644ba0e..8a17f5839 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/data/ResourceDefinitionFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/resource/data/ResourceDefinitionFixtures.java
@@ -22,9 +22,9 @@
*/
package nl.dtls.fairdatapoint.database.mongo.migration.development.resource.data;
-import nl.dtls.fairdatapoint.database.mongo.migration.development.shape.data.ShapeFixtures;
import nl.dtls.fairdatapoint.entity.resource.*;
-import nl.dtls.fairdatapoint.vocabulary.R3D;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
+import nl.dtls.fairdatapoint.vocabulary.FDP;
import org.eclipse.rdf4j.model.vocabulary.DCAT;
import org.springframework.stereotype.Service;
@@ -33,28 +33,24 @@
@Service
public class ResourceDefinitionFixtures {
- public static String REPOSITORY_DEFINITION_UUID = "77aaad6a-0136-4c6e-88b9-07ffccd0ee4c";
-
- public static String CATALOG_DEFINITION_UUID = "a0949e72-4466-4d53-8900-9436d1049a4b";
-
- public static String DATASET_DEFINITION_UUID = "2f08228e-1789-40f8-84cd-28e3288c3604";
-
- public static String DISTRIBUTION_DEFINITION_UUID = "02c649de-c579-43bb-b470-306abdc808c7";
-
public static String ONTOLOGY_DEFINITION_UUID = "4bc19f45-845d-48d6-ade7-ac2664563f60";
- public ResourceDefinition repositoryDefinition() {
+ public ResourceDefinition fdpDefinition() {
return new ResourceDefinition(
- REPOSITORY_DEFINITION_UUID,
- "Repository",
+ KnownUUIDs.RD_FDP_UUID,
+ "FAIR Data Point",
"",
- List.of(ShapeFixtures.RESOURCE_SHAPE_UUID, ShapeFixtures.REPOSITORY_SHAPE_UUID),
+ List.of(KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_DATASERVICE_UUID,
+ KnownUUIDs.SHAPE_METADATASERVICE_UUID,
+ KnownUUIDs.SHAPE_FDP_UUID
+ ),
List.of(new ResourceDefinitionChild(
- CATALOG_DEFINITION_UUID,
- R3D.DATACATALOG.stringValue(),
+ KnownUUIDs.RD_CATALOG_UUID,
+ FDP.METADATACATALOG.stringValue(),
new ResourceDefinitionChildListView(
"Catalogs",
- "http://www.w3.org/ns/dcat#themeTaxonomy",
+ DCAT.THEME_TAXONOMY.stringValue(),
List.of()
)
)),
@@ -64,16 +60,16 @@ public ResourceDefinition repositoryDefinition() {
public ResourceDefinition catalogDefinition() {
return new ResourceDefinition(
- CATALOG_DEFINITION_UUID,
+ KnownUUIDs.RD_CATALOG_UUID,
"Catalog",
"catalog",
- List.of(ShapeFixtures.RESOURCE_SHAPE_UUID, ShapeFixtures.CATALOG_SHAPE_UUID),
+ List.of(KnownUUIDs.SHAPE_RESOURCE_UUID, KnownUUIDs.SHAPE_CATALOG_UUID),
List.of(new ResourceDefinitionChild(
- DATASET_DEFINITION_UUID,
+ KnownUUIDs.RD_DATASET_UUID,
DCAT.HAS_DATASET.stringValue(),
new ResourceDefinitionChildListView(
"Datasets",
- "http://www.w3.org/ns/dcat#theme",
+ DCAT.THEME.stringValue(),
List.of()
)
)),
@@ -83,17 +79,17 @@ public ResourceDefinition catalogDefinition() {
public ResourceDefinition datasetDefinition() {
return new ResourceDefinition(
- DATASET_DEFINITION_UUID,
+ KnownUUIDs.RD_DATASET_UUID,
"Dataset",
"dataset",
- List.of(ShapeFixtures.RESOURCE_SHAPE_UUID, ShapeFixtures.DATASET_SHAPE_UUID),
+ List.of(KnownUUIDs.SHAPE_RESOURCE_UUID, KnownUUIDs.SHAPE_DATASET_UUID),
List.of(new ResourceDefinitionChild(
- DISTRIBUTION_DEFINITION_UUID,
+ KnownUUIDs.RD_DISTRIBUTION_UUID,
DCAT.HAS_DISTRIBUTION.stringValue(),
new ResourceDefinitionChildListView("Distributions", null, List.of(
new ResourceDefinitionChildListViewMetadata(
"Media Type",
- "http://www.w3.org/ns/dcat#mediaType"
+ DCAT.MEDIA_TYPE.stringValue()
)
))
)),
@@ -103,14 +99,14 @@ public ResourceDefinition datasetDefinition() {
public ResourceDefinition distributionDefinition() {
return new ResourceDefinition(
- DISTRIBUTION_DEFINITION_UUID,
+ KnownUUIDs.RD_DISTRIBUTION_UUID,
"Distribution",
"distribution",
- List.of(ShapeFixtures.RESOURCE_SHAPE_UUID, ShapeFixtures.DISTRIBUTION_SHAPE_UUID),
+ List.of(KnownUUIDs.SHAPE_RESOURCE_UUID, KnownUUIDs.SHAPE_DISTRIBUTION_UUID),
List.of(),
List.of(
- new ResourceDefinitionLink("Access online", "http://www.w3.org/ns/dcat#accessURL"),
- new ResourceDefinitionLink("Download", "http://www.w3.org/ns/dcat#downloadURL")
+ new ResourceDefinitionLink("Access online", DCAT.ACCESS_URL.stringValue()),
+ new ResourceDefinitionLink("Download", DCAT.DOWNLOAD_URL.stringValue())
)
);
}
@@ -120,7 +116,7 @@ public ResourceDefinition ontologyDefinition() {
ONTOLOGY_DEFINITION_UUID,
"Ontology",
"ontology",
- List.of(ShapeFixtures.RESOURCE_SHAPE_UUID),
+ List.of(KnownUUIDs.SHAPE_RESOURCE_UUID),
List.of(),
List.of()
);
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/ShapeMigration.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/ShapeMigration.java
index 6c8c182f9..223034160 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/ShapeMigration.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/ShapeMigration.java
@@ -40,7 +40,9 @@ public class ShapeMigration implements Migration {
public void runMigration() {
shapeRepository.deleteAll();
shapeRepository.save(shapeFixtures.resourceShape());
- shapeRepository.save(shapeFixtures.repositoryShape());
+ shapeRepository.save(shapeFixtures.fdpShape());
+ shapeRepository.save(shapeFixtures.dataServiceShape());
+ shapeRepository.save(shapeFixtures.metadataServiceShape());
shapeRepository.save(shapeFixtures.catalogShape());
shapeRepository.save(shapeFixtures.datasetShape());
shapeRepository.save(shapeFixtures.distributionShape());
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/ShapeFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/ShapeFixtures.java
index 04a9d3b55..b9a784793 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/ShapeFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/ShapeFixtures.java
@@ -22,358 +22,141 @@
*/
package nl.dtls.fairdatapoint.database.mongo.migration.development.shape.data;
+import lombok.SneakyThrows;
import nl.dtls.fairdatapoint.entity.shape.Shape;
import nl.dtls.fairdatapoint.entity.shape.ShapeType;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.springframework.stereotype.Service;
import java.util.Set;
+import static nl.dtls.fairdatapoint.util.ResourceReader.loadClassResource;
+
@Service
public class ShapeFixtures {
- public static final String RESOURCE_SHAPE_UUID = "6a668323-3936-4b53-8380-a4fd2ed082ee";
-
- public static final String REPOSITORY_SHAPE_UUID = "a92958ab-a414-47e6-8e17-68ba96ba3a2b";
-
- public static final String CATALOG_SHAPE_UUID = "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660";
-
- public static final String DATASET_SHAPE_UUID = "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3";
-
- public static final String DISTRIBUTION_SHAPE_UUID = "ebacbf83-cd4f-4113-8738-d73c0735b0ab";
-
+ @SneakyThrows
public Shape resourceShape() {
+ String definition = loadClassResource("shape-resource.ttl", getClass());
return new Shape(
null,
- "6a668323-3936-4b53-8380-a4fd2ed082ee",
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
"Resource",
false,
ShapeType.INTERNAL,
- "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix foaf: .\n" +
- "@prefix sh: .\n" +
- "@prefix xsd: .\n" +
- "\n" +
- ":ResourceShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Resource ;\n" +
- " sh:property [\n" +
- " sh:path dct:title ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ], [\n" +
- " sh:path dct:description ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextAreaEditor ;\n" +
- " ], [\n" +
- " sh:path dct:publisher ;\n" +
- " sh:node :AgentShape ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:BlankNodeEditor ;\n" +
- " ], [\n" +
- " sh:path dct:hasVersion ;\n" +
- " sh:name \"version\" ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:language ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:license ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:rights ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n" +
- "\n" +
- ":AgentShape a sh:NodeShape ;\n" +
- " sh:targetClass foaf:Agent ;\n" +
- " sh:property [\n" +
- " sh:path foaf:name;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ] .",
+ definition,
Set.of("http://www.w3.org/ns/dcat#Resource")
);
}
- public Shape repositoryShape() {
+ @SneakyThrows
+ public Shape fdpShape() {
+ String definition = loadClassResource("shape-fdp.ttl", getClass());
+ return new Shape(
+ null,
+ KnownUUIDs.SHAPE_FDP_UUID,
+ "FAIR Data Point",
+ false,
+ ShapeType.INTERNAL,
+ definition,
+ Set.of("https://w3id.org/fdp/fdp-o#FAIRDataPoint")
+ );
+ }
+
+ @SneakyThrows
+ public Shape dataServiceShape() {
+ String definition = loadClassResource("shape-data-service.ttl", getClass());
+ return new Shape(
+ null,
+ KnownUUIDs.SHAPE_DATASERVICE_UUID,
+ "Data Service",
+ false,
+ ShapeType.INTERNAL,
+ definition,
+ Set.of("http://www.w3.org/ns/dcat#DataService")
+ );
+ }
+
+ @SneakyThrows
+ public Shape metadataServiceShape() {
+ String definition = loadClassResource("shape-metadata-service.ttl", getClass());
return new Shape(
null,
- "a92958ab-a414-47e6-8e17-68ba96ba3a2b",
- "Repository",
+ KnownUUIDs.SHAPE_METADATASERVICE_UUID,
+ "Metadata Service",
false,
ShapeType.INTERNAL,
- "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dct: .\n" +
- "@prefix r3d: .\n" +
- "@prefix sh: .\n" +
- "@prefix xsd: .\n" +
- "\n" +
- ":RepositoryShape a sh:NodeShape ;\n" +
- " sh:targetClass r3d:Repository ;\n" +
- " sh:property [\n" +
- " sh:path dct:references ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:institution ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:startDate ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:lastUpdate ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:institutionCountry ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n",
- Set.of("http://www.w3.org/ns/dcat#Repository")
+ definition,
+ Set.of("https://w3id.org/fdp/fdp-o#MetadataService")
);
}
+ @SneakyThrows
public Shape catalogShape() {
+ String definition = loadClassResource("shape-catalog.ttl", getClass());
return new Shape(
null,
- "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660",
+ KnownUUIDs.SHAPE_CATALOG_UUID,
"Catalog",
false,
ShapeType.INTERNAL,
- "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix foaf: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":CatalogShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Catalog ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path foaf:homePage ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:themeTaxonomy ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n",
+ definition,
Set.of("http://www.w3.org/ns/dcat#Catalog")
);
}
+ @SneakyThrows
public Shape datasetShape() {
+ String definition = loadClassResource("shape-dataset.ttl", getClass());
return new Shape(
null,
- "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3",
+ KnownUUIDs.SHAPE_DATASET_UUID,
"Dataset",
false,
ShapeType.CUSTOM,
- "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":DatasetShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Dataset ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:theme ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:minCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:contactPoint ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:keyword ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:landingPage ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n",
+ definition,
Set.of("http://www.w3.org/ns/dcat#Dataset")
);
}
+ @SneakyThrows
public Shape distributionShape() {
+ String definition = loadClassResource("shape-distribution.ttl", getClass());
return new Shape(
null,
- "ebacbf83-cd4f-4113-8738-d73c0735b0ab",
+ KnownUUIDs.SHAPE_DISTRIBUTION_UUID,
"Distribution",
false,
ShapeType.CUSTOM,
- "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":DistributionShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Distribution ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:accessURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ], [\n" +
- " sh:path dcat:downloadURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ], [\n" +
- " sh:path dcat:mediaType ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:format ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:byteSize ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ] .",
+ definition,
Set.of("http://www.w3.org/ns/dcat#Distribution")
);
}
+ @SneakyThrows
public Shape customShape() {
+ String definition = loadClassResource("shape-custom.ttl", getClass());
return new Shape(
null,
"ceba9984-9838-4be2-a2a7-12213016fd96",
"Custom Shape",
false,
ShapeType.CUSTOM,
- "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dash: .\n" +
- "@prefix ex: .\n" +
- "\n" +
- ":CustomShape a sh:NodeShape ;\n" +
- " sh:targetClass ex:Dog ;\n" +
- " sh:property [\n" +
- " sh:path ex:identifier ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .",
+ definition,
Set.of("http://example.org/Dog")
);
}
- public Shape customShapeEdited() {
+ @SneakyThrows
+ public Shape customShapeEdited(){
+ String definition = loadClassResource("shape-custom-edited.ttl", getClass());
return new Shape(
null,
customShape().getUuid(),
customShape().getName(),
false,
customShape().getType(),
- "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dash: .\n" +
- "@prefix ex: .\n" +
- "\n" +
- ":CustomShape a sh:NodeShape ;\n" +
- " sh:targetClass ex:Dog ;\n" +
- " sh:property [\n" +
- " sh:path ex:identifier ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path ex:name ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ] .",
+ definition,
Set.of("http://example.org/Dog")
);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/user/data/UserFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/user/data/UserFixtures.java
index a78a7f2ed..cb56cfab1 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/user/data/UserFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/development/user/data/UserFixtures.java
@@ -24,6 +24,7 @@
import nl.dtls.fairdatapoint.entity.user.User;
import nl.dtls.fairdatapoint.entity.user.UserRole;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
@@ -38,7 +39,7 @@ public class UserFixtures {
public User admin() {
return new User(
- "95589e50-d261-492b-8852-9324e9a66a42",
+ KnownUUIDs.USER_ADMIN_UUID,
"Admin",
"von Universe",
adminEmail,
@@ -51,7 +52,7 @@ public User admin() {
public User albert() {
return new User(
- "7e64818d-6276-46fb-8bb1-732e6e09f7e9",
+ KnownUUIDs.USER_ALBERT_UUID,
"Albert",
"Einstein",
albertEmail,
@@ -64,7 +65,7 @@ public User albert() {
public User nikola() {
return new User(
- "b5b92c69-5ed9-4054-954d-0121c29b6800",
+ KnownUUIDs.USER_NIKOLA_UUID,
"Nikola",
"Tesla",
nikolaEmail,
@@ -77,7 +78,7 @@ public User nikola() {
public User isaac() {
return new User(
- "8d1a4c06-bb0e-4d03-a01f-14fa49bbc152",
+ KnownUUIDs.USER_ISAAC_UUID,
"Isaac",
"Newton",
isaacEmail,
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0001_Init.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0001_Init.java
index af2742c35..86160aa1a 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0001_Init.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0001_Init.java
@@ -27,6 +27,7 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.BasicBSONObject;
import org.bson.Document;
import org.bson.types.BasicBSONList;
@@ -49,7 +50,7 @@ public void run(MongoDatabase db) {
private Document userAlbert() {
Document user = new Document();
- user.append("uuid", "7e64818d-6276-46fb-8bb1-732e6e09f7e9");
+ user.append("uuid", KnownUUIDs.USER_ALBERT_UUID);
user.append("firstName", "Albert");
user.append("lastName", "Einstein");
user.append("email", "albert.einstein@example.com");
@@ -61,7 +62,7 @@ private Document userAlbert() {
private Document userNikola() {
Document user = new Document();
- user.append("uuid", "b5b92c69-5ed9-4054-954d-0121c29b6800");
+ user.append("uuid", KnownUUIDs.USER_NIKOLA_UUID);
user.append("firstName", "Nikola");
user.append("lastName", "Tesla");
user.append("email", "nikola.tesla@example.com");
@@ -73,7 +74,7 @@ private Document userNikola() {
private Document membershipOwner() {
Document user = new Document();
- user.append("uuid", "49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8");
+ user.append("uuid", KnownUUIDs.MEMBERSHIP_OWNER_UUID);
user.append("name", "Owner");
BasicBSONList permissions = new BasicBSONList();
permissions.add(new BasicBSONObject().append("mask", 2).append("code", "W"));
@@ -92,7 +93,7 @@ private Document membershipOwner() {
private Document membershipDataProvider() {
Document user = new Document();
- user.append("uuid", "87a2d984-7db2-43f6-805c-6b0040afead5");
+ user.append("uuid", KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID);
user.append("name", "Data Provider");
BasicBSONList permissions = new BasicBSONList();
permissions.add(new BasicBSONObject().append("mask", 4).append("code", "C"));
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0002_CustomMetamodel.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0002_CustomMetamodel.java
index e63858962..2d6d712b7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0002_CustomMetamodel.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0002_CustomMetamodel.java
@@ -27,6 +27,7 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.Document;
import org.springframework.context.annotation.Profile;
@@ -60,7 +61,7 @@ private void addResourceDefinitions(MongoDatabase db) {
private Document repositoryDefinition() {
Document definition = new Document();
- definition.append("uuid", "77aaad6a-0136-4c6e-88b9-07ffccd0ee4c");
+ definition.append("uuid", KnownUUIDs.RD_REPOSITORY_UUID);
definition.append("name", "Repository");
definition.append("uriPrefix", "");
definition.append("rdfType", "http://www.re3data.org/schema/3-0#Repository");
@@ -69,14 +70,14 @@ private Document repositoryDefinition() {
"http://www.w3.org/ns/dcat#Resource"));
definition.append("child", "http://www.re3data.org/schema/3-0#dataCatalog");
definition.append("parentResourceDefinitionUuid", null);
- definition.append("childResourceDefinitionUuid", "a0949e72-4466-4d53-8900-9436d1049a4b");
+ definition.append("childResourceDefinitionUuid", KnownUUIDs.RD_CATALOG_UUID);
definition.append("_class", "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition");
return definition;
}
private Document catalogDefinition() {
Document definition = new Document();
- definition.append("uuid", "a0949e72-4466-4d53-8900-9436d1049a4b");
+ definition.append("uuid", KnownUUIDs.RD_CATALOG_UUID);
definition.append("name", "Catalog");
definition.append("uriPrefix", "catalog");
definition.append("rdfType", "http://www.w3.org/ns/dcat#Catalog");
@@ -84,15 +85,15 @@ private Document catalogDefinition() {
definition.append("shaclTargetClasses", List.of("http://www.w3.org/ns/dcat#Catalog",
"http://www.w3.org/ns/dcat#Resource"));
definition.append("child", "http://www.w3.org/ns/dcat#dataset");
- definition.append("parentResourceDefinitionUuid", "77aaad6a-0136-4c6e-88b9-07ffccd0ee4c");
- definition.append("childResourceDefinitionUuid", "2f08228e-1789-40f8-84cd-28e3288c3604");
+ definition.append("parentResourceDefinitionUuid", KnownUUIDs.RD_REPOSITORY_UUID);
+ definition.append("childResourceDefinitionUuid", KnownUUIDs.RD_DATASET_UUID);
definition.append("_class", "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition");
return definition;
}
private Document datasetDefinition() {
Document definition = new Document();
- definition.append("uuid", "2f08228e-1789-40f8-84cd-28e3288c3604");
+ definition.append("uuid", KnownUUIDs.RD_DATASET_UUID);
definition.append("name", "Dataset");
definition.append("uriPrefix", "dataset");
definition.append("rdfType", "http://www.w3.org/ns/dcat#Dataset");
@@ -100,15 +101,15 @@ private Document datasetDefinition() {
definition.append("shaclTargetClasses", List.of("http://www.w3.org/ns/dcat#Dataset",
"http://www.w3.org/ns/dcat#Resource"));
definition.append("child", "http://www.w3.org/ns/dcat#distribution");
- definition.append("parentResourceDefinitionUuid", "a0949e72-4466-4d53-8900-9436d1049a4b");
- definition.append("childResourceDefinitionUuid", "02c649de-c579-43bb-b470-306abdc808c7");
+ definition.append("parentResourceDefinitionUuid", KnownUUIDs.RD_CATALOG_UUID);
+ definition.append("childResourceDefinitionUuid", KnownUUIDs.RD_DISTRIBUTION_UUID);
definition.append("_class", "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition");
return definition;
}
private Document distributionDefinition() {
Document definition = new Document();
- definition.append("uuid", "02c649de-c579-43bb-b470-306abdc808c7");
+ definition.append("uuid", KnownUUIDs.RD_DISTRIBUTION_UUID);
definition.append("name", "Distribution");
definition.append("uriPrefix", "distribution");
definition.append("rdfType", "http://www.w3.org/ns/dcat#Distribution");
@@ -116,7 +117,7 @@ private Document distributionDefinition() {
definition.append("shaclTargetClasses", List.of("http://www.w3.org/ns/dcat#Distribution",
"http://www.w3.org/ns/dcat#Resource"));
definition.append("child", null);
- definition.append("parentResourceDefinitionUuid", "2f08228e-1789-40f8-84cd-28e3288c3604");
+ definition.append("parentResourceDefinitionUuid", KnownUUIDs.RD_DATASET_UUID);
definition.append("childResourceDefinitionUuid", null);
definition.append("_class", "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition");
return definition;
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0003_ShapeDefinition.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0003_ShapeDefinition.java
index e23af882c..438c034f7 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0003_ShapeDefinition.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0003_ShapeDefinition.java
@@ -27,19 +27,22 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.Document;
import org.springframework.context.annotation.Profile;
+import static nl.dtls.fairdatapoint.util.ResourceReader.loadClassResource;
+
@ChangeLog(order = "0003")
@Profile(Profiles.PRODUCTION)
public class Migration_0003_ShapeDefinition {
@ChangeSet(order = "0003", id = "Migration_0003_ShapeDefinition", author = "migrationBot")
- public void run(MongoDatabase db) {
+ public void run(MongoDatabase db) throws Exception {
addShapeDefinitions(db);
}
- private void addShapeDefinitions(MongoDatabase db) {
+ private void addShapeDefinitions(MongoDatabase db) throws Exception {
MongoCollection shapeCol = db.getCollection("shape");
shapeCol.insertOne(resourceDefinition());
shapeCol.insertOne(repositoryDefinition());
@@ -48,239 +51,58 @@ private void addShapeDefinitions(MongoDatabase db) {
shapeCol.insertOne(distributionDefinition());
}
- private Document resourceDefinition() {
+ private Document resourceDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0003_shape-resource.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "6a668323-3936-4b53-8380-a4fd2ed082ee");
+ definition.append("uuid", KnownUUIDs.SHAPE_RESOURCE_UUID);
definition.append("name", "Resource");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix xsd: .\n" +
- "@prefix dash: .\n" +
- "\n" +
- ":ResourceShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Resource ;\n" +
- " sh:property [\n" +
- " sh:path dct:title ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ], [\n" +
- " sh:path dct:description ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextAreaEditor ;\n" +
- " ], [\n" +
- " sh:path dct:hasVersion ;\n" +
- " sh:name \"version\" ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:license ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:conformsTo ;\n" +
- " sh:name \"specification\" ;\n" +
- " sh:maxCount 1 ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:language ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:rights ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " ], [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document repositoryDefinition() {
+ private Document repositoryDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0003_shape-repository.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "a92958ab-a414-47e6-8e17-68ba96ba3a2b");
+ definition.append("uuid", KnownUUIDs.SHAPE_REPOSITORY_UUID);
definition.append("name", "Repository");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix xsd: .\n" +
- "@prefix r3d: .\n" +
- "\n" +
- ":RepositoryShape a sh:NodeShape ;\n" +
- " sh:targetClass r3d:Repository ;\n" +
- " sh:property [\n" +
- " sh:path r3d:startDate ;\n" +
- " sh:datatype xsd:date ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] ,\n" +
- " [\n" +
- " sh:path r3d:lastUpdate ;\n" +
- " sh:datatype xsd:date ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] ,\n" +
- " [\n" +
- " sh:path r3d:institution ;\n" +
- " sh:class r3d:Institution ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] ,\n" +
- " [\n" +
- " sh:path r3d:institutionCountry ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document catalogDefinition() {
+ private Document catalogDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0003_shape-catalog.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660");
+ definition.append("uuid", KnownUUIDs.SHAPE_CATALOG_UUID);
definition.append("name", "Catalog");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix foaf: .\n" +
- "@prefix dash: .\n" +
- "\n" +
- ":CatalogShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Catalog ;\n" +
- " sh:property [\n" +
- " sh:path dct:isPartOf ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path foaf:homePage ;\n" +
- " sh:maxCount 1 ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:themeTaxonomy ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document datasetDefinition() {
+ private Document datasetDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0003_shape-dataset.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3");
+ definition.append("uuid", KnownUUIDs.SHAPE_DATASET_UUID);
definition.append("name", "Dataset");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix dash: .\n" +
- "\n" +
- ":DatasetShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Dataset ;\n" +
- " sh:property [\n" +
- " sh:path dct:isPartOf ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:landingPage ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:theme ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:keyword ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:contactPoint ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document distributionDefinition() {
+ private Document distributionDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0003_shape-distribution.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "ebacbf83-cd4f-4113-8738-d73c0735b0ab");
+ definition.append("uuid", KnownUUIDs.SHAPE_DISTRIBUTION_UUID);
definition.append("name", "Distribution");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix sh: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix dash: .\n" +
- "\n" +
- ":DistributionShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Distribution ;\n" +
- " sh:property [\n" +
- " sh:path dct:isPartOf ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:accessURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:downloadURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:mediaType ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:format ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ],\n" +
- " [\n" +
- " sh:path dcat:byteSize ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0004_ResourceDefinition.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0004_ResourceDefinition.java
index 7db10fd43..cb84b1632 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0004_ResourceDefinition.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0004_ResourceDefinition.java
@@ -28,6 +28,7 @@
import com.mongodb.client.MongoDatabase;
import nl.dtls.fairdatapoint.Profiles;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.BasicBSONObject;
import org.bson.Document;
import org.bson.types.BasicBSONList;
@@ -61,7 +62,7 @@ private void migrateResourceDefinitions(MongoDatabase db) {
private Document repositoryDefinition() {
Document definition = new Document();
- definition.append("uuid", "77aaad6a-0136-4c6e-88b9-07ffccd0ee4c");
+ definition.append("uuid", KnownUUIDs.RD_REPOSITORY_UUID);
definition.append("name", "Repository");
definition.append("urlPrefix", "");
definition.append("targetClassUris", List.of("http://www.w3.org/ns/dcat#Resource",
@@ -69,7 +70,7 @@ private Document repositoryDefinition() {
// Child
Document child = new Document();
- child.append("resourceDefinitionUuid", "a0949e72-4466-4d53-8900-9436d1049a4b");
+ child.append("resourceDefinitionUuid", KnownUUIDs.RD_CATALOG_UUID);
child.append("relationUri", "http://www.re3data.org/schema/3-0#dataCatalog");
Document listView = new Document();
listView.append("title", "Catalogs");
@@ -87,7 +88,7 @@ private Document repositoryDefinition() {
private Document catalogDefinition() {
Document definition = new Document();
- definition.append("uuid", "a0949e72-4466-4d53-8900-9436d1049a4b");
+ definition.append("uuid", KnownUUIDs.RD_CATALOG_UUID);
definition.append("name", "Catalog");
definition.append("urlPrefix", "catalog");
definition.append("targetClassUris", List.of("http://www.w3.org/ns/dcat#Resource",
@@ -95,7 +96,7 @@ private Document catalogDefinition() {
// Child
Document child = new Document();
- child.append("resourceDefinitionUuid", "2f08228e-1789-40f8-84cd-28e3288c3604");
+ child.append("resourceDefinitionUuid", KnownUUIDs.RD_DATASET_UUID);
child.append("relationUri", "http://www.w3.org/ns/dcat#dataset");
Document listView = new Document();
listView.append("title", "Datasets");
@@ -113,7 +114,7 @@ private Document catalogDefinition() {
private Document datasetDefinition() {
Document definition = new Document();
- definition.append("uuid", "2f08228e-1789-40f8-84cd-28e3288c3604");
+ definition.append("uuid", KnownUUIDs.RD_DATASET_UUID);
definition.append("name", "Dataset");
definition.append("urlPrefix", "dataset");
definition.append("targetClassUris", List.of("http://www.w3.org/ns/dcat#Resource",
@@ -121,7 +122,7 @@ private Document datasetDefinition() {
// Child
Document child = new Document();
- child.append("resourceDefinitionUuid", "02c649de-c579-43bb-b470-306abdc808c7");
+ child.append("resourceDefinitionUuid", KnownUUIDs.RD_DISTRIBUTION_UUID);
child.append("relationUri", "http://www.w3.org/ns/dcat#distribution");
// - list View
Document listView = new Document();
@@ -144,7 +145,7 @@ private Document datasetDefinition() {
private Document distributionDefinition() {
Document definition = new Document();
- definition.append("uuid", "02c649de-c579-43bb-b470-306abdc808c7");
+ definition.append("uuid", KnownUUIDs.RD_DISTRIBUTION_UUID);
definition.append("name", "Distribution");
definition.append("urlPrefix", "distribution");
definition.append("targetClassUris", List.of("http://www.w3.org/ns/dcat#Resource",
@@ -168,7 +169,7 @@ private Document distributionDefinition() {
private Document membershipOwner() {
Document user = new Document();
- user.append("uuid", "49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8");
+ user.append("uuid", KnownUUIDs.MEMBERSHIP_OWNER_UUID);
user.append("name", "Owner");
BasicBSONList permissions = new BasicBSONList();
permissions.add(new BasicBSONObject().append("mask", 2).append("code", "W"));
@@ -177,9 +178,9 @@ private Document membershipOwner() {
permissions.add(new BasicBSONObject().append("mask", 16).append("code", "A"));
user.append("permissions", permissions);
BasicBSONList allowedEntities = new BasicBSONList();
- allowedEntities.add("a0949e72-4466-4d53-8900-9436d1049a4b");
- allowedEntities.add("2f08228e-1789-40f8-84cd-28e3288c3604");
- allowedEntities.add("02c649de-c579-43bb-b470-306abdc808c7");
+ allowedEntities.add(KnownUUIDs.RD_CATALOG_UUID);
+ allowedEntities.add(KnownUUIDs.RD_DATASET_UUID);
+ allowedEntities.add(KnownUUIDs.RD_DISTRIBUTION_UUID);
user.append("allowedEntities", allowedEntities);
user.append("_class", "nl.dtls.fairdatapoint.entity.membership.Membership");
return user;
@@ -187,13 +188,13 @@ private Document membershipOwner() {
private Document membershipDataProvider() {
Document user = new Document();
- user.append("uuid", "87a2d984-7db2-43f6-805c-6b0040afead5");
+ user.append("uuid", KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID);
user.append("name", "Data Provider");
BasicBSONList permissions = new BasicBSONList();
permissions.add(new BasicBSONObject().append("mask", 4).append("code", "C"));
user.append("permissions", permissions);
BasicBSONList allowedEntities = new BasicBSONList();
- allowedEntities.add("a0949e72-4466-4d53-8900-9436d1049a4b");
+ allowedEntities.add(KnownUUIDs.RD_CATALOG_UUID);
user.append("allowedEntities", allowedEntities);
user.append("_class", "nl.dtls.fairdatapoint.entity.membership.Membership");
return user;
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0005_UpdateShapeDefinition.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0005_UpdateShapeDefinition.java
index 16655564b..9fd946ceb 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0005_UpdateShapeDefinition.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0005_UpdateShapeDefinition.java
@@ -27,26 +27,29 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.Document;
import org.springframework.context.annotation.Profile;
+import static nl.dtls.fairdatapoint.util.ResourceReader.loadClassResource;
+
@ChangeLog(order = "0005")
@Profile(Profiles.PRODUCTION)
public class Migration_0005_UpdateShapeDefinition {
@ChangeSet(order = "0005", id = "Migration_0005_UpdateShapeDefinition", author = "migrationBot")
- public void run(MongoDatabase db) {
+ public void run(MongoDatabase db) throws Exception {
addShapeDefinitions(db);
}
- private void addShapeDefinitions(MongoDatabase db) {
+ private void addShapeDefinitions(MongoDatabase db) throws Exception {
MongoCollection shapeCol = db.getCollection("shape");
- shapeCol.deleteOne(new Document("uuid", "6a668323-3936-4b53-8380-a4fd2ed082ee"));
- shapeCol.deleteOne(new Document("uuid", "a92958ab-a414-47e6-8e17-68ba96ba3a2b"));
- shapeCol.deleteOne(new Document("uuid", "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660"));
- shapeCol.deleteOne(new Document("uuid", "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3"));
- shapeCol.deleteOne(new Document("uuid", "ebacbf83-cd4f-4113-8738-d73c0735b0ab"));
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_RESOURCE_UUID));
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_REPOSITORY_UUID));
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_CATALOG_UUID));
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_DATASET_UUID));
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_DISTRIBUTION_UUID));
shapeCol.insertOne(resourceDefinition());
shapeCol.insertOne(repositoryDefinition());
@@ -55,276 +58,58 @@ private void addShapeDefinitions(MongoDatabase db) {
shapeCol.insertOne(distributionDefinition());
}
- private Document resourceDefinition() {
+ private Document resourceDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0005_shape-resource.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "6a668323-3936-4b53-8380-a4fd2ed082ee");
+ definition.append("uuid", KnownUUIDs.SHAPE_RESOURCE_UUID);
definition.append("name", "Resource");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix foaf: .\n" +
- "@prefix sh: .\n" +
- "@prefix xsd: .\n" +
- "\n" +
- ":ResourceShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Resource ;\n" +
- " sh:property [\n" +
- " sh:path dct:title ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ], [\n" +
- " sh:path dct:description ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextAreaEditor ;\n" +
- " ], [\n" +
- " sh:path dct:publisher ;\n" +
- " sh:node :AgentShape ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:BlankNodeEditor ;\n" +
- " ], [\n" +
- " sh:path dct:hasVersion ;\n" +
- " sh:name \"version\" ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:language ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:license ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dct:rights ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n" +
- "\n" +
- ":AgentShape a sh:NodeShape ;\n" +
- " sh:targetClass foaf:Agent ;\n" +
- " sh:property [\n" +
- " sh:path foaf:name;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document repositoryDefinition() {
+ private Document repositoryDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0005_shape-repository.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "a92958ab-a414-47e6-8e17-68ba96ba3a2b");
+ definition.append("uuid", KnownUUIDs.SHAPE_REPOSITORY_UUID);
definition.append("name", "Repository");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dct: .\n" +
- "@prefix r3d: .\n" +
- "@prefix sh: .\n" +
- "@prefix xsd: .\n" +
- "\n" +
- ":RepositoryShape a sh:NodeShape ;\n" +
- " sh:targetClass r3d:Repository ;\n" +
- " sh:property [\n" +
- " sh:path dct:references ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:institution ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:startDate ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:lastUpdate ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path r3d:institutionCountry ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document catalogDefinition() {
+ private Document catalogDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0005_shape-catalog.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660");
+ definition.append("uuid", KnownUUIDs.SHAPE_CATALOG_UUID);
definition.append("name", "Catalog");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix foaf: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":CatalogShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Catalog ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path foaf:homePage ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:themeTaxonomy ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document datasetDefinition() {
+ private Document datasetDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0005_shape-dataset.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3");
+ definition.append("uuid", KnownUUIDs.SHAPE_DATASET_UUID);
definition.append("name", "Dataset");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":DatasetShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Dataset ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:theme ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:minCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:contactPoint ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:keyword ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:landingPage ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " dash:viewer dash:LabelViewer ;\n" +
- " ] .\n");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
- private Document distributionDefinition() {
+ private Document distributionDefinition() throws Exception {
+ String shaclDefinition = loadClassResource("0005_shape-distribution.ttl", getClass());
Document definition = new Document();
- definition.append("uuid", "ebacbf83-cd4f-4113-8738-d73c0735b0ab");
+ definition.append("uuid", KnownUUIDs.SHAPE_DISTRIBUTION_UUID);
definition.append("name", "Distribution");
definition.append("type", "INTERNAL");
- definition.append("definition", "@prefix : .\n" +
- "@prefix dash: .\n" +
- "@prefix dcat: .\n" +
- "@prefix dct: .\n" +
- "@prefix sh: .\n" +
- "\n" +
- ":DistributionShape a sh:NodeShape ;\n" +
- " sh:targetClass dcat:Distribution ;\n" +
- " sh:property [\n" +
- " sh:path dct:issued ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dct:modified ;\n" +
- " sh:datatype xsd:dateTime ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:DatePickerEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:accessURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ], [\n" +
- " sh:path dcat:downloadURL ;\n" +
- " sh:nodeKind sh:IRI ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:URIEditor ;\n" +
- " ], [\n" +
- " sh:path dcat:mediaType ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:minCount 1 ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:format ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ], [\n" +
- " sh:path dcat:byteSize ;\n" +
- " sh:nodeKind sh:Literal ;\n" +
- " sh:maxCount 1 ;\n" +
- " dash:editor dash:TextFieldEditor ;\n" +
- " dash:viewer dash:LiteralViewer ;\n" +
- " ] .");
+ definition.append("definition", shaclDefinition);
definition.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
return definition;
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0008_ShapesInternalChange.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0008_ShapesInternalChange.java
index d0bb2f083..669732aac 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0008_ShapesInternalChange.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0008_ShapesInternalChange.java
@@ -29,6 +29,7 @@
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.Updates;
import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.bson.Document;
import org.springframework.context.annotation.Profile;
@@ -45,12 +46,12 @@ private void updateInternalShapesType(MongoDatabase db) {
MongoCollection shapeCol = db.getCollection("shape");
// DATASET
shapeCol.updateOne(
- Filters.eq("uuid", "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3"),
+ Filters.eq("uuid", KnownUUIDs.SHAPE_DATASET_UUID),
Updates.set("type", "CUSTOM")
);
// DISTRIBUTION
shapeCol.updateOne(
- Filters.eq("uuid", "ebacbf83-cd4f-4113-8738-d73c0735b0ab"),
+ Filters.eq("uuid", KnownUUIDs.SHAPE_DISTRIBUTION_UUID),
Updates.set("type", "CUSTOM")
);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0010_FixShapeXsdPrefix.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0010_FixShapeXsdPrefix.java
new file mode 100644
index 000000000..ea550d69c
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0010_FixShapeXsdPrefix.java
@@ -0,0 +1,77 @@
+/**
+ * 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.github.cloudyrock.mongock.ChangeLog;
+import com.github.cloudyrock.mongock.ChangeSet;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.Filters;
+import com.mongodb.client.model.Updates;
+import nl.dtls.fairdatapoint.Profiles;
+import org.bson.Document;
+import org.springframework.context.annotation.Profile;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@ChangeLog(order = "0010")
+@Profile(Profiles.PRODUCTION)
+public class Migration_0010_FixShapeXsdPrefix {
+
+ private static final String XSD_PREFIX = "@prefix xsd: .";
+
+ @ChangeSet(order = "0010", id = "Migration_0010_FixShapeXsdPrefix", author = "migrationBot")
+ public void run(MongoDatabase db) {
+ fixShapePrefixes(db);
+ }
+
+ private void fixShapePrefixes(MongoDatabase db) {
+ MongoCollection shapeCol = db.getCollection("shape");
+ List faultyShapeUuids = List.of(
+ "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660", // catalog
+ "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3", // dataset
+ "ebacbf83-cd4f-4113-8738-d73c0735b0ab" // distribution
+ );
+ faultyShapeUuids.forEach(shapeUuid -> {
+ Document shape = shapeCol.find(Filters.eq("uuid", shapeUuid)).first();
+ if (shape != null) {
+ String definition = shape.getString("definition");
+ boolean isFaulty = definition.contains("xsd:") && !definition.contains("@prefix xsd:");
+ if (isFaulty) {
+ List lines = definition.lines().collect(Collectors.toList());
+ int line = 0;
+ while (lines.get(line).startsWith("@prefix")) {
+ line++;
+ }
+ lines.add(line, XSD_PREFIX);
+
+ shapeCol.updateOne(
+ Filters.eq("uuid", shapeUuid),
+ Updates.set("definition", String.join("\n", lines))
+ );
+ }
+ }
+ });
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0011_ComplyFDPO.java b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0011_ComplyFDPO.java
new file mode 100644
index 000000000..5beb1c533
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/mongo/migration/production/Migration_0011_ComplyFDPO.java
@@ -0,0 +1,141 @@
+/**
+ * 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.github.cloudyrock.mongock.ChangeLog;
+import com.github.cloudyrock.mongock.ChangeSet;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import nl.dtls.fairdatapoint.Profiles;
+import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
+import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
+import nl.dtls.fairdatapoint.vocabulary.FDP;
+import org.bson.Document;
+import org.eclipse.rdf4j.model.vocabulary.DCAT;
+import org.springframework.context.annotation.Profile;
+
+import java.util.*;
+
+import static nl.dtls.fairdatapoint.util.ResourceReader.loadClassResource;
+
+@ChangeLog(order = "0011")
+@Profile(Profiles.PRODUCTION)
+public class Migration_0011_ComplyFDPO {
+
+ @ChangeSet(order = "0011", id = "Migration_0011_ComplyFDPO", author = "migrationBot")
+ public void run(MongoDatabase db, ResourceDefinitionCache resourceDefinitionCache, ResourceDefinitionTargetClassesCache targetClassesCache) throws Exception {
+ updateShapes(db);
+ updateResourceDefinitions(db);
+ resourceDefinitionCache.computeCache();
+ targetClassesCache.computeCache();
+ }
+
+ private void updateShapes(MongoDatabase db) throws Exception {
+ MongoCollection shapeCol = db.getCollection("shape");
+
+ // Delete Repository Shape
+ shapeCol.deleteOne(new Document("uuid", KnownUUIDs.SHAPE_REPOSITORY_UUID));
+
+ // Insert New Shapes
+ shapeCol.insertOne(dataServiceShape());
+ shapeCol.insertOne(metadataServiceShape());
+ shapeCol.insertOne(fdpShape());
+ }
+
+ private Document fdpShape() throws Exception {
+ String shaclDefinition = loadClassResource("0011_shape-fdp.ttl", getClass());
+ Document shape = new Document();
+ shape.append("uuid", KnownUUIDs.SHAPE_FDP_UUID);
+ shape.append("name", "FAIR Data Point");
+ shape.append("type", "INTERNAL");
+ shape.append("definition", shaclDefinition);
+ shape.append("targetClasses", List.of("https://w3id.org/fdp/fdp-o#FAIRDataPoint"));
+ shape.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
+ return shape;
+ }
+
+ private Document dataServiceShape() throws Exception {
+ String shaclDefinition = loadClassResource("0011_shape-data-service.ttl", getClass());
+ Document shape = new Document();
+ shape.append("uuid", KnownUUIDs.SHAPE_DATASERVICE_UUID);
+ shape.append("name", "Data Service");
+ shape.append("type", "INTERNAL");
+ shape.append("definition", shaclDefinition);
+ shape.append("targetClasses", List.of("http://www.w3.org/ns/dcat#DataService"));
+ shape.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
+ return shape;
+ }
+
+ private Document metadataServiceShape() throws Exception {
+ String shaclDefinition = loadClassResource("0011_shape-metadata-service.ttl", getClass());
+ Document shape = new Document();
+ shape.append("uuid", KnownUUIDs.SHAPE_METADATASERVICE_UUID);
+ shape.append("name", "Metadata Service");
+ shape.append("type", "INTERNAL");
+ shape.append("definition", shaclDefinition);
+ shape.append("targetClasses", List.of("https://w3id.org/fdp/fdp-o#MetadataService"));
+ shape.append("_class", "nl.dtls.fairdatapoint.entity.shape.Shape");
+ return shape;
+ }
+
+ private void updateResourceDefinitions(MongoDatabase db) {
+ MongoCollection rdCol = db.getCollection("resourceDefinition");
+
+ // Delete Repository Shape
+ rdCol.deleteOne(new Document("uuid", KnownUUIDs.RD_REPOSITORY_UUID));
+
+ // Insert New Shapes
+ rdCol.insertOne(fdpResourceDefinition());
+ }
+
+ private Document fdpResourceDefinition() {
+ Document definition = new Document();
+ definition.append("uuid", KnownUUIDs.RD_FDP_UUID);
+ definition.append("name", "FAIR Data Point");
+ definition.append("urlPrefix", "");
+ definition.append("shapeUuids", List.of(
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_DATASERVICE_UUID,
+ KnownUUIDs.SHAPE_METADATASERVICE_UUID,
+ KnownUUIDs.SHAPE_FDP_UUID
+ ));
+
+ // Child
+ Document child = new Document();
+ child.append("resourceDefinitionUuid", KnownUUIDs.RD_CATALOG_UUID);
+ child.append("relationUri", FDP.METADATACATALOG.stringValue());
+ Document listView = new Document();
+ listView.append("title", "Catalogs");
+ listView.append("tagsUri", DCAT.THEME_TAXONOMY.stringValue());
+ listView.append("metadata", List.of());
+ child.append("listView", listView);
+ definition.append("children", List.of(child));
+
+ // External Links
+ definition.append("externalLinks", List.of());
+
+ definition.append("_class", "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition");
+ return definition;
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java
index 8b9befe40..3c50168bd 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/RdfMetadataMigration.java
@@ -96,41 +96,41 @@ public void runMigration() {
}
}
- public void importDefaultFixtures(String repositoryUrl) throws MetadataServiceException {
- ResourceDefinition repositoryRd = resourceDefinitionFixtures.repositoryDefinition();
+ public void importDefaultFixtures(String fdpUrl) throws MetadataServiceException {
+ ResourceDefinition fdpRd = resourceDefinitionFixtures.fdpDefinition();
ResourceDefinition catalogRd = resourceDefinitionFixtures.catalogDefinition();
ResourceDefinition datasetRd = resourceDefinitionFixtures.datasetDefinition();
ResourceDefinition distributionRd = resourceDefinitionFixtures.distributionDefinition();
- Model repositoryM = rdfMetadataFixtures.repositoryMetadata(repositoryUrl);
- IRI repositoryUri = getUri(repositoryM);
- genericMetadataService.store(repositoryM, i(repositoryUrl), repositoryRd);
- metadataStateService.modifyState(repositoryUri, new MetaStateChangeDTO(MetadataState.PUBLISHED));
+ Model fdpM = rdfMetadataFixtures.fdpMetadata(fdpUrl);
+ IRI fdpUri = getUri(fdpM);
+ genericMetadataService.store(fdpM, i(fdpUrl), fdpRd);
+ metadataStateService.modifyState(fdpUri, new MetaStateChangeDTO(MetadataState.PUBLISHED));
- Model catalog1 = rdfMetadataFixtures.catalog1(repositoryUrl, i(repositoryUrl));
+ Model catalog1 = rdfMetadataFixtures.catalog1(fdpUrl, i(fdpUrl));
IRI catalog1Uri = getUri(catalog1);
catalogMetadataService.store(catalog1, catalog1Uri, catalogRd);
metadataStateService.modifyState(catalog1Uri, new MetaStateChangeDTO(MetadataState.PUBLISHED));
- Model catalog2 = rdfMetadataFixtures.catalog2(repositoryUrl, repositoryUri);
+ Model catalog2 = rdfMetadataFixtures.catalog2(fdpUrl, fdpUri);
IRI catalog2Uri = getUri(catalog2);
catalogMetadataService.store(catalog2, catalog2Uri, catalogRd);
- Model dataset1 = rdfMetadataFixtures.dataset1(repositoryUrl, catalog1Uri);
+ Model dataset1 = rdfMetadataFixtures.dataset1(fdpUrl, catalog1Uri);
IRI dataset1Uri = getUri(dataset1);
genericMetadataService.store(dataset1, dataset1Uri, datasetRd);
metadataStateService.modifyState(dataset1Uri, new MetaStateChangeDTO(MetadataState.PUBLISHED));
- Model dataset2 = rdfMetadataFixtures.dataset2(repositoryUrl, catalog1Uri);
+ Model dataset2 = rdfMetadataFixtures.dataset2(fdpUrl, catalog1Uri);
IRI dataset2Uri = getUri(dataset2);
genericMetadataService.store(dataset2, dataset2Uri, datasetRd);
- Model distribution1 = rdfMetadataFixtures.distribution1(repositoryUrl, dataset1Uri);
+ Model distribution1 = rdfMetadataFixtures.distribution1(fdpUrl, dataset1Uri);
IRI distribution1Uri = getUri(distribution1);
genericMetadataService.store(distribution1, distribution1Uri, distributionRd);
metadataStateService.modifyState(distribution1Uri, new MetaStateChangeDTO(MetadataState.PUBLISHED));
- Model distribution2 = rdfMetadataFixtures.distribution2(repositoryUrl, dataset1Uri);
+ Model distribution2 = rdfMetadataFixtures.distribution2(fdpUrl, dataset1Uri);
IRI distribution2Uri = getUri(distribution2);
genericMetadataService.store(distribution2, distribution2Uri, distributionRd);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/data/RdfMetadataFixtures.java b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/data/RdfMetadataFixtures.java
index d842acaec..b13a86cee 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/data/RdfMetadataFixtures.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/data/RdfMetadataFixtures.java
@@ -40,7 +40,7 @@ public RdfMetadataFixtures(MetadataFactory metadataFactory) {
this.metadataFactory = metadataFactory;
}
- public Model repositoryMetadata(String repositoryUrl) {
+ public Model fdpMetadata(String fdpUrl) {
return metadataFactory.createFDPMetadata(
"My FAIR Data Point",
"Duis pellentesque, nunc a fringilla varius, magna dui porta quam, nec ultricies augue turpis sed " +
@@ -52,11 +52,11 @@ public Model repositoryMetadata(String repositoryUrl) {
"blandit venenatis. Cras ullamcorper, justo vitae feugiat commodo, orci metus suscipit purus," +
" quis sagittis turpis ante eget ex. Pellentesque malesuada a metus eu pulvinar. Morbi rutrum" +
" euismod eros at varius. Duis finibus dapibus ex, a hendrerit mauris efficitur at.",
- repositoryUrl
+ fdpUrl
);
}
- public Model catalog1(String repositoryUrl, IRI repository) {
+ public Model catalog1(String fdpUrl, IRI fdp) {
return metadataFactory.createCatalogMetadata(
"Bio Catalog",
"Nam eget lorem rhoncus, porta odio at, pretium tortor. Morbi dapibus urna magna, at mollis neque " +
@@ -69,12 +69,12 @@ public Model catalog1(String repositoryUrl, IRI repository) {
"Aenean dapibus tellus ipsum.",
"catalog-1",
Arrays.asList("https://www.wikidata.org/wiki/Q27317", "https://purl.org/example#theme"),
- repositoryUrl,
- repository
+ fdpUrl,
+ fdp
);
}
- public Model catalog2(String repositoryUrl, IRI repository) {
+ public Model catalog2(String fdpUrl, IRI fdp) {
return metadataFactory.createCatalogMetadata(
"Tech Catalog",
"Nam eget lorem rhoncus, porta odio at, pretium tortor. Morbi dapibus urna magna, at mollis neque " +
@@ -87,12 +87,12 @@ public Model catalog2(String repositoryUrl, IRI repository) {
"Aenean dapibus tellus ipsum.",
"catalog-2",
Arrays.asList("https://www.wikidata.org/wiki/Q27318", "https://purl.org/example#theme"),
- repositoryUrl,
- repository
+ fdpUrl,
+ fdp
);
}
- public Model catalog3(String repositoryUrl, IRI repository) {
+ public Model catalog3(String fdpUrl, IRI fdp) {
return metadataFactory.createCatalogMetadata(
"IT Catalog",
"Nam eget lorem rhoncus, porta odio at, pretium tortor. Morbi dapibus urna magna, at mollis neque " +
@@ -105,12 +105,12 @@ public Model catalog3(String repositoryUrl, IRI repository) {
"Aenean dapibus tellus ipsum.",
"catalog-3",
Arrays.asList("https://www.wikidata.org/wiki/Q27318", "https://purl.org/example#theme"),
- repositoryUrl,
- repository
+ fdpUrl,
+ fdp
);
}
- public Model dataset1(String repositoryUrl, IRI catalog) {
+ public Model dataset1(String fdpUrl, IRI catalog) {
return metadataFactory.createDatasetMetadata(
"Cat Dataset",
"Sed hendrerit accumsan velit, ut eleifend lorem rhoncus a. Curabitur auctor euismod risus lobortis " +
@@ -121,12 +121,12 @@ public Model dataset1(String repositoryUrl, IRI catalog) {
Arrays.asList("https://www.wikidata.org/wiki/Q27318", "https://www.wikidata.org/wiki/Q27319", "https" +
"://purl.org/example#theme"),
Arrays.asList("Text Mining", "Natural Language Processing"),
- repositoryUrl,
+ fdpUrl,
catalog
);
}
- public Model dataset2(String repositoryUrl, IRI catalog) {
+ public Model dataset2(String fdpUrl, IRI catalog) {
return metadataFactory.createDatasetMetadata(
"Dog Dataset",
"Sed hendrerit accumsan velit, ut eleifend lorem rhoncus a. Curabitur auctor euismod risus lobortis " +
@@ -136,12 +136,12 @@ public Model dataset2(String repositoryUrl, IRI catalog) {
"dataset-2",
Arrays.asList("https://www.wikidata.org/wiki/Q27318", "https://purl.org/example#theme"),
Arrays.asList("Text Mining", "Natural Language Processing"),
- repositoryUrl,
+ fdpUrl,
catalog
);
}
- public Model dataset3(String repositoryUrl, IRI catalog) {
+ public Model dataset3(String fdpUrl, IRI catalog) {
return metadataFactory.createDatasetMetadata(
"Pig Dataset",
"Sed hendrerit accumsan velit, ut eleifend lorem rhoncus a. Curabitur auctor euismod risus lobortis " +
@@ -151,12 +151,12 @@ public Model dataset3(String repositoryUrl, IRI catalog) {
"dataset-3",
Arrays.asList("https://www.wikidata.org/wiki/Q27318", "https://purl.org/example#theme"),
Arrays.asList("Text Mining", "Natural Language Processing"),
- repositoryUrl,
+ fdpUrl,
catalog
);
}
- public Model distribution1(String repositoryUrl, IRI dataset) {
+ public Model distribution1(String fdpUrl, IRI dataset) {
return metadataFactory.createDistributionMetadata(
"Downloadable Distribution",
"Maecenas et mollis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere " +
@@ -172,12 +172,12 @@ public Model distribution1(String repositoryUrl, IRI dataset) {
"http://example.com",
null,
"text/plain",
- repositoryUrl,
+ fdpUrl,
dataset
);
}
- public Model distribution2(String repositoryUrl, IRI dataset) {
+ public Model distribution2(String fdpUrl, IRI dataset) {
return metadataFactory.createDistributionMetadata(
"Accessible Distribution",
"Maecenas et mollis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere " +
@@ -193,12 +193,12 @@ public Model distribution2(String repositoryUrl, IRI dataset) {
null,
"http://example.com",
"text/plain",
- repositoryUrl,
+ fdpUrl,
dataset
);
}
- public Model distribution3(String repositoryUrl, IRI dataset) {
+ public Model distribution3(String fdpUrl, IRI dataset) {
return metadataFactory.createDistributionMetadata(
"Nice Distribution",
"Maecenas et mollis purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere " +
@@ -214,7 +214,7 @@ public Model distribution3(String repositoryUrl, IRI dataset) {
null,
"http://example.com",
"text/plain",
- repositoryUrl,
+ fdpUrl,
dataset
);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/factory/MetadataFactoryImpl.java b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/factory/MetadataFactoryImpl.java
index 30e4885bb..9ee56808a 100644
--- a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/factory/MetadataFactoryImpl.java
+++ b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/development/metadata/factory/MetadataFactoryImpl.java
@@ -40,28 +40,27 @@
@Service
public class MetadataFactoryImpl implements MetadataFactory {
- public Model createFDPMetadata(String title, String description, String repositoryUrl) {
+ public Model createFDPMetadata(String title, String description, String fdpUrl) {
Model metadata = new LinkedHashModel();
- setCommonMetadata(metadata, i(repositoryUrl), title, description, null);
+ setCommonMetadata(metadata, i(fdpUrl), title, description, null);
return metadata;
}
public Model createCatalogMetadata(String title, String description, String identifier,
- List themeTaxonomies, String repositoryUrl,
- IRI repository) {
+ List themeTaxonomies, String fdpUrl, IRI fdp) {
Model metadata = new LinkedHashModel();
- IRI catalogUri = i(repositoryUrl + "/catalog/" + identifier);
- setCommonMetadata(metadata, catalogUri, title, description, repository);
+ IRI catalogUri = i(fdpUrl + "/catalog/" + identifier);
+ setCommonMetadata(metadata, catalogUri, title, description, fdp);
setThemeTaxonomies(metadata, catalogUri,
themeTaxonomies.stream().map(ValueFactoryHelper::i).collect(Collectors.toList()));
return metadata;
}
public Model createDatasetMetadata(String title, String description, String identifier,
- List themes, List keywords, String repositoryUrl,
+ List themes, List keywords, String fdpUrl,
IRI catalog) {
Model metadata = new LinkedHashModel();
- IRI datasetUri = i(repositoryUrl + "/dataset/" + identifier);
+ IRI datasetUri = i(fdpUrl + "/dataset/" + identifier);
setCommonMetadata(metadata, datasetUri, title, description, catalog);
setThemes(metadata, datasetUri, themes.stream().map(ValueFactoryHelper::i).collect(Collectors.toList()));
setKeywords(metadata, datasetUri, keywords.stream().map(ValueFactoryHelper::l).collect(Collectors.toList()));
@@ -70,9 +69,9 @@ public Model createDatasetMetadata(String title, String description, String iden
public Model createDistributionMetadata(String title, String description, String identifier,
String downloadUrl, String accessUrl, String mediaType,
- String repositoryUrl, IRI dataset) {
+ String fdpUrl, IRI dataset) {
Model metadata = new LinkedHashModel();
- IRI distributionUri = i(repositoryUrl + "/distribution/" + identifier);
+ IRI distributionUri = i(fdpUrl + "/distribution/" + identifier);
setCommonMetadata(metadata, distributionUri, title, description, dataset);
if (downloadUrl != null) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0003_FDPO.java b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0003_FDPO.java
new file mode 100644
index 000000000..20bec0aaa
--- /dev/null
+++ b/src/main/java/nl/dtls/fairdatapoint/database/rdf/migration/production/Rdf_Migration_0003_FDPO.java
@@ -0,0 +1,150 @@
+/**
+ * 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.FDP;
+import nl.dtls.fairdatapoint.vocabulary.R3D;
+import nl.dtls.rdf.migration.entity.RdfMigrationAnnotation;
+import nl.dtls.rdf.migration.runner.RdfProductionMigration;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Statement;
+import org.eclipse.rdf4j.model.vocabulary.DCAT;
+import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+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 java.util.List;
+
+import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;
+import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.s;
+
+@RdfMigrationAnnotation(
+ number = 3,
+ name = "FDPO Compliance",
+ description = "Comply with FDP-O Metadata Service")
+@Slf4j
+@Service
+public class Rdf_Migration_0003_FDPO implements RdfProductionMigration {
+
+ @Autowired
+ protected Repository repository;
+
+ @Autowired
+ protected String persistentUrl;
+
+ private static final String LEGACY_CONFORMS_TO = "https://www.purl.org/fairtools/fdp/schema/0.1/fdpMetadata";
+
+ public void runMigration() {
+ removeOldConformsTo();
+ updateRepositoryStatements();
+ updateRepositoryCatalogLinks();
+ updateOldFdpoStatements();
+ }
+
+ private void removeOldConformsTo() {
+ // remove conformsTo for repository if present (https://www.purl.org/fairtools/fdp/schema/0.1/fdpMetadata)
+ try (RepositoryConnection conn = repository.getConnection()) {
+ RepositoryResult queryResult = conn.getStatements(null, DCTERMS.CONFORMS_TO, i(LEGACY_CONFORMS_TO));
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ log.warn("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ } catch (RepositoryException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ private void updateRepositoryStatements() {
+ // change r3d:Repository -> fdp-o:FAIRDataPoint (and dcat:DataService + fdp-o:MetadataService?)
+ List newTypes = List.of(DCAT.DATA_SERVICE, FDP.METADATASERVICE, FDP.FAIRDATAPOINT);
+ try (RepositoryConnection conn = repository.getConnection()) {
+ RepositoryResult queryResult = conn.getStatements(null, RDF.TYPE, R3D.REPOSITORY);
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ for (IRI type : newTypes) {
+ log.debug("Adding: {} {} {}", st.getSubject(), RDF.TYPE, type);
+ conn.add(s(st.getSubject(), RDF.TYPE, type, st.getSubject()));
+ }
+ log.debug("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ } catch (RepositoryException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ private void updateOldFdpoStatements() {
+ // update old FDP-O generated metadata
+ try (RepositoryConnection conn = repository.getConnection()) {
+ RepositoryResult queryResult = conn.getStatements(null, i("http://rdf.biosemantics.org/ontologies/fdp-o#metadataIdentifier"), null);
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ log.debug("Adding: {} {} {}", st.getSubject(), FDP.METADATAIDENTIFIER, st.getObject());
+ conn.add(s(st.getSubject(), FDP.METADATAIDENTIFIER, st.getObject(), st.getSubject()));
+ log.debug("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ queryResult = conn.getStatements(null, i("http://rdf.biosemantics.org/ontologies/fdp-o#metadataIssued"), null);
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ log.debug("Adding: {} {} {}", st.getSubject(), FDP.METADATAISSUED, st.getObject());
+ conn.add(s(st.getSubject(), FDP.METADATAISSUED, st.getObject(), st.getSubject()));
+ log.debug("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ queryResult = conn.getStatements(null, i("http://rdf.biosemantics.org/ontologies/fdp-o#metadataModified"), null);
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ log.debug("Adding: {} {} {}", st.getSubject(), FDP.METADATAMODIFIED, st.getObject());
+ conn.add(s(st.getSubject(), FDP.METADATAMODIFIED, st.getObject(), st.getSubject()));
+ log.debug("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ } catch (RepositoryException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+
+ private void updateRepositoryCatalogLinks() {
+ // change r3d:dataCatalog to fdp-o:metadataCatalog property (between Repository/FDP and Catalogs)
+ try (RepositoryConnection conn = repository.getConnection()) {
+ RepositoryResult queryResult = conn.getStatements(null, R3D.DATACATALOG, null);
+ while (queryResult.hasNext()) {
+ Statement st = queryResult.next();
+ log.debug("Adding: {} {} {}", st.getSubject(), FDP.METADATACATALOG, st.getObject());
+ conn.add(s(st.getSubject(), FDP.METADATACATALOG, st.getObject(), st.getSubject()));
+ log.debug("Removing: {} {} {}", st.getSubject(), st.getPredicate(), st.getObject());
+ conn.remove(st);
+ }
+ } catch (RepositoryException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataGetter.java b/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataGetter.java
index cbc28f421..a4330630b 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataGetter.java
+++ b/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataGetter.java
@@ -24,7 +24,6 @@
import nl.dtls.fairdatapoint.util.ValueFactoryHelper;
import nl.dtls.fairdatapoint.vocabulary.FDP;
-import nl.dtls.fairdatapoint.vocabulary.R3D;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Literal;
import org.eclipse.rdf4j.model.Model;
@@ -117,7 +116,7 @@ public static OffsetDateTime getMetadataModified(Model metadata) {
// Children
// ------------------------------------------------------------------------------------------------------------
public static List getCatalogs(Model metadata) {
- return getChildren(metadata, R3D.DATACATALOG);
+ return getChildren(metadata, FDP.METADATACATALOG);
}
public static List getDatasets(Model metadata) {
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 29d8d0771..4fde03e15 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java
+++ b/src/main/java/nl/dtls/fairdatapoint/entity/metadata/MetadataSetter.java
@@ -117,10 +117,6 @@ public static void setMetadataModified(Model metadata, IRI uri, Literal dataReco
// Custom
// ------------------------------------------------------------------------------------------------------------
- public static void setRepositoryIdentifier(Model metadata, IRI uri, Identifier identifier) {
- setIdentifier(metadata, uri, identifier, R3D.REPOSITORYIDENTIFIER);
- }
-
public static void setPublisher(Model metadata, IRI uri, Agent publisher) {
setAgent(metadata, uri, publisher, DCTERMS.PUBLISHER);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinition.java b/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinition.java
index 920d3f81f..6ed6946a3 100644
--- a/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinition.java
+++ b/src/main/java/nl/dtls/fairdatapoint/entity/resource/ResourceDefinition.java
@@ -40,6 +40,8 @@
@Builder(toBuilder = true)
public class ResourceDefinition {
+ private static final String CATALOG_PREFIX = "catalog";
+
@Id
@JsonIgnore
protected ObjectId id;
@@ -66,4 +68,11 @@ public ResourceDefinition(String uuid, String name, String urlPrefix, List claims = parser.parseClaimsJws(token);
return !claims.getBody().getExpiration().before(new Date());
} catch (JwtException | IllegalArgumentException e) {
- System.out.println(e);
throw new UnauthorizedException("Expired or invalid JWT token");
}
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/membership/MembershipService.java b/src/main/java/nl/dtls/fairdatapoint/service/membership/MembershipService.java
index e42b03cad..6db38175c 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/membership/MembershipService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/membership/MembershipService.java
@@ -26,6 +26,7 @@
import nl.dtls.fairdatapoint.database.mongo.repository.MembershipRepository;
import nl.dtls.fairdatapoint.entity.membership.Membership;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -55,13 +56,13 @@ public void addToMembership(ResourceDefinition resourceDefinition) {
String rdUuid = resourceDefinition.getUuid();
// Add to owner
- Membership owner = membershipRepository.findByUuid("49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8").get();
+ Membership owner = membershipRepository.findByUuid(KnownUUIDs.MEMBERSHIP_OWNER_UUID).get();
addEntityIfMissing(owner, rdUuid);
membershipRepository.save(owner);
// Add to data provider
- if (resourceDefinition.getUrlPrefix().equals("catalog")) {
- Membership dataProvider = membershipRepository.findByUuid("87a2d984-7db2-43f6-805c-6b0040afead5").get();
+ if (resourceDefinition.isCatalog()) {
+ Membership dataProvider = membershipRepository.findByUuid(KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID).get();
addEntityIfMissing(dataProvider, rdUuid);
membershipRepository.save(dataProvider);
}
@@ -71,13 +72,13 @@ public void removeFromMembership(ResourceDefinition resourceDefinition) {
String rdUuid = resourceDefinition.getUuid();
// Add to owner
- Membership owner = membershipRepository.findByUuid("49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8").get();
+ Membership owner = membershipRepository.findByUuid(KnownUUIDs.MEMBERSHIP_OWNER_UUID).get();
removeEntityIfPresent(owner, rdUuid);
membershipRepository.save(owner);
// Add to data provider
- if (resourceDefinition.getUrlPrefix().equals("catalog")) {
- Membership dataProvider = membershipRepository.findByUuid("87a2d984-7db2-43f6-805c-6b0040afead5").get();
+ if (resourceDefinition.isCatalog()) {
+ Membership dataProvider = membershipRepository.findByUuid(KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID).get();
removeEntityIfPresent(dataProvider, rdUuid);
membershipRepository.save(dataProvider);
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/metadata/enhance/MetadataEnhancer.java b/src/main/java/nl/dtls/fairdatapoint/service/metadata/enhance/MetadataEnhancer.java
index a9121d320..ae8adf2a0 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/metadata/enhance/MetadataEnhancer.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/metadata/enhance/MetadataEnhancer.java
@@ -25,12 +25,14 @@
import nl.dtls.fairdatapoint.entity.metadata.Identifier;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinition;
import nl.dtls.fairdatapoint.entity.resource.ResourceDefinitionChild;
+import nl.dtls.fairdatapoint.service.actuator.AppInfoContributor;
import nl.dtls.fairdatapoint.service.metadata.metric.MetricsMetadataService;
import nl.dtls.fairdatapoint.service.profile.ProfileService;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionService;
import nl.dtls.fairdatapoint.util.ValueFactoryHelper;
import nl.dtls.fairdatapoint.vocabulary.DATACITE;
+import nl.dtls.fairdatapoint.vocabulary.FDP;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.vocabulary.*;
@@ -65,6 +67,9 @@ public class MetadataEnhancer {
@Qualifier("license")
private IRI license;
+ @Autowired
+ private String persistentUrl;
+
@Autowired
private MetricsMetadataService metricsMetadataService;
@@ -77,12 +82,15 @@ public class MetadataEnhancer {
@Autowired
private ResourceDefinitionService resourceDefinitionService;
+ @Autowired
+ private AppInfoContributor appInfoContributor;
+
public void enhance(Model metadata, IRI uri, ResourceDefinition rd, Model oldMetadata) {
enhance(metadata, uri, rd);
// Populate with current data from the triple store
setIssued(metadata, uri, l(getIssued(oldMetadata)));
- if (rd.getUrlPrefix().equals("catalog")) {
+ if (rd.isCatalog()) {
setMetadataIssued(metadata, uri, l(getMetadataIssued(oldMetadata)));
}
}
@@ -98,9 +106,6 @@ public void enhance(Model metadata, IRI uri, ResourceDefinition rd) {
// Add identifiers
Identifier identifier = createMetadataIdentifier(uri);
setMetadataIdentifier(metadata, uri, identifier);
- if (rd.getUrlPrefix().equals("")) {
- setRepositoryIdentifier(metadata, uri, identifier);
- }
// Add label
if (containsObject(metadata, uri.stringValue(), DCTERMS.TITLE.stringValue())) {
@@ -130,7 +135,7 @@ public void enhance(Model metadata, IRI uri, ResourceDefinition rd) {
OffsetDateTime timestamp = OffsetDateTime.now();
setIssued(metadata, uri, l(timestamp));
setModified(metadata, uri, l(timestamp));
- if (rd.getUrlPrefix().equals("catalog")) {
+ if (rd.isCatalog()) {
setMetadataIssued(metadata, uri, l(timestamp));
setMetadataModified(metadata, uri, l(timestamp));
}
@@ -155,6 +160,10 @@ public void enhanceWithLinks(IRI entityUri, Model entity, ResourceDefinition rd,
public void enhanceWithResourceDefinition(IRI entityUri, ResourceDefinition rd, Model resultRdf) {
resultRdf.add(entityUri, DCTERMS.CONFORMS_TO, profileService.getProfileUri(rd));
resultRdf.add(profileService.getProfileUri(rd), RDFS.LABEL, l(format("%s Profile", rd.getName())));
+ if (rd.isRoot()) {
+ resultRdf.add(entityUri, FDP.FDPSOFTWAREVERSION, l(format("FDP:%s", appInfoContributor.getFdpVersion())));
+ resultRdf.add(entityUri, DCAT.ENDPOINT_URL, i(persistentUrl));
+ }
}
private Identifier createMetadataIdentifier(IRI uri) {
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/metadata/factory/MetadataServiceFactory.java b/src/main/java/nl/dtls/fairdatapoint/service/metadata/factory/MetadataServiceFactory.java
index 22214ac0b..95e07057c 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/metadata/factory/MetadataServiceFactory.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/metadata/factory/MetadataServiceFactory.java
@@ -27,6 +27,8 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
+import java.util.Optional;
+
@Service
public class MetadataServiceFactory {
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataService.java b/src/main/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataService.java
index fb7616499..ca9ba5593 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataService.java
@@ -43,7 +43,7 @@ public class GenericMetadataService extends AbstractMetadataService {
@Override
public Model store(Model metadata, IRI uri, ResourceDefinition rd) throws MetadataServiceException {
- if (!rd.getName().equals("Repository")) {
+ if (!rd.isRoot()) {
// 1. Check permissions
String parentId = Optional.ofNullable(getParent(metadata))
.orElseThrow(() -> new ValidationException("Metadata has no parent")).stringValue();
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/openapi/OpenApiGenerator.java b/src/main/java/nl/dtls/fairdatapoint/service/openapi/OpenApiGenerator.java
index 8a9d81562..7d1b1f0c8 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/openapi/OpenApiGenerator.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/openapi/OpenApiGenerator.java
@@ -113,6 +113,14 @@ public class OpenApiGenerator {
.addApiResponse("404", RESPONSE_NOT_FOUND)
.addApiResponse("500", RESPONSE_INTERNAL_SERVER_ERROR);
+ private static final ApiResponses RESPONSES_RDF_POST = new ApiResponses()
+ .addApiResponse("201", RESPONSE_OK_RDF)
+ .addApiResponse("400", RESPONSE_BAD_REQUEST)
+ .addApiResponse("401", RESPONSE_UNAUTHORIZED)
+ .addApiResponse("403", RESPONSE_FORBIDDEN)
+ .addApiResponse("404", RESPONSE_NOT_FOUND)
+ .addApiResponse("500", RESPONSE_INTERNAL_SERVER_ERROR);
+
private static final ApiResponses RESPONSES_DELETE = new ApiResponses()
.addApiResponse("204", RESPONSE_NO_CONTENT)
.addApiResponse("400", RESPONSE_BAD_REQUEST)
@@ -345,7 +353,7 @@ public static void generatePathsForResourceDefinition(Paths paths, ResourceDefin
.content(CONTENT_RDF)
.required(true)
)
- .responses(RESPONSES_RDF)
+ .responses(RESPONSES_RDF_POST)
)
);
// CRUD: GET, PUT, DELETE
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/profile/ProfileService.java b/src/main/java/nl/dtls/fairdatapoint/service/profile/ProfileService.java
index 3d0f757a5..47807e408 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/profile/ProfileService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/profile/ProfileService.java
@@ -70,6 +70,7 @@ private Model getProfileForResourceDefinition(ResourceDefinition rd, IRI uri) {
Resource resource = bn();
modelBuilder.subject(resource);
modelBuilder.add(RDF.TYPE, i(format("%s#ResourceDescriptor", PROFILE_PREFIX)));
+ modelBuilder.add(RDFS.LABEL, l(shape.getName()));
modelBuilder.add(DCTERMS.FORMAT, i("https://w3id.org/mediatype/text/turtle"));
modelBuilder.add(DCTERMS.CONFORMS_TO, i("https://www.w3.org/TR/shacl/"));
modelBuilder.add(i(format("%shasRole", PROFILE_PREFIX)), i(format("%srole/Validation",
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 d387e5b22..7a4bfc505 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/reset/FactoryDefaults.java
@@ -22,8 +22,6 @@
*/
package nl.dtls.fairdatapoint.service.reset;
-import com.google.common.base.Charsets;
-import com.google.common.io.Resources;
import nl.dtls.fairdatapoint.entity.membership.Membership;
import nl.dtls.fairdatapoint.entity.membership.MembershipPermission;
import nl.dtls.fairdatapoint.entity.metadata.Metadata;
@@ -34,28 +32,22 @@
import nl.dtls.fairdatapoint.entity.user.User;
import nl.dtls.fairdatapoint.entity.user.UserRole;
import nl.dtls.fairdatapoint.service.shape.ShapeShaclUtils;
+import nl.dtls.fairdatapoint.util.KnownUUIDs;
import nl.dtls.fairdatapoint.vocabulary.DATACITE;
import nl.dtls.fairdatapoint.vocabulary.FDP;
import nl.dtls.fairdatapoint.vocabulary.R3D;
-import nl.dtls.fairdatapoint.vocabulary.Sio;
-import org.apache.commons.codec.digest.DigestUtils;
import org.bson.BasicBSONObject;
import org.bson.Document;
import org.bson.types.BasicBSONList;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Statement;
-import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
-import org.eclipse.rdf4j.model.vocabulary.FOAF;
-import org.eclipse.rdf4j.model.vocabulary.RDF;
-import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.eclipse.rdf4j.model.vocabulary.*;
-import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import static java.lang.String.format;
+import static nl.dtls.fairdatapoint.util.ResourceReader.loadClassResource;
import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.*;
public class FactoryDefaults {
@@ -63,7 +55,7 @@ public class FactoryDefaults {
//== USERS
// Changes: Migration_0001_Init
public static final User USER_ALBERT = User.builder()
- .uuid("7e64818d-6276-46fb-8bb1-732e6e09f7e9")
+ .uuid(KnownUUIDs.USER_ALBERT_UUID)
.firstName("Albert")
.lastName("Einstein")
.email("albert.einstein@example.com")
@@ -72,7 +64,7 @@ public class FactoryDefaults {
.build();
public static final User USER_NIKOLA = User.builder()
- .uuid("b5b92c69-5ed9-4054-954d-0121c29b6800")
+ .uuid(KnownUUIDs.USER_NIKOLA_UUID)
.firstName("Nikola")
.lastName("Tesla")
.email("nikola.tesla@example.com")
@@ -83,7 +75,7 @@ public class FactoryDefaults {
//== MEMBERSHIPS
// Changes: Migration_0001_Init, Migration_0004_ResourceDefinition
public static final Membership MEMBERSHIP_OWNER = Membership.builder()
- .uuid("49f2bcfd-ef0a-4a3a-a1a3-0fc72a6892a8")
+ .uuid(KnownUUIDs.MEMBERSHIP_OWNER_UUID)
.name("Owner")
.permissions(List.of(
new MembershipPermission(2, 'W'),
@@ -92,52 +84,43 @@ public class FactoryDefaults {
new MembershipPermission(16, 'A')
))
.allowedEntities(List.of(
- "a0949e72-4466-4d53-8900-9436d1049a4b",
- "2f08228e-1789-40f8-84cd-28e3288c3604",
- "02c649de-c579-43bb-b470-306abdc808c7"
+ KnownUUIDs.RD_CATALOG_UUID,
+ KnownUUIDs.RD_DATASET_UUID,
+ KnownUUIDs.RD_DISTRIBUTION_UUID
))
.build();
public static final Membership MEMBERSHIP_DATA_PROVIDER = Membership.builder()
- .uuid("87a2d984-7db2-43f6-805c-6b0040afead5")
+ .uuid(KnownUUIDs.MEMBERSHIP_DATAPROVIDER_UUID)
.name("Data Provider")
.permissions(List.of(
new MembershipPermission(4, 'C')
))
.allowedEntities(List.of(
- "a0949e72-4466-4d53-8900-9436d1049a4b"
+ KnownUUIDs.RD_CATALOG_UUID
))
.build();
- //== SHAPE UUIDS
- private static final String SHAPE_RESOURCE_UUID = "6a668323-3936-4b53-8380-a4fd2ed082ee";
-
- private static final String SHAPE_REPOSITORY_UUID = "a92958ab-a414-47e6-8e17-68ba96ba3a2b";
-
- private static final String SHAPE_CATALOG_UUID = "2aa7ba63-d27a-4c0e-bfa6-3a4e250f4660";
-
- private static final String SHAPE_DATASET_UUID = "866d7fb8-5982-4215-9c7c-18d0ed1bd5f3";
-
- private static final String SHAPE_DISTRIBUTION_UUID = "ebacbf83-cd4f-4113-8738-d73c0735b0ab";
-
//== RESOURCE DEFINITIONS
- // Changes: Migration_0002_CustomMetamodel, Migration_0004_ResourceDefinition
- public static final ResourceDefinition RESOURCE_DEFINITION_REPOSITORY = ResourceDefinition.builder()
- .uuid("77aaad6a-0136-4c6e-88b9-07ffccd0ee4c")
- .name("Repository")
+ // Changes: Migration_0002_CustomMetamodel, Migration_0004_ResourceDefinition, Migration_0010_ComplyFDPO
+ public static final ResourceDefinition RESOURCE_DEFINITION_FDP = ResourceDefinition.builder()
+ .uuid(KnownUUIDs.RD_FDP_UUID)
+ .name("FAIR Data Point")
.urlPrefix("")
.shapeUuids(List.of(
- SHAPE_RESOURCE_UUID,
- SHAPE_REPOSITORY_UUID
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_DATASERVICE_UUID,
+ KnownUUIDs.SHAPE_METADATASERVICE_UUID,
+ KnownUUIDs.SHAPE_FDP_UUID
))
.children(List.of(
ResourceDefinitionChild.builder()
- .resourceDefinitionUuid("a0949e72-4466-4d53-8900-9436d1049a4b")
- .relationUri("http://www.re3data.org/schema/3-0#dataCatalog")
+ .resourceDefinitionUuid(KnownUUIDs.RD_CATALOG_UUID)
+ .relationUri(FDP.METADATACATALOG.stringValue())
.listView(
ResourceDefinitionChildListView.builder()
.title("Catalogs")
- .tagsUri("http://www.w3.org/ns/dcat#themeTaxonomy")
+ .tagsUri(DCAT.THEME_TAXONOMY.stringValue())
.metadata(List.of())
.build()
)
@@ -147,21 +130,21 @@ public class FactoryDefaults {
.build();
public static final ResourceDefinition RESOURCE_DEFINITION_CATALOG = ResourceDefinition.builder()
- .uuid("a0949e72-4466-4d53-8900-9436d1049a4b")
+ .uuid(KnownUUIDs.RD_CATALOG_UUID)
.name("Catalog")
.urlPrefix("catalog")
.shapeUuids(List.of(
- SHAPE_RESOURCE_UUID,
- SHAPE_CATALOG_UUID
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_CATALOG_UUID
))
.children(List.of(
ResourceDefinitionChild.builder()
- .resourceDefinitionUuid("2f08228e-1789-40f8-84cd-28e3288c3604")
- .relationUri("http://www.w3.org/ns/dcat#dataset")
+ .resourceDefinitionUuid(KnownUUIDs.RD_DATASET_UUID)
+ .relationUri(DCAT.HAS_DATASET.stringValue())
.listView(
ResourceDefinitionChildListView.builder()
.title("Datasets")
- .tagsUri("http://www.w3.org/ns/dcat#theme")
+ .tagsUri(DCAT.THEME.stringValue())
.metadata(List.of())
.build()
)
@@ -171,17 +154,17 @@ public class FactoryDefaults {
.build();
public static final ResourceDefinition RESOURCE_DEFINITION_DATASET = ResourceDefinition.builder()
- .uuid("2f08228e-1789-40f8-84cd-28e3288c3604")
+ .uuid(KnownUUIDs.RD_DATASET_UUID)
.name("Dataset")
.urlPrefix("dataset")
.shapeUuids(List.of(
- SHAPE_RESOURCE_UUID,
- SHAPE_DATASET_UUID
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_DATASET_UUID
))
.children(List.of(
ResourceDefinitionChild.builder()
- .resourceDefinitionUuid("02c649de-c579-43bb-b470-306abdc808c7")
- .relationUri("http://www.w3.org/ns/dcat#distribution")
+ .resourceDefinitionUuid(KnownUUIDs.RD_DISTRIBUTION_UUID)
+ .relationUri(DCAT.HAS_DISTRIBUTION.stringValue())
.listView(
ResourceDefinitionChildListView.builder()
.title("Distributions")
@@ -189,7 +172,7 @@ public class FactoryDefaults {
.metadata(List.of(
new ResourceDefinitionChildListViewMetadata(
"Media Type",
- "http://www.w3.org/ns/dcat#mediaType"
+ DCAT.MEDIA_TYPE.stringValue()
)
))
.build()
@@ -200,32 +183,32 @@ public class FactoryDefaults {
.build();
public static ResourceDefinition RESOURCE_DEFINITION_DISTRIBUTION = ResourceDefinition.builder()
- .uuid("02c649de-c579-43bb-b470-306abdc808c7")
+ .uuid(KnownUUIDs.RD_DISTRIBUTION_UUID)
.name("Distribution")
.urlPrefix("distribution")
.shapeUuids(List.of(
- SHAPE_RESOURCE_UUID,
- SHAPE_DISTRIBUTION_UUID
+ KnownUUIDs.SHAPE_RESOURCE_UUID,
+ KnownUUIDs.SHAPE_DISTRIBUTION_UUID
))
.children(List.of())
.externalLinks(List.of(
new ResourceDefinitionLink(
"Access online",
- "http://www.w3.org/ns/dcat#accessURL"
+ DCAT.ACCESS_URL.stringValue()
),
new ResourceDefinitionLink(
"Download",
- "http://www.w3.org/ns/dcat#downloadURL"
+ DCAT.DOWNLOAD_URL.stringValue()
)
))
.build();
//== SHAPES
- //== Changes: Migration_0003_ShapeDefinition, Migration_0005_UpdateShapeDefinition, Migration_0006_ShapesSharing
+ //== Changes: Migration_0003_ShapeDefinition, Migration_0005_UpdateShapeDefinition, Migration_0006_ShapesSharing, Migration_0010_ComplyFDPO
public static Shape shapeResource() throws Exception {
- String definition = loadShape("shape-resource.ttl");
+ String definition = loadClassResource("shape-resource.ttl", FactoryDefaults.class);
return Shape.builder()
- .uuid(SHAPE_RESOURCE_UUID)
+ .uuid(KnownUUIDs.SHAPE_RESOURCE_UUID)
.name("Resource")
.type(ShapeType.INTERNAL)
.published(false)
@@ -234,11 +217,35 @@ public static Shape shapeResource() throws Exception {
.build();
}
- public static Shape shapeRepository() throws Exception {
- String definition = loadShape("shape-repository.ttl");
+ public static Shape shapeFDP() throws Exception {
+ String definition = loadClassResource("shape-fdp.ttl", FactoryDefaults.class);
+ return Shape.builder()
+ .uuid(KnownUUIDs.SHAPE_FDP_UUID)
+ .name("FAIR Data Point")
+ .type(ShapeType.INTERNAL)
+ .published(false)
+ .definition(definition)
+ .targetClasses(ShapeShaclUtils.extractTargetClasses(definition))
+ .build();
+ }
+
+ public static Shape shapeDataService() throws Exception {
+ String definition = loadClassResource("shape-data-service.ttl", FactoryDefaults.class);
return Shape.builder()
- .uuid(SHAPE_REPOSITORY_UUID)
- .name("Repository")
+ .uuid(KnownUUIDs.SHAPE_DATASERVICE_UUID)
+ .name("Data Service")
+ .type(ShapeType.INTERNAL)
+ .published(false)
+ .definition(definition)
+ .targetClasses(ShapeShaclUtils.extractTargetClasses(definition))
+ .build();
+ }
+
+ public static Shape shapeMetadataService() throws Exception {
+ String definition = loadClassResource("shape-metadata-service.ttl", FactoryDefaults.class);
+ return Shape.builder()
+ .uuid(KnownUUIDs.SHAPE_METADATASERVICE_UUID)
+ .name("Metadata Service")
.type(ShapeType.INTERNAL)
.published(false)
.definition(definition)
@@ -247,9 +254,9 @@ public static Shape shapeRepository() throws Exception {
}
public static Shape shapeCatalog() throws Exception {
- String definition = loadShape("shape-catalog.ttl");
+ String definition = loadClassResource("shape-catalog.ttl", FactoryDefaults.class);
return Shape.builder()
- .uuid(SHAPE_CATALOG_UUID)
+ .uuid(KnownUUIDs.SHAPE_CATALOG_UUID)
.name("Catalog")
.type(ShapeType.INTERNAL)
.published(false)
@@ -259,9 +266,9 @@ public static Shape shapeCatalog() throws Exception {
}
public static Shape shapeDataset() throws Exception {
- String definition = loadShape("shape-dataset.ttl");
+ String definition = loadClassResource("shape-dataset.ttl", FactoryDefaults.class);
return Shape.builder()
- .uuid(SHAPE_DATASET_UUID)
+ .uuid(KnownUUIDs.SHAPE_DATASET_UUID)
.name("Dataset")
.type(ShapeType.CUSTOM)
.published(false)
@@ -271,9 +278,9 @@ public static Shape shapeDataset() throws Exception {
}
public static Shape shapeDistribution() throws Exception {
- String definition = loadShape("shape-distribution.ttl");
+ String definition = loadClassResource("shape-distribution.ttl", FactoryDefaults.class);
return Shape.builder()
- .uuid(SHAPE_DISTRIBUTION_UUID)
+ .uuid(KnownUUIDs.SHAPE_DISTRIBUTION_UUID)
.name("Distribution")
.type(ShapeType.CUSTOM)
.published(false)
@@ -371,6 +378,39 @@ public static List repositoryStatements(String persistentUrl, IRI lic
return s;
}
+ public static List fdpStatements(String persistentUrl, IRI license, IRI language, String accessRightsDescription) {
+ List s = new ArrayList<>();
+ IRI baseUrl = i(persistentUrl);
+ FactoryDefaults.add(s, RDF.TYPE, FDP.FAIRDATAPOINT, baseUrl);
+ FactoryDefaults.add(s, RDF.TYPE, FDP.METADATASERVICE, baseUrl);
+ FactoryDefaults.add(s, RDF.TYPE, DCAT.DATA_SERVICE, baseUrl);
+ FactoryDefaults.add(s, RDF.TYPE, DCAT.RESOURCE, baseUrl);
+ FactoryDefaults.add(s, DCTERMS.TITLE, l("My FAIR Data Point"), baseUrl);
+ FactoryDefaults.add(s, RDFS.LABEL, l("My FAIR Data Point"), baseUrl);
+ FactoryDefaults.add(s, DCTERMS.HAS_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);
+ FactoryDefaults.add(s, DCTERMS.DESCRIPTION, l(LIPSUM_TEXT), baseUrl);
+ FactoryDefaults.add(s, DCTERMS.LANGUAGE, language, baseUrl);
+ // Identifier
+ IRI identifierIri = i(persistentUrl + "#identifier");
+ FactoryDefaults.add(s, FDP.METADATAIDENTIFIER, identifierIri, baseUrl);
+ FactoryDefaults.add(s, identifierIri, RDF.TYPE, DATACITE.IDENTIFIER, baseUrl);
+ FactoryDefaults.add(s, identifierIri, DCTERMS.IDENTIFIER, l(persistentUrl), baseUrl);
+ // Access Rights
+ IRI arIri = i(persistentUrl + "#accessRights");
+ FactoryDefaults.add(s, DCTERMS.ACCESS_RIGHTS, arIri, baseUrl);
+ FactoryDefaults.add(s, arIri, RDF.TYPE, DCTERMS.RIGHTS_STATEMENT, baseUrl);
+ FactoryDefaults.add(s, arIri, DCTERMS.DESCRIPTION, l(accessRightsDescription), baseUrl);
+ // Publisher
+ IRI publisherIri = i(persistentUrl + "#publisher");
+ FactoryDefaults.add(s, DCTERMS.PUBLISHER, publisherIri, baseUrl);
+ FactoryDefaults.add(s, publisherIri, RDF.TYPE, FOAF.AGENT, baseUrl);
+ FactoryDefaults.add(s, publisherIri, FOAF.NAME, l("Default Publisher"), baseUrl);
+ return s;
+ }
+
public static Metadata metadataRepository(String persistentUrl) {
return Metadata.builder()
.uri(persistentUrl)
@@ -378,13 +418,6 @@ public static Metadata metadataRepository(String persistentUrl) {
.build();
}
- private static String loadShape(String name) throws Exception {
- return Resources.toString(
- FactoryDefaults.class.getResource(name),
- Charsets.UTF_8
- );
- }
-
private static void add(List statements, IRI predicate, org.eclipse.rdf4j.model.Value object, IRI base) {
statements.add(s(base, predicate, object, base));
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/reset/ResetService.java b/src/main/java/nl/dtls/fairdatapoint/service/reset/ResetService.java
index 080d2acf8..78e7959c3 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/reset/ResetService.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/reset/ResetService.java
@@ -210,7 +210,7 @@ private void restoreDefaultMemberships() {
private void restoreDefaultMetadata() {
log.debug("Creating default metadata");
try (RepositoryConnection conn = repository.getConnection()) {
- List s = FactoryDefaults.repositoryStatements(
+ List s = FactoryDefaults.fdpStatements(
persistentUrl,
license,
language,
@@ -226,7 +226,9 @@ private void restoreDefaultMetadata() {
private void restoreDefaultShapes() throws Exception {
log.debug("Creating default shapes");
shapeRepository.save(FactoryDefaults.shapeResource());
- shapeRepository.save(FactoryDefaults.shapeRepository());
+ shapeRepository.save(FactoryDefaults.shapeDataService());
+ shapeRepository.save(FactoryDefaults.shapeMetadataService());
+ shapeRepository.save(FactoryDefaults.shapeFDP());
shapeRepository.save(FactoryDefaults.shapeCatalog());
shapeRepository.save(FactoryDefaults.shapeDataset());
shapeRepository.save(FactoryDefaults.shapeDistribution());
@@ -234,7 +236,7 @@ private void restoreDefaultShapes() throws Exception {
private void restoreDefaultResourceDefinitions() {
log.debug("Creating default resource definitions");
- resourceDefinitionRepository.save(FactoryDefaults.RESOURCE_DEFINITION_REPOSITORY);
+ resourceDefinitionRepository.save(FactoryDefaults.RESOURCE_DEFINITION_FDP);
resourceDefinitionRepository.save(FactoryDefaults.RESOURCE_DEFINITION_CATALOG);
resourceDefinitionRepository.save(FactoryDefaults.RESOURCE_DEFINITION_DATASET);
resourceDefinitionRepository.save(FactoryDefaults.RESOURCE_DEFINITION_DISTRIBUTION);
diff --git a/src/main/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidator.java b/src/main/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidator.java
index a15c1153b..b370103db 100644
--- a/src/main/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidator.java
+++ b/src/main/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidator.java
@@ -56,6 +56,11 @@ public void validate(ResourceDefinition reqDto) throws BindException {
uniquenessValidationFailed("urlPrefix", reqDto);
}
+ // Check urlPrefix validity
+ if (!isValidPrefixUrl(reqDto.getUrlPrefix())) {
+ throw new ValidationException("URL prefix is not valid");
+ }
+
// Check existence of connected entities
for (ResourceDefinitionChild child : reqDto.getChildren()) {
if (resourceDefinitionCache.getByUuid(child.getResourceDefinitionUuid()) == null) {
@@ -82,4 +87,8 @@ private void validateDependencyCycles(ResourceDefinition reqDto, List getSubjectBy(oldModel, RDF.TYPE, i(rdfType)))
.filter(Objects::nonNull)
.findFirst()
- .orElseThrow(() -> new ValidationException("Validation failed (no rdf:type was provided"));
+ .orElseThrow(() -> new ValidationException("Validation failed (no rdf:type was provided)"));
// - sanitize statements
List sanitizedStatements =
new ArrayList<>(oldModel)
diff --git a/src/main/java/nl/dtls/fairdatapoint/util/ResourceReader.java b/src/main/java/nl/dtls/fairdatapoint/util/ResourceReader.java
index cd0fd6e9f..657ad5ce2 100644
--- a/src/main/java/nl/dtls/fairdatapoint/util/ResourceReader.java
+++ b/src/main/java/nl/dtls/fairdatapoint/util/ResourceReader.java
@@ -22,6 +22,8 @@
*/
package nl.dtls.fairdatapoint.util;
+import com.google.common.base.Charsets;
+import com.google.common.io.Resources;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -54,4 +56,10 @@ public static Resource getResource(String name) {
return resourceLoader.getResource(format("classpath:%s", name));
}
+ public static String loadClassResource(String name, Class cls) throws Exception {
+ return Resources.toString(
+ cls.getResource(name),
+ Charsets.UTF_8
+ );
+ }
}
diff --git a/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/R3D.java b/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/R3D.java
deleted file mode 100644
index dd06d111f..000000000
--- a/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/R3D.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package nl.dtls.fairdatapoint.vocabulary.extended;
-
-import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
-
-/**
- * Class contains missing Re3Data properties
- *
- * @author Rajaram Kaliyaperumal
- * @author Kees Burger
- * @version 0.1
- * @since 2017-04-28
- */
-public class R3D {
-
- public static IRI INSTITUTIONCOUNTRY = SimpleValueFactory.getInstance()
- .createIRI(nl.dtls.fairdatapoint.vocabulary.R3D.NAMESPACE, "institutionCountry");
- public static IRI LASTUPDATE = SimpleValueFactory.getInstance()
- .createIRI(nl.dtls.fairdatapoint.vocabulary.R3D.NAMESPACE, "lastUpdate");
-
-}
diff --git a/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/SCHEMAORG.java b/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/SCHEMAORG.java
deleted file mode 100644
index 2f0d6586d..000000000
--- a/src/main/java/nl/dtls/fairdatapoint/vocabulary/extended/SCHEMAORG.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package nl.dtls.fairdatapoint.vocabulary.extended;
-
-import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
-
-/**
- * Class contains missing schema.org properties
- *
- * @author Rajaram Kaliyaperumal
- * @author Kees Burger
- * @version 0.1
- * @since 2017-04-28
- */
-public class SCHEMAORG {
-
- public static IRI FILE_FORMAT = SimpleValueFactory.getInstance()
- .createIRI(nl.dtls.fairdatapoint.vocabulary.SCHEMAORG.NAMESPACE,
- "encodingFormat");
- public static IRI PERSON = SimpleValueFactory.getInstance()
- .createIRI(nl.dtls.fairdatapoint.vocabulary.SCHEMAORG.NAMESPACE, "Person");
- public static IRI ORGANIZATION = SimpleValueFactory.getInstance()
- .createIRI(nl.dtls.fairdatapoint.vocabulary.SCHEMAORG.NAMESPACE, "Organization");
-}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index ab12ec544..ba0d57e69 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -59,7 +59,7 @@ metadataProperties:
openapi:
title: FAIR Data Point API
- version: 1.12.4
+ version: 1.13.0
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/defaultNavigationShacl.ttl b/src/main/resources/defaultNavigationShacl.ttl
index ec3601ea6..1759bd295 100644
--- a/src/main/resources/defaultNavigationShacl.ttl
+++ b/src/main/resources/defaultNavigationShacl.ttl
@@ -3,6 +3,7 @@
@prefix r3d: .
@prefix dcat: .
@prefix dct: .
+@prefix fdp: .
:repoNavShape a sh:NodeShape ;
sh:targetClass r3d:Repository ;
@@ -11,6 +12,13 @@
sh:node :catNavShape ;
] .
+:fdpNavShape a sh:NodeShape ;
+ sh:targetClass fdp:FAIRDataPoint ;
+ sh:property [
+ sh:path fdp:metadataCatalog ;
+ sh:node :catNavShape ;
+ ] .
+
:catNavShape a sh:NodeShape ;
sh:targetClass dcat:Catalog ;
sh:property [
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-catalog.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-catalog.ttl
new file mode 100644
index 000000000..516a3a59a
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-catalog.ttl
@@ -0,0 +1,31 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix foaf: .
+@prefix sh: .
+@prefix xsd: .
+
+:CatalogShape a sh:NodeShape ;
+ sh:targetClass dcat:Catalog ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path foaf:homePage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:themeTaxonomy ;
+ sh:nodeKind sh:IRI ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom-edited.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom-edited.ttl
new file mode 100644
index 000000000..29d1647fd
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom-edited.ttl
@@ -0,0 +1,19 @@
+@prefix : .
+@prefix sh: .
+@prefix dash: .
+@prefix ex: .
+
+:CustomShape a sh:NodeShape ;
+ sh:targetClass ex:Dog ;
+ sh:property [
+ sh:path ex:identifier ;
+ sh:nodeKind sh:IRI ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ],
+ [
+ sh:path ex:name ;
+ sh:nodeKind sh:Literal ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom.ttl
new file mode 100644
index 000000000..b425ce3e5
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-custom.ttl
@@ -0,0 +1,13 @@
+@prefix : .
+@prefix sh: .
+@prefix dash: .
+@prefix ex: .
+
+:CustomShape a sh:NodeShape ;
+ sh:targetClass ex:Dog ;
+ sh:property [
+ sh:path ex:identifier ;
+ sh:nodeKind sh:IRI ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-data-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-data-service.ttl
new file mode 100644
index 000000000..e23084794
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-data-service.ttl
@@ -0,0 +1,20 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+@prefix xsd: .
+
+:DataServiceShape a sh:NodeShape ;
+ sh:targetClass dcat:DataService ;
+ sh:property [
+ sh:path dcat:endpointURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ] , [
+ sh:path dcat:endpointDescription ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ dash:viewer dash:LiteralViewer ;
+] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-dataset.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-dataset.ttl
new file mode 100644
index 000000000..55536b307
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-dataset.ttl
@@ -0,0 +1,45 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+@prefix xsd: .
+
+:DatasetShape a sh:NodeShape ;
+ sh:targetClass dcat:Dataset ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:theme ;
+ sh:nodeKind sh:IRI ;
+ sh:minCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:contactPoint ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:keyword ;
+ sh:nodeKind sh:Literal ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:landingPage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-distribution.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-distribution.ttl
new file mode 100644
index 000000000..3cbd6a4b5
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-distribution.ttl
@@ -0,0 +1,51 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+@prefix xsd: .
+
+:DistributionShape a sh:NodeShape ;
+ sh:targetClass dcat:Distribution ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path dcat:accessURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ] , [
+ sh:path dcat:downloadURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ] , [
+ sh:path dcat:mediaType ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path dcat:format ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path dcat:byteSize ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-fdp.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-fdp.ttl
new file mode 100644
index 000000000..02acd7106
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-fdp.ttl
@@ -0,0 +1,47 @@
+@prefix : .
+@prefix dash: .
+@prefix dct: .
+@prefix fdp: .
+@prefix sh: .
+@prefix xsd: .
+
+:FDPShape a sh:NodeShape ;
+ sh:targetClass fdp:FAIRDataPoint ;
+ sh:property [
+ sh:path fdp:startDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:endDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:uiLanguage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ sh:defaultValue ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIdentifier ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIssued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:metadataModified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-metadata-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-metadata-service.ttl
new file mode 100644
index 000000000..3943c4675
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-metadata-service.ttl
@@ -0,0 +1,6 @@
+@prefix : .
+@prefix fdp: .
+@prefix sh: .
+
+:MetadataServiceShape a sh:NodeShape ;
+ sh:targetClass fdp:MetadataService .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-resource.ttl
new file mode 100644
index 000000000..2587f288d
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/development/shape/data/shape-resource.ttl
@@ -0,0 +1,64 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix foaf: .
+@prefix sh: .
+@prefix xsd: .
+
+:ResourceShape a sh:NodeShape ;
+ sh:targetClass dcat:Resource ;
+ sh:property [
+ sh:path dct:title ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ], [
+ sh:path dct:description ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ ], [
+ sh:path dct:publisher ;
+ sh:node :AgentShape ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:BlankNodeEditor ;
+ ], [
+ sh:path dct:hasVersion ;
+ sh:name "version" ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:language ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:license ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:rights ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] .
+
+:AgentShape a sh:NodeShape ;
+ sh:targetClass foaf:Agent ;
+ sh:property [
+ sh:path foaf:name;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-catalog.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-catalog.ttl
new file mode 100644
index 000000000..a3ec568c1
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-catalog.ttl
@@ -0,0 +1,24 @@
+@prefix : .
+@prefix sh: .
+@prefix dcat: .
+@prefix dct: .
+@prefix foaf: .
+@prefix dash: .
+
+:CatalogShape a sh:NodeShape ;
+ sh:targetClass dcat:Catalog ;
+ sh:property [
+ sh:path dct:isPartOf ;
+ sh:nodeKind sh:IRI ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ ],
+ [
+ sh:path foaf:homePage ;
+ sh:maxCount 1 ;
+ ],
+ [
+ sh:path dcat:themeTaxonomy ;
+ sh:nodeKind sh:IRI ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-dataset.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-dataset.ttl
new file mode 100644
index 000000000..8f5b142ff
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-dataset.ttl
@@ -0,0 +1,36 @@
+@prefix : .
+@prefix sh: .
+@prefix dcat: .
+@prefix dct: .
+@prefix dash: .
+
+:DatasetShape a sh:NodeShape ;
+ sh:targetClass dcat:Dataset ;
+ sh:property [
+ sh:path dct:isPartOf ;
+ sh:nodeKind sh:IRI ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ ],
+ [
+ sh:path dcat:landingPage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ],
+ [
+ sh:path dcat:theme ;
+ sh:nodeKind sh:IRI ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ],
+ [
+ sh:path dcat:keyword ;
+ sh:nodeKind sh:Literal ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ],
+ [
+ sh:path dcat:contactPoint ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-distribution.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-distribution.ttl
new file mode 100644
index 000000000..f03df092a
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-distribution.ttl
@@ -0,0 +1,45 @@
+@prefix : .
+@prefix sh: .
+@prefix dcat: .
+@prefix dct: .
+@prefix dash: .
+
+:DistributionShape a sh:NodeShape ;
+ sh:targetClass dcat:Distribution ;
+ sh:property [
+ sh:path dct:isPartOf ;
+ sh:nodeKind sh:IRI ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ ],
+ [
+ sh:path dcat:accessURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ],
+ [
+ sh:path dcat:downloadURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ],
+ [
+ sh:path dcat:mediaType ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ],
+ [
+ sh:path dcat:format ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ],
+ [
+ sh:path dcat:byteSize ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-repository.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-repository.ttl
new file mode 100644
index 000000000..bb7712fbc
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-repository.ttl
@@ -0,0 +1,27 @@
+@prefix : .
+@prefix sh: .
+@prefix xsd: .
+@prefix r3d: .
+
+:RepositoryShape a sh:NodeShape ;
+ sh:targetClass r3d:Repository ;
+ sh:property [
+ sh:path r3d:startDate ;
+ sh:datatype xsd:date ;
+ sh:maxCount 1 ;
+ ] ,
+ [
+ sh:path r3d:lastUpdate ;
+ sh:datatype xsd:date ;
+ sh:maxCount 1 ;
+ ] ,
+ [
+ sh:path r3d:institution ;
+ sh:class r3d:Institution ;
+ sh:maxCount 1 ;
+ ] ,
+ [
+ sh:path r3d:institutionCountry ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-resource.ttl
new file mode 100644
index 000000000..9662882d7
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0003_shape-resource.ttl
@@ -0,0 +1,59 @@
+@prefix : .
+@prefix sh: .
+@prefix dcat: .
+@prefix dct: .
+@prefix xsd: .
+@prefix dash: .
+
+:ResourceShape a sh:NodeShape ;
+ sh:targetClass dcat:Resource ;
+ sh:property [
+ sh:path dct:title ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ], [
+ sh:path dct:description ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ ], [
+ sh:path dct:hasVersion ;
+ sh:name "version" ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:license ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:conformsTo ;
+ sh:name "specification" ;
+ sh:maxCount 1 ;
+ sh:nodeKind sh:IRI ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:language ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:rights ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ], [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-catalog.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-catalog.ttl
new file mode 100644
index 000000000..6d823dd50
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-catalog.ttl
@@ -0,0 +1,30 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix foaf: .
+@prefix sh: .
+
+:CatalogShape a sh:NodeShape ;
+ sh:targetClass dcat:Catalog ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path foaf:homePage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:themeTaxonomy ;
+ sh:nodeKind sh:IRI ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-dataset.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-dataset.ttl
new file mode 100644
index 000000000..a47a56a50
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-dataset.ttl
@@ -0,0 +1,44 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+
+:DatasetShape a sh:NodeShape ;
+ sh:targetClass dcat:Dataset ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:theme ;
+ sh:nodeKind sh:IRI ;
+ sh:minCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:contactPoint ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dcat:keyword ;
+ sh:nodeKind sh:Literal ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:landingPage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-distribution.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-distribution.ttl
new file mode 100644
index 000000000..a26eae1e4
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-distribution.ttl
@@ -0,0 +1,50 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+
+:DistributionShape a sh:NodeShape ;
+ sh:targetClass dcat:Distribution ;
+ sh:property [
+ sh:path dct:issued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:modified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:accessURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ], [
+ sh:path dcat:downloadURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ ], [
+ sh:path dcat:mediaType ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:format ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dcat:byteSize ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-repository.ttl
similarity index 100%
rename from src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-repository.ttl
rename to src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-repository.ttl
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-resource.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-resource.ttl
new file mode 100644
index 000000000..2587f288d
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0005_shape-resource.ttl
@@ -0,0 +1,64 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix foaf: .
+@prefix sh: .
+@prefix xsd: .
+
+:ResourceShape a sh:NodeShape ;
+ sh:targetClass dcat:Resource ;
+ sh:property [
+ sh:path dct:title ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ], [
+ sh:path dct:description ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ ], [
+ sh:path dct:publisher ;
+ sh:node :AgentShape ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:BlankNodeEditor ;
+ ], [
+ sh:path dct:hasVersion ;
+ sh:name "version" ;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ], [
+ sh:path dct:language ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:license ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ], [
+ sh:path dct:rights ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] .
+
+:AgentShape a sh:NodeShape ;
+ sh:targetClass foaf:Agent ;
+ sh:property [
+ sh:path foaf:name;
+ sh:nodeKind sh:Literal ;
+ sh:minCount 1 ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextFieldEditor ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-data-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-data-service.ttl
new file mode 100644
index 000000000..e23084794
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-data-service.ttl
@@ -0,0 +1,20 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+@prefix xsd: .
+
+:DataServiceShape a sh:NodeShape ;
+ sh:targetClass dcat:DataService ;
+ sh:property [
+ sh:path dcat:endpointURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ] , [
+ sh:path dcat:endpointDescription ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ dash:viewer dash:LiteralViewer ;
+] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-fdp.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-fdp.ttl
new file mode 100644
index 000000000..02acd7106
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-fdp.ttl
@@ -0,0 +1,47 @@
+@prefix : .
+@prefix dash: .
+@prefix dct: .
+@prefix fdp: .
+@prefix sh: .
+@prefix xsd: .
+
+:FDPShape a sh:NodeShape ;
+ sh:targetClass fdp:FAIRDataPoint ;
+ sh:property [
+ sh:path fdp:startDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:endDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:uiLanguage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ sh:defaultValue ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIdentifier ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIssued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:metadataModified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-metadata-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-metadata-service.ttl
new file mode 100644
index 000000000..3943c4675
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/database/mongo/migration/production/0011_shape-metadata-service.ttl
@@ -0,0 +1,6 @@
+@prefix : .
+@prefix fdp: .
+@prefix sh: .
+
+:MetadataServiceShape a sh:NodeShape ;
+ sh:targetClass fdp:MetadataService .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
index 6d823dd50..516a3a59a 100644
--- a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-catalog.ttl
@@ -4,6 +4,7 @@
@prefix dct: .
@prefix foaf: .
@prefix sh: .
+@prefix xsd: .
:CatalogShape a sh:NodeShape ;
sh:targetClass dcat:Catalog ;
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-data-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-data-service.ttl
new file mode 100644
index 000000000..2ca91fa4a
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-data-service.ttl
@@ -0,0 +1,20 @@
+@prefix : .
+@prefix dash: .
+@prefix dcat: .
+@prefix dct: .
+@prefix sh: .
+@prefix xsd: .
+
+:DataServiceShape a sh:NodeShape ;
+ sh:targetClass dcat:DataService ;
+ sh:property [
+ sh:path dcat:endpointURL ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ ] , [
+ sh:path dcat:endpointDescription ;
+ sh:nodeKind sh:Literal ;
+ sh:maxCount 1 ;
+ dash:editor dash:TextAreaEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
index a47a56a50..55536b307 100644
--- a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-dataset.ttl
@@ -3,6 +3,7 @@
@prefix dcat: .
@prefix dct: .
@prefix sh: .
+@prefix xsd: .
:DatasetShape a sh:NodeShape ;
sh:targetClass dcat:Dataset ;
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
index a26eae1e4..a48581820 100644
--- a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-distribution.ttl
@@ -3,6 +3,7 @@
@prefix dcat: .
@prefix dct: .
@prefix sh: .
+@prefix xsd: .
:DistributionShape a sh:NodeShape ;
sh:targetClass dcat:Distribution ;
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-fdp.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-fdp.ttl
new file mode 100644
index 000000000..02acd7106
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-fdp.ttl
@@ -0,0 +1,47 @@
+@prefix : .
+@prefix dash: .
+@prefix dct: .
+@prefix fdp: .
+@prefix sh: .
+@prefix xsd: .
+
+:FDPShape a sh:NodeShape ;
+ sh:targetClass fdp:FAIRDataPoint ;
+ sh:property [
+ sh:path fdp:startDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:endDate ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:uiLanguage ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ sh:defaultValue ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIdentifier ;
+ sh:nodeKind sh:IRI ;
+ sh:maxCount 1 ;
+ dash:editor dash:URIEditor ;
+ dash:viewer dash:LabelViewer ;
+ ] , [
+ sh:path fdp:metadataIssued ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] , [
+ sh:path fdp:metadataModified ;
+ sh:datatype xsd:dateTime ;
+ sh:maxCount 1 ;
+ dash:editor dash:DatePickerEditor ;
+ dash:viewer dash:LiteralViewer ;
+ ] .
diff --git a/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-metadata-service.ttl b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-metadata-service.ttl
new file mode 100644
index 000000000..3943c4675
--- /dev/null
+++ b/src/main/resources/nl/dtls/fairdatapoint/service/reset/shape-metadata-service.ttl
@@ -0,0 +1,6 @@
+@prefix : .
+@prefix fdp: .
+@prefix sh: .
+
+:MetadataServiceShape a sh:NodeShape ;
+ sh:targetClass fdp:MetadataService .
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_DELETE.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_DELETE.java
index bad02dc6d..a4b19d401 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_DELETE.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_DELETE.java
@@ -45,8 +45,9 @@ private URI url() {
}
@Test
- @DisplayName("HTTP 404")
- public void res404() {
+ @DisplayName("HTTP 405")
+ public void res405() {
+ // Repository metadata exist but cannot be deleted (only updated and retrieved)
// GIVEN:
RequestEntity request = RequestEntity
.delete(url())
@@ -61,7 +62,7 @@ public void res404() {
ResponseEntity result = client.exchange(request, responseType);
// THEN:
- assertThat(result.getStatusCode(), is(equalTo(HttpStatus.NOT_FOUND)));
+ assertThat(result.getStatusCode(), is(equalTo(HttpStatus.METHOD_NOT_ALLOWED)));
}
}
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_POST.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_POST.java
new file mode 100644
index 000000000..712bca794
--- /dev/null
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_POST.java
@@ -0,0 +1,68 @@
+/**
+ * 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.acceptance.metadata.repository;
+
+import nl.dtls.fairdatapoint.WebIntegrationTest;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+
+import java.net.URI;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+@DisplayName("POST /")
+public class Detail_POST extends WebIntegrationTest {
+
+ private URI url() {
+ return URI.create("/");
+ }
+
+ @Test
+ @DisplayName("HTTP 415")
+ public void res415() {
+ // POST / is used for pinging that expects JSON data
+ // GIVEN:
+ RequestEntity request = RequestEntity
+ .post(url())
+ .header(HttpHeaders.AUTHORIZATION, ADMIN_TOKEN)
+ .header(HttpHeaders.CONTENT_TYPE, "text/turtle")
+ .header(HttpHeaders.ACCEPT, "text/turtle")
+ .build();
+ ParameterizedTypeReference responseType = new ParameterizedTypeReference<>() {
+ };
+
+ // WHEN:
+ ResponseEntity result = client.exchange(request, responseType);
+
+ // THEN:
+ assertThat(result.getStatusCode(), is(equalTo(HttpStatus.UNSUPPORTED_MEDIA_TYPE)));
+ }
+
+}
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_PUT.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_PUT.java
index beeb85863..c41029e7d 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_PUT.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/Detail_PUT.java
@@ -59,7 +59,7 @@ private URI url() {
}
private String reqDto() {
- Model repository = testMetadataFixtures.repositoryMetadata();
+ Model repository = testMetadataFixtures.fdpMetadata();
IRI uri = getUri(repository);
setTitle(repository, uri, l("EDITED: Some title"));
setDescription(repository, uri, l("EDITED: Some description"));
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_GET.java
index ece3a1695..3fc55f76b 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_GET.java
@@ -73,7 +73,7 @@ public void res200() {
assertThat(result.getStatusCode(), is(equalTo(HttpStatus.OK)));
assertEmptyMember(result.getBody().getMember());
assertThat(result.getBody().getState(), is(equalTo(new MetaStateDTO(
- metadataFixtures.repositoryMetadata().getState(),
+ metadataFixtures.fdpMetadata().getState(),
Map.of(
metadataFixtures.catalog1().getUri(), metadataFixtures.catalog1().getState(),
metadataFixtures.catalog2().getUri(), metadataFixtures.catalog2().getState()
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_State_PUT.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_State_PUT.java
index a35767a03..0c7d01985 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_State_PUT.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/metadata/repository/meta/List_State_PUT.java
@@ -76,7 +76,7 @@ public void res200() {
};
// AND: Prepare database
- Metadata metadata = metadataRepository.findByUri(metadataFixtures.repositoryMetadata().getUri()).get();
+ Metadata metadata = metadataRepository.findByUri(metadataFixtures.fdpMetadata().getUri()).get();
metadata.setState(MetadataState.DRAFT);
metadataRepository.save(metadata);
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
index 7a3791ce4..65d8b4ee1 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/openapi/SwaggerUI_GET.java
@@ -48,7 +48,7 @@ private URI baseUrl() {
}
private URI redirectedUrl() {
- return URI.create("/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config");
+ return URI.create("/swagger-ui/index.html");
}
@Test
@@ -66,7 +66,7 @@ public void res302_redirectsToSwaggerUI() {
// THEN
assertThat("Response code is FOUND", result.getStatusCode(), is(equalTo(HttpStatus.FOUND)));
assertThat("Contains Location header", result.getHeaders().getLocation(), is(notNullValue()));
- assertThat("Contains correct Location header", result.getHeaders().getLocation().toString().endsWith(redirectedUrl().toString()), is(Boolean.TRUE));
+ assertThat("Contains correct Location header", result.getHeaders().getLocation().toString(), is(equalTo(redirectedUrl().toString())));
}
@Test
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_DELETE.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_DELETE.java
index e97158b2c..85def67c0 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_DELETE.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_DELETE.java
@@ -57,7 +57,7 @@ private URI url(String uuid) {
@DisplayName("HTTP 204")
public void res204() {
// GIVEN:
- ResourceDefinition resourceDefinition = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition resourceDefinition = resourceDefinitionFixtures.fdpDefinition();
RequestEntity request = RequestEntity
.delete(url(resourceDefinition.getUuid()))
.header(HttpHeaders.AUTHORIZATION, ADMIN_TOKEN)
@@ -75,14 +75,14 @@ public void res204() {
@Test
@DisplayName("HTTP 403: User is not authenticated")
public void res403_notAuthenticated() {
- ResourceDefinition resourceDefinition = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition resourceDefinition = resourceDefinitionFixtures.fdpDefinition();
createUserForbiddenTestDelete(client, url(resourceDefinition.getUuid()));
}
@Test
@DisplayName("HTTP 403: User is not an admin")
public void res403_resourceDefinition() {
- ResourceDefinition resourceDefinition = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition resourceDefinition = resourceDefinitionFixtures.fdpDefinition();
createUserForbiddenTestDelete(client, url(resourceDefinition.getUuid()));
}
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_GET.java
index 7e4686e19..d4e5e8a60 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_GET.java
@@ -55,7 +55,7 @@ private URI url(String uuid) {
@DisplayName("HTTP 200")
public void res200() {
// GIVEN:
- ResourceDefinition resourceDefinition = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition resourceDefinition = resourceDefinitionFixtures.fdpDefinition();
RequestEntity request = RequestEntity
.get(url(resourceDefinition.getUuid()))
.build();
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_PUT.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_PUT.java
index 576db354f..ff79ec5b1 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_PUT.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/Detail_PUT.java
@@ -56,7 +56,7 @@ private URI url(String uuid) {
private ResourceDefinitionChangeDTO reqDto(ResourceDefinition rd) {
rd.setName(format("EDITED: %s", rd.getName()));
- rd.setUrlPrefix(format("%s-edited", rd.getName()));
+ rd.setUrlPrefix(format("%s-edited", rd.getUrlPrefix()));
return resourceDefinitionMapper.toChangeDTO(rd);
}
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/List_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/List_GET.java
index 36f7b2299..1c8eed227 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/List_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/resource/List_GET.java
@@ -67,7 +67,7 @@ public void res200() {
assertThat(result.getStatusCode(), is(equalTo(HttpStatus.OK)));
List body = result.getBody();
assertThat(body, is(equalTo(List.of(
- resourceDefinitionFixtures.repositoryDefinition(),
+ resourceDefinitionFixtures.fdpDefinition(),
resourceDefinitionFixtures.catalogDefinition(),
resourceDefinitionFixtures.datasetDefinition(),
resourceDefinitionFixtures.distributionDefinition()
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_DELETE.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_DELETE.java
index 803e6b898..3fdf37754 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_DELETE.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_DELETE.java
@@ -101,7 +101,7 @@ public void res400_used() {
@DisplayName("HTTP 400: Delete INTERNAL shape")
public void res400_internal() {
// GIVEN:
- Shape shape = shapeFixtures.repositoryShape();
+ Shape shape = shapeFixtures.fdpShape();
RequestEntity request = RequestEntity
.delete(url(shape.getUuid()))
.header(HttpHeaders.AUTHORIZATION, ADMIN_TOKEN)
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_GET.java
index c053f3670..83a243bfc 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_GET.java
@@ -56,7 +56,7 @@ private URI url(String uuid) {
@DisplayName("HTTP 200")
public void res200() {
// GIVEN:
- Shape shape = shapeFixtures.repositoryShape();
+ Shape shape = shapeFixtures.fdpShape();
RequestEntity request = RequestEntity
.get(url(shape.getUuid()))
.build();
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_PUT.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_PUT.java
index c4ea8d004..c6676b592 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_PUT.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/Detail_PUT.java
@@ -149,7 +149,7 @@ public void res400_invalidShacl() {
@DisplayName("HTTP 200: Edit INTERNAL shape")
public void res200_internal() {
// GIVEN:
- Shape shape = shapeFixtures.repositoryShape();
+ Shape shape = shapeFixtures.fdpShape();
ShapeChangeDTO reqDto = reqDto(shape);
RequestEntity request = RequestEntity
.put(url(shape.getUuid()))
@@ -170,14 +170,14 @@ public void res200_internal() {
@Test
@DisplayName("HTTP 403: User is not authenticated")
public void res403_notAuthenticated() {
- Shape shape = shapeFixtures.repositoryShape();
+ Shape shape = shapeFixtures.fdpShape();
createNoUserForbiddenTestPut(client, url(shape.getUuid()), reqDto(shape));
}
@Test
@DisplayName("HTTP 403: User is not an admin")
public void res403_shape() {
- Shape shape = shapeFixtures.repositoryShape();
+ Shape shape = shapeFixtures.fdpShape();
createUserForbiddenTestPut(client, url(shape.getUuid()), reqDto(shape));
}
diff --git a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/List_GET.java b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/List_GET.java
index f7aa4e5a7..81df2a91e 100644
--- a/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/List_GET.java
+++ b/src/test/java/nl/dtls/fairdatapoint/acceptance/shape/List_GET.java
@@ -66,12 +66,14 @@ public void res200() {
// THEN:
assertThat(result.getStatusCode(), is(equalTo(HttpStatus.OK)));
List body = result.getBody();
- assertThat(body.size(), is(equalTo(5)));
+ assertThat(body.size(), is(equalTo(7)));
Common.compare(shapeFixtures.resourceShape(), body.get(0));
- Common.compare(shapeFixtures.repositoryShape(), body.get(1));
- Common.compare(shapeFixtures.catalogShape(), body.get(2));
- Common.compare(shapeFixtures.datasetShape(), body.get(3));
- Common.compare(shapeFixtures.distributionShape(), body.get(4));
+ Common.compare(shapeFixtures.fdpShape(), body.get(1));
+ Common.compare(shapeFixtures.dataServiceShape(), body.get(2));
+ Common.compare(shapeFixtures.metadataServiceShape(), body.get(3));
+ Common.compare(shapeFixtures.catalogShape(), body.get(4));
+ Common.compare(shapeFixtures.datasetShape(), body.get(5));
+ Common.compare(shapeFixtures.distributionShape(), body.get(6));
}
}
diff --git a/src/test/java/nl/dtls/fairdatapoint/service/index/harvester/HarvesterServiceTest.java b/src/test/java/nl/dtls/fairdatapoint/service/index/harvester/HarvesterServiceTest.java
index 62c7a0b01..6530b445b 100644
--- a/src/test/java/nl/dtls/fairdatapoint/service/index/harvester/HarvesterServiceTest.java
+++ b/src/test/java/nl/dtls/fairdatapoint/service/index/harvester/HarvesterServiceTest.java
@@ -31,6 +31,7 @@
import nl.dtls.fairdatapoint.service.metadata.enhance.MetadataEnhancer;
import nl.dtls.fairdatapoint.service.profile.ProfileService;
import nl.dtls.fairdatapoint.service.resource.ResourceDefinitionCache;
+import nl.dtls.fairdatapoint.vocabulary.FDP;
import nl.dtls.fairdatapoint.vocabulary.R3D;
import org.eclipse.rdf4j.model.Model;
import org.junit.jupiter.api.BeforeEach;
@@ -90,12 +91,12 @@ private void setup() {
RdfMetadataFixtures fixtures = new RdfMetadataFixtures(new MetadataFactoryImpl());
// Create repository
- repository = fixtures.repositoryMetadata(repositoryUrl);
- ResourceDefinition rdRepository = resourceDefinitionFixtures.repositoryDefinition();
+ repository = fixtures.fdpMetadata(repositoryUrl);
+ ResourceDefinition rdRepository = resourceDefinitionFixtures.fdpDefinition();
// Create catalog
catalog = fixtures.catalog1(repositoryUrl, getUri(repository));
- repository.add(i(repositoryUrl), R3D.DATACATALOG, i(catalogUrl));
+ repository.add(i(repositoryUrl), FDP.METADATACATALOG, i(catalogUrl));
}
@Test
diff --git a/src/test/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataServiceTest.java b/src/test/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataServiceTest.java
index fe45771b9..cca77994e 100644
--- a/src/test/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataServiceTest.java
+++ b/src/test/java/nl/dtls/fairdatapoint/service/metadata/generic/GenericMetadataServiceTest.java
@@ -75,8 +75,8 @@ public void before() {
@Test
public void retrieveNonExitingMetadataThrowsError() {
// GIVEN:
- IRI repositoryUri = getUri(testMetadataFixtures.repositoryMetadata());
- IRI metadataUri = i(format("%s/distribution/non-existing", repositoryUri));
+ IRI fdpUri = getUri(testMetadataFixtures.fdpMetadata());
+ IRI metadataUri = i(format("%s/distribution/non-existing", fdpUri));
// WHEN:
ResourceNotFoundException exception = assertThrows(
@@ -123,7 +123,7 @@ public void storeWithNoParentURIThrowsError() {
public void storeWithWrongParentURIThrowsError() {
// GIVEN:
ResourceDefinition metadataRd = resourceDefinitionFixtures.distributionDefinition();
- Model repository = testMetadataFixtures.repositoryMetadata();
+ Model repository = testMetadataFixtures.fdpMetadata();
Model metadata = testMetadataFixtures.c1_d1_distribution1();
setParent(metadata, getUri(metadata), getUri(repository));
@@ -134,7 +134,7 @@ public void storeWithWrongParentURIThrowsError() {
);
// THEN:
- assertThat(exception.getMessage(), is(equalTo("Parent is not of correct type (RD: Repository)")));
+ assertThat(exception.getMessage(), is(equalTo("Parent is not of correct type (RD: FAIR Data Point)")));
}
@Test
@@ -186,7 +186,7 @@ public void storeWithNoLanguage() throws Exception {
public void updateParent() throws Exception {
// GIVEN:
ResourceDefinition metadataRd = resourceDefinitionFixtures.distributionDefinition();
- Model repository = testMetadataFixtures.repositoryMetadata();
+ Model repository = testMetadataFixtures.fdpMetadata();
Model catalog = testMetadataFixtures.catalog1();
Model dataset = testMetadataFixtures.c1_dataset1();
Model distribution = testMetadataFixtures.c1_d1_distribution1();
diff --git a/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java b/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java
index d18ed54ec..c505bd9b1 100644
--- a/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java
+++ b/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionCacheTest.java
@@ -48,7 +48,7 @@ public class ResourceDefinitionCacheTest extends BaseIntegrationTest {
@Test
public void computeCacheWorks() {
// GIVEN: Resource definitions
- ResourceDefinition rdRepository = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition rdRepository = resourceDefinitionFixtures.fdpDefinition();
ResourceDefinition rdCatalog = resourceDefinitionFixtures.catalogDefinition();
ResourceDefinition rdDataset = resourceDefinitionFixtures.datasetDefinition();
ResourceDefinition rdDistribution = resourceDefinitionFixtures.distributionDefinition();
diff --git a/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidatorTest.java b/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidatorTest.java
index 06af988c8..18c21bbc3 100644
--- a/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidatorTest.java
+++ b/src/test/java/nl/dtls/fairdatapoint/service/resource/ResourceDefinitionValidatorTest.java
@@ -62,12 +62,12 @@ public class ResourceDefinitionValidatorTest {
@Test
public void nameUniqueness() throws BindException {
// GIVEN: Prepare reqDto
- ResourceDefinition reqDto = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition reqDto = resourceDefinitionFixtures.fdpDefinition();
reqDto.setChildren(List.of());
// AND: Prepare database
when(resourceDefinitionRepository.findByName(reqDto.getName()))
- .thenReturn(Optional.of(resourceDefinitionFixtures.repositoryDefinition()));
+ .thenReturn(Optional.of(resourceDefinitionFixtures.fdpDefinition()));
// WHEN:
resourceDefinitionValidator.validate(reqDto);
@@ -83,7 +83,7 @@ public void nameUniquenessBreach() {
// AND: Prepare database
when(resourceDefinitionRepository.findByName(reqDto.getName()))
- .thenReturn(Optional.of(resourceDefinitionFixtures.repositoryDefinition()));
+ .thenReturn(Optional.of(resourceDefinitionFixtures.fdpDefinition()));
// WHEN:
BindException exception = assertThrows(
@@ -98,14 +98,14 @@ public void nameUniquenessBreach() {
@Test
public void urlPrefixUniqueness() throws BindException {
// GIVEN: Prepare reqDto
- ResourceDefinition reqDto = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition reqDto = resourceDefinitionFixtures.fdpDefinition();
reqDto.setChildren(List.of());
// AND: Prepare database
when(resourceDefinitionRepository.findByName(reqDto.getName()))
.thenReturn(Optional.empty());
when(resourceDefinitionRepository.findByUrlPrefix(reqDto.getUrlPrefix()))
- .thenReturn(Optional.of(resourceDefinitionFixtures.repositoryDefinition()));
+ .thenReturn(Optional.of(resourceDefinitionFixtures.fdpDefinition()));
// WHEN:
resourceDefinitionValidator.validate(reqDto);
@@ -123,7 +123,7 @@ public void urlPrefixUniquenessBreach() {
when(resourceDefinitionRepository.findByName(reqDto.getName()))
.thenReturn(Optional.empty());
when(resourceDefinitionRepository.findByUrlPrefix(reqDto.getUrlPrefix()))
- .thenReturn(Optional.of(resourceDefinitionFixtures.repositoryDefinition()));
+ .thenReturn(Optional.of(resourceDefinitionFixtures.fdpDefinition()));
// WHEN:
BindException exception = assertThrows(
@@ -163,7 +163,7 @@ public void nonExistingChild() {
@Test
public void existingDependencyCycle() {
// GIVEN: Prepare reqDto and resource definitions
- ResourceDefinition rdRepository = resourceDefinitionFixtures.repositoryDefinition();
+ ResourceDefinition rdRepository = resourceDefinitionFixtures.fdpDefinition();
ResourceDefinition reqDto = resourceDefinitionFixtures.catalogDefinition();
ResourceDefinition rdDataset = resourceDefinitionFixtures.datasetDefinition();
diff --git a/src/test/java/nl/dtls/fairdatapoint/utils/TestRdfMetadataFixtures.java b/src/test/java/nl/dtls/fairdatapoint/utils/TestRdfMetadataFixtures.java
index 424a63265..d2c783911 100644
--- a/src/test/java/nl/dtls/fairdatapoint/utils/TestRdfMetadataFixtures.java
+++ b/src/test/java/nl/dtls/fairdatapoint/utils/TestRdfMetadataFixtures.java
@@ -56,29 +56,29 @@ public TestRdfMetadataFixtures(MetadataFactory metadataFactory,
this.resourceDefinitionFixtures = resourceDefinitionFixtures;
}
- public Model repositoryMetadata() {
- Model metadata = super.repositoryMetadata(persistentUrl);
- ResourceDefinition rd = resourceDefinitionFixtures.repositoryDefinition();
+ public Model fdpMetadata() {
+ Model metadata = super.fdpMetadata(persistentUrl);
+ ResourceDefinition rd = resourceDefinitionFixtures.fdpDefinition();
metadataEnhancer.enhance(metadata, getUri(metadata), rd);
return metadata;
}
public Model catalog1() {
- Model metadata = super.catalog1(persistentUrl, getUri(repositoryMetadata()));
+ Model metadata = super.catalog1(persistentUrl, getUri(fdpMetadata()));
ResourceDefinition rd = resourceDefinitionFixtures.catalogDefinition();
metadataEnhancer.enhance(metadata, getUri(metadata), rd);
return metadata;
}
public Model catalog2() {
- Model metadata = super.catalog2(persistentUrl, getUri(repositoryMetadata()));
+ Model metadata = super.catalog2(persistentUrl, getUri(fdpMetadata()));
ResourceDefinition rd = resourceDefinitionFixtures.catalogDefinition();
metadataEnhancer.enhance(metadata, getUri(metadata), rd);
return metadata;
}
public Model catalog3() {
- Model metadata = super.catalog3(persistentUrl, getUri(repositoryMetadata()));
+ Model metadata = super.catalog3(persistentUrl, getUri(fdpMetadata()));
ResourceDefinition rd = resourceDefinitionFixtures.catalogDefinition();
metadataEnhancer.enhance(metadata, getUri(metadata), rd);
return metadata;
@@ -86,7 +86,7 @@ public Model catalog3() {
public Model alternative_catalog3() {
Model metadata = super.catalog3(alternativePersistentUrl,
- getUri(super.repositoryMetadata(alternativePersistentUrl)));
+ getUri(super.fdpMetadata(alternativePersistentUrl)));
ResourceDefinition rd = resourceDefinitionFixtures.catalogDefinition();
metadataEnhancer.enhance(metadata, getUri(metadata), rd);
return metadata;