From c0e9bb061e7daafeb0f52d160199ea840ab92170 Mon Sep 17 00:00:00 2001 From: Grzegorz Kostkowski Date: Mon, 16 Sep 2024 17:47:33 +0200 Subject: [PATCH] Implement unit tests for selected functions and templates, minor improvements in code and fixes in test data Scope of the changes: * Added unit tests for 2 functions and 5 templates * made specification of `f:normaliseURI` function more precise and added a safeguard for unsupported values * Introducced a new test file with a global variable overwritten for the included test purposes * Removed trailing spaces in test data (as this was causing some code to fail) * Fixed a typo --- src/common/utils.xsl | 14 ++- .../class-attributes-with-same-name.xsl | 2 +- test/ePO-default-config/namespaces.xml | 1 + .../ePO-CM-v2.0.1-2022-04-29_test.eap.xmi | 20 ++-- test/unitTests/test-common/test-utils.xspec | 43 ++++++++ ...test-class-attributes-with-same-name.xspec | 100 ++++++++++++++++++ .../test-connectors-owl-core.xspec | 49 +++++++++ .../test-elements-owl-core.xspec | 12 --- ...ements-owl-core_with-concept-schemes.xspec | 27 +++++ .../test-connectors-reasoning-layer.xspec | 10 ++ .../test-elements-shacl-shape.xspec | 13 +++ 11 files changed, 266 insertions(+), 25 deletions(-) create mode 100644 test/unitTests/test-owl-core-lib/test-elements-owl-core_with-concept-schemes.xspec diff --git a/src/common/utils.xsl b/src/common/utils.xsl index 4d9a960c..b033f657 100644 --- a/src/common/utils.xsl +++ b/src/common/utils.xsl @@ -408,18 +408,28 @@ - Normalise URI from prefix:localSegment to prefix-localSegment + Normalise compact URI from prefix:localSegment to prefix-localSegment. + Regular URI is not supported. + + + + - This function is used to combine 2 URIs to build the property shape URI + This function is used to combine 2 compact URIs to build the property shape URI shape-base-uri:{SourceClassURI}-{PropertyOrAttributeURI} Example: Class URI - prefix:Procedure Attribute URI - prefix:hasScope Result will be http://base.uri/data-shape/prefix-Procedure-prefix-hasScope diff --git a/src/html-conventions-lib/class-attributes-with-same-name.xsl b/src/html-conventions-lib/class-attributes-with-same-name.xsl index 4ac532a6..bc938697 100644 --- a/src/html-conventions-lib/class-attributes-with-same-name.xsl +++ b/src/html-conventions-lib/class-attributes-with-same-name.xsl @@ -190,7 +190,7 @@ () else if (fn:boolean($datatypeValues)) then - f:generateFormattedWarningMessage(fn:concat('The attribute ', $attributeName, ' is has different datatypes in reuse contexts.', + f:generateFormattedWarningMessage(fn:concat('The attribute ', $attributeName, ' has different datatypes in reuse contexts.', 'When a property is reused in multiple contexts, the data-type is expected to be the same.', 'In this case, multiple data-types are found: '), $datatypeWithAnnotations, '//elements/element/attributes', diff --git a/test/ePO-default-config/namespaces.xml b/test/ePO-default-config/namespaces.xml index 0cb964ac..23151f8a 100644 --- a/test/ePO-default-config/namespaces.xml +++ b/test/ePO-default-config/namespaces.xml @@ -15,6 +15,7 @@ + diff --git a/test/testData/ePO-CM-v2.0.1-2022-04-29_test.eap.xmi b/test/testData/ePO-CM-v2.0.1-2022-04-29_test.eap.xmi index fd92fad6..d757af38 100644 --- a/test/testData/ePO-CM-v2.0.1-2022-04-29_test.eap.xmi +++ b/test/testData/ePO-CM-v2.0.1-2022-04-29_test.eap.xmi @@ -2518,7 +2518,7 @@ - + @@ -2729,7 +2729,7 @@ - + @@ -29675,7 +29675,7 @@ - +