Skip to content

Commit f8e3764

Browse files
authored
Merge pull request #472 from OP-TED/feature/TED-1227
Feature/ted 1227
2 parents b158090 + a68085e commit f8e3764

6 files changed

Lines changed: 86 additions & 40 deletions

File tree

ted_sws/mapping_suite_processor/adapters/mapping_suite_structure_checker.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ def validate_output_structure(self) -> bool:
102102

103103
success = True
104104

105-
def _iter_dir(path):
106-
return [i for i in path.iterdir() if i.is_dir()]
107-
108105
mandatory_paths_l3 = [
109106
self.mapping_suite_path / MS_OUTPUT_FOLDER_NAME,
110107
]

ted_sws/notice_validator/resources/templates/shacl_shape_validation_results_report.jinja2

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
[data-role=collapsible] .ui-collapsible-content {
5454
padding: 10px;
5555
}
56+
57+
hr {
58+
margin: 12px 0;
59+
height: 5PX;
60+
background: #ccc;
61+
border: 0;
62+
}
5663
</style>
5764
</head>
5865
<body>
@@ -63,8 +70,10 @@
6370
<li>Date created: {{ created }}</li>
6471
<li>SHACL test suite identifier: {{ test_suite_identifier }}</li>
6572
<li>Mapping suite identifier: {{ mapping_suite_identifier }}</li>
73+
</ul>
6674
{% if notice_ids %}
67-
<li><div><hr></div>
75+
<hr>
76+
<ul><li>
6877
{% set nr_notices = notice_ids|length %}
6978
{% if nr_notices > 1 %}
7079
Notice identifiers ({{ nr_notices }}):
@@ -78,9 +87,8 @@
7887
{% elif nr_notices == 1 %}
7988
<b>Notice identifier: {{ notice_ids[0] }}</b>
8089
{% endif %}
81-
</li>
90+
</li></ul>
8291
{% endif %}
83-
</ul>
8492
<hr>
8593
<h2>Results</h2>
8694
<table class="dataTable">
@@ -127,8 +135,8 @@
127135
{% endfor %}
128136
</tbody>
129137
</table>
130-
131138
{% endif %}
139+
<hr>
132140
</body>
133141
</html>
134142
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

ted_sws/notice_validator/resources/templates/shacl_summary_report.jinja2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
[data-role=collapsible] .ui-collapsible-content {
9494
padding: 10px;
9595
}
96+
97+
hr {
98+
margin: 12px 0;
99+
height: 5PX;
100+
background: #ccc;
101+
border: 0;
102+
}
96103
</style>
97104
</head>
98105
<h1>SPARQL Validation Summary Report</h1>

