From d1e738f78b4312364fb0c96ae03d936c6d85c856 Mon Sep 17 00:00:00 2001 From: danielnavarrogeo Date: Thu, 13 Feb 2020 15:59:21 +0100 Subject: [PATCH 1/2] Fix Req 3.4 Spatial Data Service Category validation --- ...ID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml | 15 ++- metadata/2.0/sds/ets-md-sds-bsxets.xml | 26 +++++- tatus | 92 +++++++++++++++++++ 3 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 tatus diff --git a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml index c34026ad5..945776627 100644 --- a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml +++ b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml @@ -957,14 +957,21 @@ XML document '{filename}', record '{id}': Keyword element must have to include a Non-empty Free Text. - - + + - - XML document '{filename}', record '{id}': At least one keyword shall be given withe a child Anchor that includes an xlink:href attribute with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. + + XML document '{filename}', record '{id}': At least one keyword shall be given with a child Anchor including an xlink:href attribute or CharacterString with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. + + + + XML document '{filename}', record '{id}': The xlink:href attribute inside Anchor of keyword element must be one of the allowed values in "Classification of Spatial Data Services" Part D 4. + + + diff --git a/metadata/2.0/sds/ets-md-sds-bsxets.xml b/metadata/2.0/sds/ets-md-sds-bsxets.xml index 96e568038..f238b8461 100644 --- a/metadata/2.0/sds/ets-md-sds-bsxets.xml +++ b/metadata/2.0/sds/ets-md-sds-bsxets.xml @@ -14,11 +14,11 @@ Source: @@ -213,15 +213,30 @@ return let $validCategoriesUrl := fn:doc('http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory/SpatialDataServiceCategory.en.xml')/*:metadata-codelist/*:containeditems/*:value/@id let $validCategories := for $x in $validCategoriesUrl return fn:substring($x, 74) +let $spatialDataServiceCategory := 'http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory' let $messages := (for $record in $records let $keywordElements := $record/gmd:identificationInfo[1]/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword + let $sdsCategoryKeywordAnchors := + for $x in $keywordElements + where $x/gmx:Anchor/@xlink:href[starts-with(.,$spatialDataServiceCategory)] + return $x + let $sdsCategoryCharacterStrings := + for $x in $keywordElements + where $x/gco:CharacterString = $validCategories + return $x + let $validSdsKeywordAnchors := + for $x in $sdsCategoryKeywordAnchors + where $x/gmx:Anchor/@xlink:href = $validCategoriesUrl + return $x let $rid := $record/gmd:fileIdentifier/*/text() return if (not($keywordElements)) then local:addMessage('TR.keywordElementNotFound', map { 'filename': local:filename($record), 'id': $rid}) - else if(not($keywordElements/gmx:Anchor/@xlink:href)) then - local:addMessage('TR.AnchorNotFound', map { 'filename': local:filename($record), 'id': $rid}) + else if (not(count($sdsCategoryKeywordAnchors) = count($validSdsKeywordAnchors))) then + local:addMessage('TR.SpatialDataServiceCategoryInvalid', map { 'filename': local:filename($record), 'id': $rid}) + else if (count($validSdsKeywordAnchors) = 0 and count($sdsCategoryCharacterStrings) = 0) then + local:addMessage('TR.SpatialDataServiceCategoryNotFound', map { 'filename': local:filename($record), 'id': $rid}) else let $emptyKeywordsText := (for $keyword in $keywordElements @@ -255,7 +270,10 @@ return + + + diff --git a/tatus b/tatus new file mode 100644 index 000000000..0fa70958c --- /dev/null +++ b/tatus @@ -0,0 +1,92 @@ +diff --git a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml +index c34026a..ce4be70 100644 +--- a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml ++++ b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml +@@ -957,14 +957,21 @@ + XML document '{filename}', record '{id}': Keyword element must have to include a Non-empty Free Text. +  +  +-  +-  ++    ++   +  +-  +- XML document '{filename}', record '{id}': At least one keyword shall be given withe a child Anchor that includes an xlink:href attribute with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. ++  ++ XML document '{filename}', record '{id}': At least one keyword shall be given with a child Anchor including an xlink:href attribute or CharacterString with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. +  +  +  ++   ++   ++  ++ XML document '{filename}', record '{id}': The xlink:href attribute inside an Anchor of keyword element must be one of the allowed values in "Classification of Spatial Data Services" Part D 4. ++  ++   ++    +  +  +  +diff --git a/metadata/2.0/sds/ets-md-sds-bsxets.xml b/metadata/2.0/sds/ets-md-sds-bsxets.xml +index 96e5680..f238b84 100644 +--- a/metadata/2.0/sds/ets-md-sds-bsxets.xml ++++ b/metadata/2.0/sds/ets-md-sds-bsxets.xml +@@ -14,11 +14,11 @@ Source:  +  +@@ -213,15 +213,30 @@ return +  + let $validCategoriesUrl := fn:doc('http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory/SpatialDataServiceCategory.en.xml')/*:metadata-codelist/*:containeditems/*:value/@id + let $validCategories := for $x in $validCategoriesUrl return fn:substring($x, 74) ++let $spatialDataServiceCategory := 'http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory' + let $messages := + (for $record in $records + let $keywordElements := $record/gmd:identificationInfo[1]/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword ++ let $sdsCategoryKeywordAnchors := ++ for $x in $keywordElements ++ where $x/gmx:Anchor/@xlink:href[starts-with(.,$spatialDataServiceCategory)] ++ return $x ++ let $sdsCategoryCharacterStrings := ++ for $x in $keywordElements ++ where $x/gco:CharacterString = $validCategories ++ return $x ++ let $validSdsKeywordAnchors :=  ++ for $x in $sdsCategoryKeywordAnchors ++ where $x/gmx:Anchor/@xlink:href = $validCategoriesUrl ++ return $x + let $rid := $record/gmd:fileIdentifier/*/text() + return + if (not($keywordElements)) then + local:addMessage('TR.keywordElementNotFound', map { 'filename': local:filename($record), 'id': $rid}) +- else if(not($keywordElements/gmx:Anchor/@xlink:href)) then +- local:addMessage('TR.AnchorNotFound', map { 'filename': local:filename($record), 'id': $rid}) ++ else if (not(count($sdsCategoryKeywordAnchors) = count($validSdsKeywordAnchors))) then ++ local:addMessage('TR.SpatialDataServiceCategoryInvalid', map { 'filename': local:filename($record), 'id': $rid}) ++ else if (count($validSdsKeywordAnchors) = 0 and count($sdsCategoryCharacterStrings) = 0) then ++ local:addMessage('TR.SpatialDataServiceCategoryNotFound', map { 'filename': local:filename($record), 'id': $rid})  + else + let $emptyKeywordsText := + (for $keyword in $keywordElements +@@ -255,7 +270,10 @@ return +  +  +  ++  ++  +  ++  +  +  +  From fb739c6a0b98fe6095b2ea8b6836a0fa529be132 Mon Sep 17 00:00:00 2001 From: danielnavarrogeo Date: Thu, 13 Feb 2020 16:13:13 +0100 Subject: [PATCH 2/2] Fix Req 3.4 --- tatus | 92 ----------------------------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 tatus diff --git a/tatus b/tatus deleted file mode 100644 index 0fa70958c..000000000 --- a/tatus +++ /dev/null @@ -1,92 +0,0 @@ -diff --git a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml -index c34026a..ce4be70 100644 ---- a/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml -+++ b/include-metadata/TranslationTemplateBundle-EID70a263c0-0ad7-42f2-9d4d-0d8a4ca71b52.xml -@@ -957,14 +957,21 @@ - XML document '{filename}', record '{id}': Keyword element must have to include a Non-empty Free Text. -  -  --  --  -+    -+   -  --  -- XML document '{filename}', record '{id}': At least one keyword shall be given withe a child Anchor that includes an xlink:href attribute with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. -+  -+ XML document '{filename}', record '{id}': At least one keyword shall be given with a child Anchor including an xlink:href attribute or CharacterString with one of the language-natural keyword values as defined in "Classification of Spatial Data Services" Part D 4. -  -  -  -+   -+   -+  -+ XML document '{filename}', record '{id}': The xlink:href attribute inside an Anchor of keyword element must be one of the allowed values in "Classification of Spatial Data Services" Part D 4. -+  -+   -+    -  -  -  -diff --git a/metadata/2.0/sds/ets-md-sds-bsxets.xml b/metadata/2.0/sds/ets-md-sds-bsxets.xml -index 96e5680..f238b84 100644 ---- a/metadata/2.0/sds/ets-md-sds-bsxets.xml -+++ b/metadata/2.0/sds/ets-md-sds-bsxets.xml -@@ -14,11 +14,11 @@ Source:  -  -@@ -213,15 +213,30 @@ return -  - let $validCategoriesUrl := fn:doc('http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory/SpatialDataServiceCategory.en.xml')/*:metadata-codelist/*:containeditems/*:value/@id - let $validCategories := for $x in $validCategoriesUrl return fn:substring($x, 74) -+let $spatialDataServiceCategory := 'http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory' - let $messages := - (for $record in $records - let $keywordElements := $record/gmd:identificationInfo[1]/srv:SV_ServiceIdentification/gmd:descriptiveKeywords/gmd:MD_Keywords/gmd:keyword -+ let $sdsCategoryKeywordAnchors := -+ for $x in $keywordElements -+ where $x/gmx:Anchor/@xlink:href[starts-with(.,$spatialDataServiceCategory)] -+ return $x -+ let $sdsCategoryCharacterStrings := -+ for $x in $keywordElements -+ where $x/gco:CharacterString = $validCategories -+ return $x -+ let $validSdsKeywordAnchors :=  -+ for $x in $sdsCategoryKeywordAnchors -+ where $x/gmx:Anchor/@xlink:href = $validCategoriesUrl -+ return $x - let $rid := $record/gmd:fileIdentifier/*/text() - return - if (not($keywordElements)) then - local:addMessage('TR.keywordElementNotFound', map { 'filename': local:filename($record), 'id': $rid}) -- else if(not($keywordElements/gmx:Anchor/@xlink:href)) then -- local:addMessage('TR.AnchorNotFound', map { 'filename': local:filename($record), 'id': $rid}) -+ else if (not(count($sdsCategoryKeywordAnchors) = count($validSdsKeywordAnchors))) then -+ local:addMessage('TR.SpatialDataServiceCategoryInvalid', map { 'filename': local:filename($record), 'id': $rid}) -+ else if (count($validSdsKeywordAnchors) = 0 and count($sdsCategoryCharacterStrings) = 0) then -+ local:addMessage('TR.SpatialDataServiceCategoryNotFound', map { 'filename': local:filename($record), 'id': $rid})  - else - let $emptyKeywordsText := - (for $keyword in $keywordElements -@@ -255,7 +270,10 @@ return -  -  -  -+  -+  -  -+  -  -  -