-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage.rq
More file actions
48 lines (48 loc) · 2.18 KB
/
Copy pathcoverage.rq
File metadata and controls
48 lines (48 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Coverage and the outcome distribution, recomputed from the record, one row
# per record. Coverage: the weighted share of acceptance criteria that carry at
# least one attestation with an outcome of passed, failed or cantTell (ruling
# R-01: the criterion is the coverage item). The distribution is over the
# covered criteria and uses each criterion's outcome; a criterion with several
# attestations counts once, as failed if any failed (one bad turn fails the
# probe, per the paper), else passed if any passed, else cantTell.
#
# Precondition (sheet 10-31): the record and the EPO vocabulary sit in one
# default graph. Every criterion and attestation is read through its record
# (ogc:inRecord, the prov:Bundle), so two records in one graph give two rows,
# and a graph with no criterion gives no row at all (the HAVING clause; a
# store that keeps each file in its own named graph answers nothing, round
# four, KG 13).
PREFIX epo: <https://w3id.org/og-caie/epo#>
PREFIX earl: <http://www.w3.org/ns/earl#>
PREFIX ogc: <https://w3id.org/og-caie/>
SELECT ?record
(SUM(?coveredWeight) / SUM(?w) AS ?coverage)
(SUM(?covered) AS ?coveredCount)
(SUM(?passed) / SUM(?covered) AS ?passRate)
(SUM(?failed) / SUM(?covered) AS ?failRate)
(SUM(?cantTell) / SUM(?covered) AS ?cantTellRate)
WHERE {
{
SELECT ?record ?a ?w
(IF(?nFailed > 0, 1, 0) AS ?failed)
(IF(?nFailed = 0 && ?nPassed > 0, 1, 0) AS ?passed)
(IF(?nFailed = 0 && ?nPassed = 0 && ?nCantTell > 0, 1, 0) AS ?cantTell)
(IF(?nFailed + ?nPassed + ?nCantTell > 0, 1, 0) AS ?covered)
(IF(?nFailed + ?nPassed + ?nCantTell > 0, ?w, 0) AS ?coveredWeight)
WHERE {
{
SELECT ?record ?a ?w
(SUM(IF(BOUND(?o) && ?o = earl:failed, 1, 0)) AS ?nFailed)
(SUM(IF(BOUND(?o) && ?o = earl:passed, 1, 0)) AS ?nPassed)
(SUM(IF(BOUND(?o) && ?o = earl:cantTell, 1, 0)) AS ?nCantTell)
WHERE {
?a a epo:AcceptanceCriterion ; ogc:inRecord ?record ; epo:weight ?w .
OPTIONAL { ?t a epo:Attestation ; ogc:inRecord ?record ; earl:test ?a ; earl:result ?r . ?r earl:outcome ?o . }
}
GROUP BY ?record ?a ?w
}
}
}
}
GROUP BY ?record
HAVING (SUM(?w) > 0)