88""" """
99from datetime import datetime
1010from enum import Enum
11- from typing import List , Union , Optional
11+ from typing import List , Union , Optional , Dict
1212
1313from pydantic import Field
1414
@@ -42,10 +42,66 @@ def __str__(self):
4242 return f"/{ str (content )[:STR_LEN ]} " + ("..." if len (content ) > STR_LEN else "" ) + "/"
4343
4444
45+ class ValidationManifestation (Manifestation ):
46+ """
47+ The validation report
48+ """
49+ created : str = datetime .now ().isoformat ()
50+
51+
52+ class XMLValidationManifestation (ValidationManifestation ):
53+ """
54+
55+ """
56+ mapping_suite_identifier : str
57+
58+
59+ class XPATHCoverageValidationAssertion (PropertyBaseModel ):
60+ """
61+
62+ """
63+ title : Optional [str ]
64+ xpath : Optional [str ]
65+ count : Optional [int ]
66+ notice_hit : Optional [Dict [str , int ]]
67+ query_result : Optional [bool ]
68+
69+
70+ class XPATHCoverageValidationResult (PropertyBaseModel ):
71+ """
72+
73+ """
74+ notice_id : Optional [List [str ]] = []
75+ xpath_assertions : Optional [List [XPATHCoverageValidationAssertion ]] = []
76+ xpath_covered : Optional [List [str ]] = []
77+ xpath_not_covered : Optional [List [str ]] = []
78+ xpath_extra : Optional [List [str ]] = []
79+ coverage : Optional [float ]
80+ conceptual_coverage : Optional [float ]
81+
82+
83+ class XPATHCoverageValidationReport (XMLValidationManifestation ):
84+ """
85+ This is the model structure for Notice(s) XPATHs Coverage Report
86+ """
87+
88+ validation_result : Optional [XPATHCoverageValidationResult ]
89+
90+
4591class XMLManifestation (Manifestation ):
4692 """
4793 Original XML Notice manifestation as published on the TED website.
4894 """
95+ xpath_coverage_validation : XPATHCoverageValidationReport = None
96+
97+ def add_validation (self , validation : Union [XPATHCoverageValidationReport ]):
98+ if type (validation ) == XPATHCoverageValidationReport :
99+ self .xpath_coverage_validation : XPATHCoverageValidationReport = validation
100+
101+ def is_validated (self ) -> bool :
102+ if self .xpath_coverage_validation :
103+ return True
104+ return False
49105
50106
51107class METSManifestation (Manifestation ):
@@ -54,13 +110,13 @@ class METSManifestation(Manifestation):
54110 """
55111
56112
57- class RDFValidationManifestation (Manifestation ):
113+ class RDFValidationManifestation (ValidationManifestation ):
58114 """
59- The validation report
115+ The RDF validation report
116+
60117 """
61- created : str = datetime .now ().isoformat ()
62- test_suite_identifier : str
63118 mapping_suite_identifier : str
119+ test_suite_identifier : Optional [str ]
64120
65121
66122class SPARQLQuery (PropertyBaseModel ):
@@ -128,3 +184,67 @@ def is_validated(self) -> bool:
128184 if len (self .shacl_validations ) and len (self .sparql_validations ):
129185 return True
130186 return False
187+
188+
189+ class XPATHCoverageSummaryResult (PropertyBaseModel ):
190+ xpath_covered : Optional [int ] = 0
191+ xpath_not_covered : Optional [int ] = 0
192+
193+
194+ class XPATHCoverageSummaryReport (PropertyBaseModel ):
195+ mapping_suite_identifier : Optional [str ]
196+ validation_result : Optional [XPATHCoverageSummaryResult ] = XPATHCoverageSummaryResult ()
197+
198+
199+ class XMLManifestationValidationSummaryReport (PropertyBaseModel ):
200+ xpath_coverage_summary : Optional [XPATHCoverageSummaryReport ] = XPATHCoverageSummaryReport ()
201+
202+
203+ class SPARQLSummaryCountReport (PropertyBaseModel ):
204+ success : Optional [int ] = 0
205+ fail : Optional [int ] = 0
206+ error : Optional [int ] = 0
207+
208+
209+ class SPARQLSummaryResult (PropertyBaseModel ):
210+ test_suite_identifier : Optional [str ]
211+ mapping_suite_identifier : Optional [str ]
212+ aggregate : Optional [SPARQLSummaryCountReport ] = SPARQLSummaryCountReport ()
213+
214+
215+ class SPARQLSummaryReport (PropertyBaseModel ):
216+ validation_results : Optional [List [SPARQLSummaryResult ]] = []
217+ aggregate : Optional [SPARQLSummaryCountReport ] = SPARQLSummaryCountReport ()
218+
219+
220+ class SHACLSummarySeverityCountReport (PropertyBaseModel ):
221+ info : Optional [int ] = 0
222+ warning : Optional [int ] = 0
223+ violation : Optional [int ] = 0
224+
225+
226+ class SHACLSummaryResultSeverityReport (PropertyBaseModel ):
227+ aggregate : Optional [SHACLSummarySeverityCountReport ] = SHACLSummarySeverityCountReport ()
228+
229+
230+ class SHACLSummaryResult (PropertyBaseModel ):
231+ test_suite_identifier : Optional [str ]
232+ mapping_suite_identifier : Optional [str ]
233+ result_severity : Optional [SHACLSummaryResultSeverityReport ] = SHACLSummaryResultSeverityReport ()
234+
235+
236+ class SHACLSummaryReport (PropertyBaseModel ):
237+ validation_results : Optional [List [SHACLSummaryResult ]] = []
238+ result_severity : Optional [SHACLSummaryResultSeverityReport ] = SHACLSummaryResultSeverityReport ()
239+
240+
241+ class RDFManifestationValidationSummaryReport (PropertyBaseModel ):
242+ sparql_summary : Optional [SPARQLSummaryReport ] = SPARQLSummaryReport ()
243+ shacl_summary : Optional [SHACLSummaryReport ] = SHACLSummaryReport ()
244+
245+
246+ class ValidationSummaryReport (ValidationManifestation ):
247+ xml_manifestation : Optional [XMLManifestationValidationSummaryReport ] = XMLManifestationValidationSummaryReport ()
248+ rdf_manifestation : Optional [RDFManifestationValidationSummaryReport ] = RDFManifestationValidationSummaryReport ()
249+ distilled_rdf_manifestation : Optional [
250+ RDFManifestationValidationSummaryReport ] = RDFManifestationValidationSummaryReport ()
0 commit comments