From 703b284b924bced08473188a79a8c2ceff4e9807 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 17 Jan 2024 14:53:10 +0100 Subject: [PATCH] Fixed query to properly support IS model changes refs #24992 --- CHANGELOG.md | 4 +++ pom.xml | 2 +- .../01-get-catalogue-virtual-service.json | 6 ++-- .../query/02-get-catalogue-configuration.json | 14 +++++----- ...mple-facet-of-catalogue-configuration.json | 20 ++++++------- .../resources/query/04-get-ckan-service.json | 14 +++++----- ...et-access-point-facet-of-ckan-service.json | 20 ++++++------- .../query/06-get-postgres-ckan-db.json | 22 +++++++-------- ...ccess-point-facet-of-postgres-ckan-db.json | 28 +++++++++---------- .../resources/query/08-get-solr-service.json | 22 +++++++-------- ...et-access-point-facet-of-solr-service.json | 28 +++++++++---------- .../org/gcube/gcat/profile/ProfileTest.java | 9 ++++++ .../org/gcube/gcat/utils/ConstantsTest.java | 6 ++++ src/test/resources/regex.txt | 1 + 14 files changed, 108 insertions(+), 88 deletions(-) create mode 100644 src/test/resources/regex.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 3162186..2413322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # Changelog for gCube Catalogue (gCat) Service +## [v2.5.2-SNAPSHOT] + + + ## [v2.5.1] - Migrated code to reorganized E/R format [#24992] diff --git a/pom.xml b/pom.xml index 6b6380c..bf8af32 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.gcube.data-catalogue gcat war - 2.5.1 + 2.5.2-SNAPSHOT gCube Catalogue (gCat) Service This service allows any client to publish on the gCube Catalogue. diff --git a/src/main/resources/query/01-get-catalogue-virtual-service.json b/src/main/resources/query/01-get-catalogue-virtual-service.json index 9070bb3..6d11ab4 100644 --- a/src/main/resources/query/01-get-catalogue-virtual-service.json +++ b/src/main/resources/query/01-get-catalogue-virtual-service.json @@ -1,10 +1,10 @@ { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/02-get-catalogue-configuration.json b/src/main/resources/query/02-get-catalogue-configuration.json index 2b92ac7..52087c8 100644 --- a/src/main/resources/query/02-get-catalogue-configuration.json +++ b/src/main/resources/query/02-get-catalogue-configuration.json @@ -1,24 +1,24 @@ { - "@class": "Configuration", + "type": "Configuration", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "IdentifierFacet", + "type": "IdentifierFacet", "value": "catalogue-configuration" } } ], "isRelatedTo": [ { - "@class": "IsCustomizedBy", + "type": "IsCustomizedBy", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/03-get-simple-facet-of-catalogue-configuration.json b/src/main/resources/query/03-get-simple-facet-of-catalogue-configuration.json index 5ee9d9b..9ecfdb1 100644 --- a/src/main/resources/query/03-get-simple-facet-of-catalogue-configuration.json +++ b/src/main/resources/query/03-get-simple-facet-of-catalogue-configuration.json @@ -1,28 +1,28 @@ { - "@class": "SimpleFacet", - "_in": { - "@class": "ConsistsOf", + "type": "SimpleFacet", + "_source": { + "type": "ConsistsOf", "source": { - "@class": "Configuration", + "type": "Configuration", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "IdentifierFacet", + "type": "IdentifierFacet", "value": "gcat-configuration" } } ], "isRelatedTo": [ { - "@class": "IsCustomizedBy", + "type": "IsCustomizedBy", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/04-get-ckan-service.json b/src/main/resources/query/04-get-ckan-service.json index bfccb4f..8196a89 100644 --- a/src/main/resources/query/04-get-ckan-service.json +++ b/src/main/resources/query/04-get-ckan-service.json @@ -1,10 +1,10 @@ { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -12,14 +12,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/05-get-access-point-facet-of-ckan-service.json b/src/main/resources/query/05-get-access-point-facet-of-ckan-service.json index 2cc1960..ed48cd8 100644 --- a/src/main/resources/query/05-get-access-point-facet-of-ckan-service.json +++ b/src/main/resources/query/05-get-access-point-facet-of-ckan-service.json @@ -1,14 +1,14 @@ { - "@class": "AccessPointFacet", - "_in": { - "@class": "ConsistsOf", + "type": "AccessPointFacet", + "_source": { + "type": "ConsistsOf", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -16,14 +16,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/06-get-postgres-ckan-db.json b/src/main/resources/query/06-get-postgres-ckan-db.json index ea692c7..bba8ab2 100644 --- a/src/main/resources/query/06-get-postgres-ckan-db.json +++ b/src/main/resources/query/06-get-postgres-ckan-db.json @@ -1,10 +1,10 @@ { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.postgresql", "name": "postgresql" } @@ -12,14 +12,14 @@ ], "isRelatedTo": [ { - "@class": "Uses", + "type": "Uses", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -27,14 +27,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/07-get-access-point-facet-of-postgres-ckan-db.json b/src/main/resources/query/07-get-access-point-facet-of-postgres-ckan-db.json index ede06dd..9af7851 100644 --- a/src/main/resources/query/07-get-access-point-facet-of-postgres-ckan-db.json +++ b/src/main/resources/query/07-get-access-point-facet-of-postgres-ckan-db.json @@ -1,14 +1,14 @@ { - "@class": "AccessPointFacet", - "_in": { - "@class": "ConsistsOf", + "type": "AccessPointFacet", + "_source": { + "type": "ConsistsOf", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.postgresql", "name": "postgresql" } @@ -16,14 +16,14 @@ ], "isRelatedTo": [ { - "@class": "Uses", + "type": "Uses", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -31,14 +31,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/08-get-solr-service.json b/src/main/resources/query/08-get-solr-service.json index 4830884..413d65b 100644 --- a/src/main/resources/query/08-get-solr-service.json +++ b/src/main/resources/query/08-get-solr-service.json @@ -1,10 +1,10 @@ { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.apache.solr", "name": "solr" } @@ -12,14 +12,14 @@ ], "isRelatedTo": [ { - "@class": "Uses", + "type": "Uses", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -27,14 +27,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/main/resources/query/09-get-access-point-facet-of-solr-service.json b/src/main/resources/query/09-get-access-point-facet-of-solr-service.json index 21d4638..c6f0238 100644 --- a/src/main/resources/query/09-get-access-point-facet-of-solr-service.json +++ b/src/main/resources/query/09-get-access-point-facet-of-solr-service.json @@ -1,14 +1,14 @@ { - "@class": "AccessPointFacet", - "_in": { - "@class": "ConsistsOf", + "type": "AccessPointFacet", + "_source": { + "type": "ConsistsOf", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.apache.solr", "name": "solr" } @@ -16,14 +16,14 @@ ], "isRelatedTo": [ { - "@class": "Uses", + "type": "Uses", "source": { - "@class": "EService", + "type": "EService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "ckan-organization", "name": "ckan" } @@ -31,14 +31,14 @@ ], "isRelatedTo": [ { - "@class": "CallsFor", + "type": "CallsFor", "source": { - "@class": "VirtualService", + "type": "VirtualService", "consistsOf": [ { - "@class": "IsIdentifiedBy", + "type": "IsIdentifiedBy", "target": { - "@class": "SoftwareFacet", + "type": "SoftwareFacet", "group": "org.gcube.data-catalogue", "name": "catalogue-virtual-service" } diff --git a/src/test/java/org/gcube/gcat/profile/ProfileTest.java b/src/test/java/org/gcube/gcat/profile/ProfileTest.java index 493219c..84cefa7 100644 --- a/src/test/java/org/gcube/gcat/profile/ProfileTest.java +++ b/src/test/java/org/gcube/gcat/profile/ProfileTest.java @@ -5,6 +5,7 @@ import java.io.StringReader; import java.net.URL; import java.nio.file.Files; import java.util.Iterator; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -163,4 +164,12 @@ public class ProfileTest extends ContextTest { } } + @Test + public void testRegex() throws Exception { + File resDirectory = getResourcesDirectory(); + File regexFile = new File(resDirectory, "regex.txt"); + String regex = fileToString(regexFile); + Pattern.compile(regex); + } + } diff --git a/src/test/java/org/gcube/gcat/utils/ConstantsTest.java b/src/test/java/org/gcube/gcat/utils/ConstantsTest.java index eaffe8c..0179c33 100644 --- a/src/test/java/org/gcube/gcat/utils/ConstantsTest.java +++ b/src/test/java/org/gcube/gcat/utils/ConstantsTest.java @@ -1,6 +1,7 @@ package org.gcube.gcat.utils; import java.net.URL; +import java.util.regex.Pattern; import org.gcube.common.authorization.utils.manager.SecretManagerProvider; import org.gcube.common.authorization.utils.secret.Secret; @@ -47,5 +48,10 @@ public class ConstantsTest extends ContextTest { } + @Test + public void testRegex() throws Exception { + String regex = "^([a-zA-ZÀ-ÿ .‘-]+),\\s*([a-zA-ZÀ-ÿ .’-]+)(?:,\\s*([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}))?(?:,\\s*(orcid.org/\\d{4}-\\d{4}-\\d{4}-\\d{3}[0-9X]))?$"; + Pattern.compile(regex); + } } diff --git a/src/test/resources/regex.txt b/src/test/resources/regex.txt new file mode 100644 index 0000000..202a18b --- /dev/null +++ b/src/test/resources/regex.txt @@ -0,0 +1 @@ +^([a-zA-ZÀ-ÿ .‘-]+),\s*([a-zA-ZÀ-ÿ .’-]+)(?:,\s*([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}))?(?:,\s*(orcid.org/\d{4}-\d{4}-\d{4}-\d{3}[0-9X]))?$ \ No newline at end of file