Open
Description
Just recording this here; we may want to fix this elsewhere but https://github.com/Swirrl/muttnik/issues/865 exposes this problem.
Essentially the IC-17 validations are sensitive to duplicates of the DSD. This can be fixed by changing the validation to compare COUNT(DISTINCT ?xxx)
counts instead e.g:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX qb: <http://purl.org/linked-data/cube#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
#! PMDCUBE-Validation. All measures present in measures dimension cube
# Base RDF Data Cube IC-17
# In a qb:DataSet which uses a Measure dimension then if there is a Observation
# for some combination of non-measure dimensions then there must be other Observations
# with the same non-measure dimension values for each of the declared measures.
# Count number of other measures found at each point
SELECT ?obs1 ?numMeasures (COUNT(DISTINCT ?obs2) AS ?count)
WHERE {
{
# Find the DSDs and check how many measures they have
SELECT ?dsd (COUNT(DISTINCT ?m) AS ?numMeasures) WHERE {
?dsd qb:component/qb:measure ?m.
} GROUP BY ?dsd
}
# Observation in measureType cube
?obs1 qb:dataSet/qb:structure ?dsd;
qb:dataSet ?dataset ;
qb:measureType ?m1 .
# Other observation at same dimension value
?obs2 qb:dataSet ?dataset ;
qb:measureType ?m2 .
FILTER NOT EXISTS {
?dsd qb:component/qb:dimension ?dim .
FILTER (?dim != qb:measureType)
?obs1 ?dim ?v1 .
?obs2 ?dim ?v2.
FILTER (?v1 != ?v2)
}
} GROUP BY ?obs1 ?numMeasures
HAVING (?count != ?numMeasures)
Metadata
Metadata
Assignees
Labels
No labels