diff --git a/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py b/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py index c1080b0c5..0b26f84b5 100644 --- a/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py +++ b/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py @@ -62,7 +62,7 @@ def read_mapping_suite_xpaths(cls, mapping_suite: MappingSuite) -> List[MappingX processed_xpaths = set() for test_suite in mapping_suite.sparql_test_suites: - if test_suite != CONCEPTUAL_MAPPINGS_ASSERTIONS: + if test_suite.identifier != CONCEPTUAL_MAPPINGS_ASSERTIONS: continue for sparql_test in test_suite.sparql_tests: diff --git a/ted_sws/notice_validator/adapters/xpath_coverage_runner.py b/ted_sws/notice_validator/adapters/xpath_coverage_runner.py index fc8178d0d..fb3905454 100644 --- a/ted_sws/notice_validator/adapters/xpath_coverage_runner.py +++ b/ted_sws/notice_validator/adapters/xpath_coverage_runner.py @@ -52,7 +52,7 @@ def xpath_coverage_validation_report(self, notice: Notice) -> XPATHCoverageValid xpaths: List[str] = [] for xpath in self.get_all_conceptual_xpaths(): - if self.check_xpath_expression_with_xml(notice.xml_manifestation.object_data.encode("utf-8"), xpath): + if self.check_xpath_expression_with_xml(notice.xml_manifestation.object_data, xpath): xpaths.append(xpath) notice_xpaths: XPathDict = {notice.ted_id: xpaths} self.validate_xpath_coverage_report(report, notice_xpaths, xpaths) @@ -132,7 +132,7 @@ def xpath_coverage_validation_summary_report( xpaths: List[str] = [] for xpath in self.get_all_conceptual_xpaths(): if self.check_xpath_expression_with_xml( - report_notice.notice.xml_manifestation.object_data.encode("utf-8"), xpath + report_notice.notice.xml_manifestation.object_data, xpath ): xpaths.append(xpath) diff --git a/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_0.rq b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_0.rq new file mode 100644 index 000000000..bc3f0c017 --- /dev/null +++ b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_0.rq @@ -0,0 +1,10 @@ +#title: BT-701-notice BT-701-notice - BT-701-notice +#description: “BT-701-notice BT-701-notice - BT-701-notice” in SF corresponds to “BT-701 Notice Identifier” in eForms. The corresponding XML element is /*/cbc:ID[@schemeName='notice-id']. The expected ontology instances are epo: epo:Notice / epo:Indentifier / rdf:langString . +#xpath: /*/cbc:ID[@schemeName='notice-id'] + +PREFIX epo: +PREFIX rdf: + +ASK WHERE { + ?this rdf:type epo:Notice . + ?this epo:hasID / epo:hasIdentifierValue ?value } \ No newline at end of file diff --git a/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_1.rq b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_1.rq new file mode 100644 index 000000000..00457353c --- /dev/null +++ b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_1.rq @@ -0,0 +1,11 @@ +#title: ND-ContractingParty ND-ContractingParty - ND-ContractingParty +#description: “ND-ContractingParty ND-ContractingParty - ND-ContractingParty” in SF corresponds to “nan nan” in eForms. The corresponding XML element is /*/cac:ContractingParty. The expected ontology instances are epo: epo:Notice / epo:AgentInRole (from CL1) . +#xpath: /*/cac:ContractingParty + +PREFIX epo: +PREFIX epo-not: +PREFIX rdf: + +ASK WHERE { + ?this rdf:type epo:Notice . + ?this epo-not:announcesRole ?value } \ No newline at end of file diff --git a/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_3.rq b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_3.rq new file mode 100644 index 000000000..6138e7ce5 --- /dev/null +++ b/tests/test_data/notice_validator/test_repository/test_package_F03/validation/sparql/cm_assertions/sparql_query_3.rq @@ -0,0 +1,10 @@ +#title: ND-ServiceProvider ND-ContractingParty.ND-ServiceProvider - ND-ServiceProvider +#description: “ND-ServiceProvider ND-ContractingParty.ND-ServiceProvider - ND-ServiceProvider” in SF corresponds to “nan nan” in eForms. The corresponding XML element is /*/cac:ContractingParty/cac:Party. The expected ontology instances are epo: org:Organization . +#xpath: /TED_EXPORT/FORM_SECTION/F03_2014/CONTRACTING_BODY/ADDRESS_CONTRACTING_BODY/OFFICIALNAME + +PREFIX org: +PREFIX rdf: + +ASK WHERE { + ?this rdf:type org:Organization . + ?this a org:Organization. } \ No newline at end of file diff --git a/tests/unit/notice_validator/test_xpath_coverage_runner.py b/tests/unit/notice_validator/test_xpath_coverage_runner.py index 04a8f1fb4..40e98e2d0 100644 --- a/tests/unit/notice_validator/test_xpath_coverage_runner.py +++ b/tests/unit/notice_validator/test_xpath_coverage_runner.py @@ -18,6 +18,7 @@ def test_xpath_coverage_runner(fake_notice_F03, fake_mapping_suite_F03_id, fake_ assert "mapping_suite_identifier" in json_report assert "validation_result" in json_report assert "xpath_assertions" in json_report["validation_result"] + assert "xpath_covered" in json_report["validation_result"] assert xpath_coverage_html_report(report)