Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove rdf_manifestation validation from DAG workflow. #357

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dags/pipelines/notice_processor_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def notice_validation_pipeline(notice: Notice, mongodb_client: MongoClient) -> N
validate_xpath_coverage_notice(notice=notice, mapping_suite=mapping_suite, mongodb_client=mongodb_client)
log_notice_info(message="Validation :: XPATH coverage :: END", notice_id=notice.ted_id)
log_notice_info(message="Validation :: SPARQL :: START", notice_id=notice.ted_id)
validate_notice_with_sparql_suite(notice=notice, mapping_suite_package=mapping_suite)
validate_notice_with_sparql_suite(notice=notice, mapping_suite_package=mapping_suite, execute_full_validation=False)
log_notice_info(message="Validation :: SPARQL :: END", notice_id=notice.ted_id)
log_notice_info(message="Validation :: SHACL :: START", notice_id=notice.ted_id)
validate_notice_with_shacl_suite(notice=notice, mapping_suite_package=mapping_suite)
validate_notice_with_shacl_suite(notice=notice, mapping_suite_package=mapping_suite, execute_full_validation=False)
log_notice_info(message="Validation :: SHACL :: END", notice_id=notice.ted_id)
log_notice_info(message="Validation :: Summary :: START", notice_id=notice.ted_id)
validation_summary_report_notice(notice=notice)
Expand Down
6 changes: 1 addition & 5 deletions ted_sws/core/model/notice.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ def _check_status_is_validated(self) -> bool:
:return:
"""
if self._rdf_manifestation and self._distilled_rdf_manifestation and self.xml_manifestation:
if self._rdf_manifestation.is_validated() and self._distilled_rdf_manifestation.is_validated() \
and self.xml_manifestation.is_validated():
if self._distilled_rdf_manifestation.is_validated() and self.xml_manifestation.is_validated():
return True
return False

Expand All @@ -294,9 +293,6 @@ def set_rdf_validation(self, rdf_validation: Union[SPARQLTestSuiteValidationRepo

self._rdf_manifestation.add_validation(validation=rdf_validation)

if self._check_status_is_validated():
self.update_status_to(NoticeStatus.VALIDATED)

def set_distilled_rdf_validation(self, rdf_validation: Union[SPARQLTestSuiteValidationReport,
SHACLTestSuiteValidationReport]):
"""
Expand Down
9 changes: 6 additions & 3 deletions ted_sws/notice_validator/services/shacl_test_suite_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ def generate_shacl_report(shacl_test_suite_execution: SHACLTestSuiteValidationRe
return shacl_test_suite_execution


def validate_notice_with_shacl_suite(notice: Union[Notice, List[Notice]], mapping_suite_package: MappingSuite):
def validate_notice_with_shacl_suite(notice: Union[Notice, List[Notice]], mapping_suite_package: MappingSuite,
execute_full_validation: bool = True):
"""
Validates a notice with a shacl test suites
:param notice:
:param mapping_suite_package:
:param execute_full_validation:
:return:
"""

Expand All @@ -98,8 +100,9 @@ def shacl_validation(notice_item: Notice, rdf_manifestation: RDFManifestation) \
notices = notice if isinstance(notice, List) else [notice]

for notice in notices:
for report in shacl_validation(notice_item=notice, rdf_manifestation=notice.rdf_manifestation):
notice.set_rdf_validation(rdf_validation=report)
if execute_full_validation:
for report in shacl_validation(notice_item=notice, rdf_manifestation=notice.rdf_manifestation):
notice.set_rdf_validation(rdf_validation=report)

for report in shacl_validation(notice_item=notice, rdf_manifestation=notice.distilled_rdf_manifestation):
notice.set_distilled_rdf_validation(rdf_validation=report)
Expand Down
9 changes: 6 additions & 3 deletions ted_sws/notice_validator/services/sparql_test_suite_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ def generate_report(self) -> SPARQLTestSuiteValidationReport:
return self.sparql_test_suite_execution


def validate_notice_with_sparql_suite(notice: Union[Notice, List[Notice]], mapping_suite_package: MappingSuite):
def validate_notice_with_sparql_suite(notice: Union[Notice, List[Notice]], mapping_suite_package: MappingSuite,
execute_full_validation: bool = True):
"""
Validates a notice with a sparql test suites
:param notice:
:param mapping_suite_package:
:param execute_full_validation:
:return:
"""

Expand All @@ -164,8 +166,9 @@ def sparql_validation(notice_item: Notice, rdf_manifestation: RDFManifestation)
notices = notice if isinstance(notice, List) else [notice]

for notice in notices:
for report in sparql_validation(notice_item=notice, rdf_manifestation=notice.rdf_manifestation):
notice.set_rdf_validation(rdf_validation=report)
if execute_full_validation:
for report in sparql_validation(notice_item=notice, rdf_manifestation=notice.rdf_manifestation):
notice.set_rdf_validation(rdf_validation=report)

for report in sparql_validation(notice_item=notice, rdf_manifestation=notice.distilled_rdf_manifestation):
notice.set_distilled_rdf_validation(rdf_validation=report)
Expand Down