diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/dcat/dcat-core-distribution.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/dcat/dcat-core-distribution.xsl index 2234a87b756..12fe69a14ce 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/dcat/dcat-core-distribution.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/dcat/dcat-core-distribution.xsl @@ -214,7 +214,7 @@ --> - + diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/eu-dcat-ap/eu-dcat-ap-core-dataset.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/eu-dcat-ap/eu-dcat-ap-core-dataset.xsl index 515f03e5758..8a47099f354 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/eu-dcat-ap/eu-dcat-ap-core-dataset.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/eu-dcat-ap/eu-dcat-ap-core-dataset.xsl @@ -245,4 +245,10 @@ + + diff --git a/services/src/test/java/org/fao/geonet/api/records/formatters/FormatterApiTest.java b/services/src/test/java/org/fao/geonet/api/records/formatters/FormatterApiTest.java index 6db8384c80d..44efe372b42 100644 --- a/services/src/test/java/org/fao/geonet/api/records/formatters/FormatterApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/records/formatters/FormatterApiTest.java @@ -158,36 +158,9 @@ public void checkFormatter() throws Exception { if("eu-dcat-ap".equalsIgnoreCase(formatter)){ String[] shaclValidation = {"dcat-ap-2.1.1-base-SHACL.ttl", "dcat-ap-3-SHACL.ttl"}; for(String shaclShapes : shaclValidation) { - String SHAPES = FormatterApiTest.class.getResource(shaclShapes).getFile(); - if(SHAPES.startsWith("/")){ SHAPES.replaceFirst("/","");} - - //Load document to validate. - String DATA = FormatterApiTest.class.getResource( - String.format("%s-%s-%s", - schema, formatter, checkfile) - ).getFile(); - if(DATA.startsWith("/")){ - DATA.replaceFirst("/",""); - } - - Graph shapesGraph = RDFDataMgr.loadGraph(SHAPES); - Graph dataGraph = RDFDataMgr.loadGraph(DATA); - - Shapes shapes = Shapes.parse(shapesGraph); - - ValidationReport report = ShaclValidator.get().validate(shapes, dataGraph); - - if(report.conforms() == false){ - ShLib.printReport(report); - System.out.println(); - RDFDataMgr.write(System.out, report.getModel(), Lang.TTL); - fail(String.format("%s. Checked with %s. Invalid DCAT-AP document. See report in the test console output.", - url, checkfile)); - } - + applyShaclValidation(formatter, schema, checkfile, url, shaclShapes); } } - } else { assertEquals( url, @@ -201,6 +174,35 @@ public void checkFormatter() throws Exception { } } + private static void applyShaclValidation(String formatter, String schema, String checkfile, String url, String shaclShapes) { + String SHAPES = FormatterApiTest.class.getResource(shaclShapes).getFile(); + if(SHAPES.startsWith("/")){ SHAPES.replaceFirst("/","");} + + //Load document to validate. + String DATA = FormatterApiTest.class.getResource( + String.format("%s-%s-%s", + schema, formatter, checkfile) + ).getFile(); + if(DATA.startsWith("/")){ + DATA.replaceFirst("/",""); + } + + Graph shapesGraph = RDFDataMgr.loadGraph(SHAPES); + Graph dataGraph = RDFDataMgr.loadGraph(DATA); + + Shapes shapes = Shapes.parse(shapesGraph); + + ValidationReport report = ShaclValidator.get().validate(shapes, dataGraph); + + if(report.conforms() == false){ + ShLib.printReport(report); + System.out.println(); + RDFDataMgr.write(System.out, report.getModel(), Lang.TTL); + fail(String.format("%s. Checked with %s [%s]. Invalid DCAT-AP document. See report in the test console output.", + url, checkfile, shaclShapes)); + } + } + private void createTestData() throws Exception { loginAsAdmin(context); diff --git a/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-dcat-dataset-core.rdf b/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-dcat-dataset-core.rdf index 2ce37d8da6a..084bd4d1e55 100644 --- a/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-dcat-dataset-core.rdf +++ b/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-dcat-dataset-core.rdf @@ -314,7 +314,7 @@ 2023-12-08T00:00:00 - 10485760 + 10485760 ESRI Shapefile (.shp) diff --git a/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-eu-dcat-ap-dataset-core.rdf b/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-eu-dcat-ap-dataset-core.rdf index b0a22ca31a0..1562aea28e3 100644 --- a/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-eu-dcat-ap-dataset-core.rdf +++ b/services/src/test/resources/org/fao/geonet/api/records/formatters/iso19115-3.2018-eu-dcat-ap-dataset-core.rdf @@ -399,10 +399,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S @@ -412,7 +408,7 @@ 2023-12-08T00:00:00 - 10485760 + 10485760 ESRI Shapefile (.shp) @@ -431,10 +427,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S @@ -478,10 +470,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S @@ -527,10 +515,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S @@ -577,10 +561,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S @@ -629,10 +609,6 @@ 0.01 - 30 - - 0.3048 - P0Y2M0DT0H0M0S