ted_sws/notice_validator/resources/templates/sparql_query_results_report.jinja2

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
margin: 25px auto;
1919
width: 80%;
2020
}
21+
a[data-search-by-status] {
22+
text-decoration: none;
23+
}
2124
table th, table td {
2225
vertical-align: top;
2326
}
@@ -33,6 +36,9 @@
3336
.warning {
3437
color: #8a6d3b;
3538
}
39+
.unknown {
40+
color: #000;
41+
}
3642
.danger, .invalid, .error {
3743
color: #a94442;
3844
}
@@ -85,6 +91,13 @@
8591
padding: 10px;
8692
}
8793
94+
hr {
95+
margin: 12px 0;
96+
height: 5PX;
97+
background: #ccc;
98+
border: 0;
99+
}
100+
88101
</style>
89102
</head>
90103
<body>
@@ -95,8 +108,11 @@
95108
<li>Date created: {{ created }}</li>
96109
<li>SPARQL test suite identifier: {{ test_suite_identifier }}</li>
97110
<li>Mapping suite identifier: {{ mapping_suite_identifier }}</li>
98-
{% if notice_ids %}
99-
<li><div><hr></div>
111+
</ul>
112+
{% if notice_ids %}
113+
<hr>
114+
<ul>
115+
<li>
100116
{% set nr_notices = notice_ids|length %}
101117
{% if nr_notices > 1 %}
102118
Notice identifiers ({{ nr_notices }}):
@@ -111,32 +127,34 @@
111127
<b>Notice identifier: {{ notice_ids[0] }}</b>
112128
{% endif %}
113129
</li>
114-
{% endif %}
115130
</ul>
131+
{% endif %}
116132
<hr>
117133
<h2>Results summary</h2>
118-
<table class="display" data-order='[[0, "asc"]]'>
119-
<thead class="center aligned">
120-
<tr>
121-
<th>Result</th>
122-
<th>Count</th>
123-
<th>Ratio (%)</th>
124-
</tr>
125-
</thead>
126-
<tbody>
127-
{% for _value in ['valid', 'unverifiable', 'warning', 'invalid', 'error', 'unknown'] %}
128-
<tr>
129-
{% set _results = validation_results | selectattr("result", "equalto", _value) | list | count %}
130-
<td class="strong {{ _value }}">{{ _value }}</td>
131-
<td>{{ _results }}</td>
132-
<td>{{ (_results / results_count * 100) | round(2) }}%</td>
133-
</tr>
134-
{% endfor %}
135-
</tbody>
136-
</table>
134+
<table class="display summary" data-order='[[0, "asc"]]'>
135+
<thead class="center aligned">
136+
<tr>
137+
<th>Result</th>
138+
<th>Count</th>
139+
<th>Ratio (%)</th>
140+
</tr>
141+
</thead>
142+
<tbody>
143+
{% for _value in ['valid', 'unverifiable', 'warning', 'invalid', 'error', 'unknown'] %}
144+
<tr>
145+
{% set _results = validation_results | selectattr("result", "equalto", _value) | list | count %}
146+
<td>
147+
<a href="#" data-search-by-status="{{ _value }}" class="strong {{ _value }}">{{ _value }}</a>
148+
</td>
149+
<td>{{ _results }}</td>
150+
<td>{{ (_results / results_count * 100) | round(2) }}%</td>
151+
</tr>
152+
{% endfor %}
153+
</tbody>
154+
</table>
137155
<hr>
138156
<h2>Results</h2>
139-
<table class="display" data-order='[[0, "asc"]]'>
157+
<table class="display results" data-order='[[0, "asc"]]'>
140158
<thead class="center aligned">
141159
<tr>
142160
<th>Form Field</th>
@@ -157,17 +175,16 @@
157175
</div>
158176
</td>
159177
<td>{{ result.query.query | e | replace('\n', '<br>') }}</td>
160-
<td class="strong {{ result.result }}">{{ result.result }}</td>
178+
<td class="strong {{ result.result }}" data-search="{{ result.result }}">{{ result.result }}</td>
161179
<td>
162180
<button class="open-dialog">Details</button>
163181
<div class="dialog" title="{{ result.query.title }}">
164182
<ul>
165183
<li>Query result: {{ result.query_result }}</li>
166184
{% if result.query.xpath|length == 0 %}
167185
<li>No XPATHs provided</li>
168-
{% endif %}
169-
<li>Fields are covered: {{ result.fields_covered }}</li>
170-
{% if result.query.xpath|length > 0 %}
186+
{% else %}
187+
<li>Fields are covered: {{ result.fields_covered }}</li>
171188
<li>
172189
<h4 class="info">Fields:</h4>
173190
<ol>
@@ -210,7 +227,7 @@
210227
</table>
211228
<hr>
212229
<h2>Query results summary</h2>
213-
<table class="display" data-order='[[0, "asc"]]'>
230+
<table class="display summary" data-order='[[0, "asc"]]'>
214231
<thead class="center aligned">
215232
<tr>
216233
<th>Query result</th>
@@ -242,6 +259,7 @@
242259
</tr>
243260
</tbody>
244261
</table>
262+
<hr>
245263
</body>
246264
</html>
247265
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
@@ -258,7 +276,10 @@
258276
$c.attr("data-state", $c.attr("data-state") == "collapsed" ? "expanded" : "collapsed");
259277
return false;
260278
});
261-
$("table.display").DataTable({
279+
$("table.display.summary").DataTable({
280+
dom: 'r'
281+
});
282+
const data_table = $("table.display.results").DataTable({
262283
dom: 'B<"clear">lfiprtip',
263284
buttons: [],
264285
"lengthMenu": [[5, 15, 30, -1], [5, 15, 30, "All"]],
@@ -267,6 +288,10 @@
267288
details: true
268289
}
269290
});
291+
$("a[data-search-by-status]").click(function() {
292+
data_table.search($(this).data("search-by-status")).draw();
293+
return false;
294+
});
270295
271296
$(document).on('click', '.open-dialog', function () {
272297
$dialog = $(this).next('.dialog');

ted_sws/notice_validator/resources/templates/sparql_summary_report.jinja2

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@
9494
padding: 10px;
9595
}
9696
97+
hr {
98+
margin: 12px 0;
99+
height: 5PX;
100+
background: #ccc;
101+
border: 0;
102+
}
97103
</style>
98104
</head>
99105
<body>
@@ -144,7 +150,7 @@
144150

145151
<hr>
146152
<h2>Results summary</h2>
147-
<table class="display" data-order='[[0, "asc"]]'>
153+
<table class="display summary" data-order='[[0, "asc"]]'>
148154
<thead class="center aligned">
149155
<tr>
150156
<th>Result</th>
@@ -163,7 +169,7 @@
163169
</table>
164170
<hr>
165171
<h2>Results</h2>
166-
<table class="display" data-order='[[0, "asc"]]'>
172+
<table class="display results" data-order='[[0, "asc"]]'>
167173
<thead class="center aligned">
168174
<tr>
169175
<th>Form Field</th>
@@ -225,7 +231,10 @@
225231
$c.attr("data-state", $c.attr("data-state") == "collapsed" ? "expanded" : "collapsed");
226232
return false;
227233
});
228-
$("table.display").DataTable({
234+
$("table.display.summary").DataTable({
235+
dom: 'r'
236+
});
237+
$("table.display.results").DataTable({
229238
dom: 'B<"clear">lfiprtip',
230239
buttons: [],
231240
"lengthMenu": [[5, 15, 30, -1], [5, 15, 30, "All"]],

ted_sws/notice_validator/services/sparql_test_suite_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _process_sparql_ask_result(self, query_result, sparql_query: SPARQLQuery,
9393
if xpath_coverage_validation and xpath_coverage_validation.validation_result:
9494
xpath_validation_result = xpath_coverage_validation.validation_result
9595

96-
sparql_query_result.fields_covered = any(
96+
sparql_query_result.fields_covered = not sparql_query.xpath or any(
9797
map(lambda v: v in xpath_validation_result.xpath_covered, sparql_query.xpath))
9898

9999
sparql_query_xpath = set(sparql_query.xpath)

0 commit comments

Comments
 (0)