From 0dbac92e06804afc2fa711fd56bb5fc1b23fe739 Mon Sep 17 00:00:00 2001 From: Kolea PLESCO Date: Tue, 9 Apr 2024 12:52:09 +0300 Subject: [PATCH] updates xpath validator --- .../adapters/mapping_suite_reader.py | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) 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 0b26f84b..6d47528c 100644 --- a/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py +++ b/ted_sws/mapping_suite_processor/adapters/mapping_suite_reader.py @@ -62,19 +62,16 @@ 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.identifier != CONCEPTUAL_MAPPINGS_ASSERTIONS: - continue - for sparql_test in test_suite.sparql_tests: metadata = cls.extract_metadata_from_sparql_query(sparql_test.file_content) - xpath = metadata[SPARQL_QUERY_METADATA_XPATH] - if xpath not in processed_xpaths: - cm_xpath: MappingXPATH = MappingXPATH( - xpath=xpath, - form_field=metadata[SPARQL_QUERY_METADATA_TITLE] - ) - xpaths.append(cm_xpath) - processed_xpaths.add(xpath) - break + if SPARQL_QUERY_METADATA_XPATH in metadata: + xpath = metadata[SPARQL_QUERY_METADATA_XPATH] + if xpath not in processed_xpaths: + cm_xpath: MappingXPATH = MappingXPATH( + xpath=xpath, + form_field=metadata[SPARQL_QUERY_METADATA_TITLE] + ) + xpaths.append(cm_xpath) + processed_xpaths.add(xpath) return xpaths