From d95233c2339193f1631d9a3f49dc788a3ae28cbe Mon Sep 17 00:00:00 2001 From: torleifg Date: Thu, 28 Nov 2024 13:32:38 +0100 Subject: [PATCH] Fix RDF uri on publisher --- .../no/fdk/dataservicecatalog/handler/RDFHandler.kt | 10 ++++++---- .../dataservicecatalog/unit/handler/RDFHandlerTest.kt | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/no/fdk/dataservicecatalog/handler/RDFHandler.kt b/src/main/kotlin/no/fdk/dataservicecatalog/handler/RDFHandler.kt index 00a790a..2310820 100644 --- a/src/main/kotlin/no/fdk/dataservicecatalog/handler/RDFHandler.kt +++ b/src/main/kotlin/no/fdk/dataservicecatalog/handler/RDFHandler.kt @@ -102,15 +102,17 @@ class RDFHandler(private val repository: DataServiceRepository, private val prop } } -fun Model.addCatalog(catalogId: String, baseUri: String, organizationCatalogBaseUri: String, publisherUri: String) { - this.createResource(URIref.encode(baseUri.plus(catalogId))).addProperty(RDF.type, DCAT.Catalog) +fun Model.addCatalog(catalogId: String, baseUri: String, organizationCatalogUri: String, publisherUri: String) { + this.createResource(URIref.encode(baseUri.plus(catalogId))) .addProperty( - DCTerms.publisher, ResourceFactory.createResource(URIref.encode(catalogId)) + RDF.type, DCAT.Catalog + ).addProperty( + DCTerms.publisher, ResourceFactory.createResource(URIref.encode(organizationCatalogUri.plus(catalogId))) ).addProperty( DCTerms.title, ResourceFactory.createLangLiteral("Data service catalog ($catalogId)", "en") ) - this.createResource(URIref.encode(organizationCatalogBaseUri.plus(catalogId))) + this.createResource(URIref.encode(organizationCatalogUri.plus(catalogId))) .addProperty( RDF.type, FOAF.Agent ).addProperty( diff --git a/src/test/kotlin/no/fdk/dataservicecatalog/unit/handler/RDFHandlerTest.kt b/src/test/kotlin/no/fdk/dataservicecatalog/unit/handler/RDFHandlerTest.kt index 795c839..ae245e1 100644 --- a/src/test/kotlin/no/fdk/dataservicecatalog/unit/handler/RDFHandlerTest.kt +++ b/src/test/kotlin/no/fdk/dataservicecatalog/unit/handler/RDFHandlerTest.kt @@ -85,7 +85,7 @@ class RDFHandlerTest { foaf:page . <$baseUri/catalogs/$catalogId> rdf:type dcat:Catalog; - dct:publisher <$catalogId>; + dct:publisher <$organizationCatalogBaseUri/organizations/$catalogId>; dct:title "Data service catalog ($catalogId)"@en; dcat:service <$baseUri/data-services/$dataServiceId> . """ @@ -166,7 +166,7 @@ class RDFHandlerTest { foaf:page . <$baseUri/catalogs/$catalogId> rdf:type dcat:Catalog; - dct:publisher <$catalogId>; + dct:publisher <$organizationCatalogBaseUri/organizations/$catalogId>; dct:title "Data service catalog ($catalogId)"@en; dcat:service <$baseUri/data-services/$dataServiceId> . """