From 8638559d43d314b45bfbc69848c8ccf912c73a08 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 2 Dec 2022 17:44:33 +0100 Subject: [PATCH] Added JSON query to be used to interact with new IS --- .../isproxies/RestISConfigurationProxy.java | 5 +- .../get-access-point-facet-of-ckan-db.json | 55 +++++++++++++++++++ ...et-access-point-facet-of-ckan-service.json | 37 +++++++++++++ ...et-access-point-facet-of-solr-service.json | 55 +++++++++++++++++++ src/main/resources/query/get-ckan-db.json | 49 +++++++++++++++++ .../resources/query/get-ckan-service.json | 31 +++++++++++ .../get-simple-facet-from-configuration.json | 19 ++++++- .../resources/query/get-solr-service.json | 49 +++++++++++++++++ 8 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/query/get-access-point-facet-of-ckan-db.json create mode 100644 src/main/resources/query/get-access-point-facet-of-ckan-service.json create mode 100644 src/main/resources/query/get-access-point-facet-of-solr-service.json create mode 100644 src/main/resources/query/get-ckan-db.json create mode 100644 src/main/resources/query/get-ckan-service.json create mode 100644 src/main/resources/query/get-solr-service.json diff --git a/src/main/java/org/gcube/gcat/configuration/isproxies/RestISConfigurationProxy.java b/src/main/java/org/gcube/gcat/configuration/isproxies/RestISConfigurationProxy.java index 6ad0d76..0d43f8d 100644 --- a/src/main/java/org/gcube/gcat/configuration/isproxies/RestISConfigurationProxy.java +++ b/src/main/java/org/gcube/gcat/configuration/isproxies/RestISConfigurationProxy.java @@ -28,6 +28,7 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Configura import org.gcube.resourcemanagement.model.reference.entities.resources.EService; import org.gcube.resourcemanagement.model.reference.entities.resources.VirtualService; import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy; +import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.CallsFor; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsCustomizedBy; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Uses; import org.slf4j.Logger; @@ -141,7 +142,7 @@ public class RestISConfigurationProxy extends ISConfigurationProxy eServices = resourceRegistryClient.getRelatedResourcesFromReferenceResource( - EService.class, Uses.class, virtualService, Direction.IN, true); + EService.class, CallsFor.class, virtualService, Direction.IN, true); int size = eServices.size(); if(eServices==null || size==0) { String message = String.format( @@ -155,7 +156,7 @@ public class RestISConfigurationProxy extends ISConfigurationProxy1) { String message = String.format( "Too many %s <--%s-- (%s uuid:%s) found (i.e. expected 1, found %d)). %s", - EService.NAME, IsCustomizedBy.NAME, VirtualService.NAME, + EService.NAME, CallsFor.NAME, VirtualService.NAME, virtualService.getHeader().getUUID(), size, ElementMapper.marshal(eServices)); logger.error(message); throw new InternalServerErrorException(message); diff --git a/src/main/resources/query/get-access-point-facet-of-ckan-db.json b/src/main/resources/query/get-access-point-facet-of-ckan-db.json new file mode 100644 index 0000000..537ff45 --- /dev/null +++ b/src/main/resources/query/get-access-point-facet-of-ckan-db.json @@ -0,0 +1,55 @@ +{ + "@class": "AccessPointFacet", + "_in": { + "@class": "ConsistsOf", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.postgresql", + "name": "postgresql" + } + } + ], + "isRelatedTo": [ + { + "@class": "Uses", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/query/get-access-point-facet-of-ckan-service.json b/src/main/resources/query/get-access-point-facet-of-ckan-service.json new file mode 100644 index 0000000..010ed40 --- /dev/null +++ b/src/main/resources/query/get-access-point-facet-of-ckan-service.json @@ -0,0 +1,37 @@ +{ + "@class": "AccessPointFacet", + "_in": { + "@class": "ConsistsOf", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/query/get-access-point-facet-of-solr-service.json b/src/main/resources/query/get-access-point-facet-of-solr-service.json new file mode 100644 index 0000000..c607fbb --- /dev/null +++ b/src/main/resources/query/get-access-point-facet-of-solr-service.json @@ -0,0 +1,55 @@ +{ + "@class": "AccessPointFacet", + "_in": { + "@class": "ConsistsOf", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.apache.solr", + "name": "solr" + } + } + ], + "isRelatedTo": [ + { + "@class": "Uses", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/main/resources/query/get-ckan-db.json b/src/main/resources/query/get-ckan-db.json new file mode 100644 index 0000000..e7c3794 --- /dev/null +++ b/src/main/resources/query/get-ckan-db.json @@ -0,0 +1,49 @@ +{ + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.postgresql", + "name": "postgresql" + } + } + ], + "isRelatedTo": [ + { + "@class": "Uses", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/query/get-ckan-service.json b/src/main/resources/query/get-ckan-service.json new file mode 100644 index 0000000..8189b9c --- /dev/null +++ b/src/main/resources/query/get-ckan-service.json @@ -0,0 +1,31 @@ +{ + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/query/get-simple-facet-from-configuration.json b/src/main/resources/query/get-simple-facet-from-configuration.json index 6dfe065..08206e4 100644 --- a/src/main/resources/query/get-simple-facet-from-configuration.json +++ b/src/main/resources/query/get-simple-facet-from-configuration.json @@ -1,6 +1,5 @@ { "@class": "SimpleFacet", - "_in": { "@class": "ConsistsOf", "source": { @@ -13,6 +12,24 @@ "value": "gcat-configuration" } } + ], + "isRelatedTo": [ + { + "@class": "IsCustomizedBy", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } ] } } diff --git a/src/main/resources/query/get-solr-service.json b/src/main/resources/query/get-solr-service.json new file mode 100644 index 0000000..7fb93ec --- /dev/null +++ b/src/main/resources/query/get-solr-service.json @@ -0,0 +1,49 @@ +{ + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.apache.solr", + "name": "solr" + } + } + ], + "isRelatedTo": [ + { + "@class": "Uses", + "source": { + "@class": "EService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "ckan-organization", + "name": "ckan" + } + } + ], + "isRelatedTo": [ + { + "@class": "CallsFor", + "source": { + "@class": "VirtualService", + "consistsOf": [ + { + "@class": "IsIdentifiedBy", + "target": { + "@class": "SoftwareFacet", + "group": "org.gcube.data-catalogue", + "name": "catalogue-virtual-service" + } + } + ] + } + } + ] + } + } + ] +} \ No newline at end of file