@prefix rule: . @prefix qb: . @prefix sdmx-dimension: . @prefix leri: . @prefix ler: . @prefix rdfs: . @prefix dc: . @prefix eg: . @prefix xsd: . @prefix cedarterms: . # cedar1: observations have one occupation at most leri:cedar1 a rule:SPARQLRule, ler:EditRule ; rule:content """ PREFIX leri: PREFIX cedarterms: PREFIX qb: PREFIX ler: IF { ?obs a qb:Observation. ?obs cedarterms:occupationPosition ?pos1 . ?obs cedarterms:occupationPosition ?pos2 . FILTER (?pos1 != ?pos2) } THEN { ?obs ler:inconsistentWith leri:cedar1 . } """; ler:scope qb:Observation ; ler:component cedarterms:occupationPosition ; rdfs:label "One occupation position per observation"@en ; rdfs:comment "A population count can't account for two occupation positions at the same time"@en ; dc:creator ; dc:date "2015-01-08T16:03:40+01:00"^^xsd:dateTime . # cedar2: population counts must be integers leri:cedar2 a rule:SPARQLRule, ler:EditRule ; rule:content """ PREFIX leri: PREFIX cedarterms: PREFIX qb: PREFIX ler: PREFIX xsd: IF { ?obs a qb:Observation . ?measure a qb:MeasureProperty . ?obs ?measure ?population . FILTER (datatype(?population) != xsd:integer) } THEN { ?obs ler:inconsistentWith leri:cedar2 . } """; ler:scope qb:Observation ; ler:component qb:MeasureProperty, cedarterms:population ; rdfs:label "class(population) == 'integer'"@en ; rdfs:comment "A population count must be an integer number"@en ; dc:creator ; dc:date "2015-01-08T16:03:40+01:00"^^xsd:dateTime . # cedar3: population > 0 leri:cedar3 a rule:SPARQLRule, ler:EditRule ; rule:content """ PREFIX leri: PREFIX cedarterms: PREFIX qb: PREFIX ler: PREFIX xsd: IF { ?obs a qb:Observation . ?measure a qb:MeasureProperty . ?obs ?measure ?population . FILTER (?population <= 0) } THEN { ?obs ler:inconsistentWith leri:cedar3 . } """; ler:scope qb:Observation ; ler:component qb:MeasureProperty, cedarterms:population ; rdfs:label "population > 0"@en ; rdfs:comment "A population count must be a positive number"@en ; dc:creator ; dc:date "2015-01-08T16:03:40+01:00"^^xsd:dateTime . # cedar4: dataset meets Benford's Law # See http://en.wikipedia.org/wiki/Benford%27s_law leri:cedar4 a rule:SPARQLRule, ler:EditRule ; rule:content """ PREFIX leri: PREFIX cedarterms: PREFIX qb: PREFIX ler: PREFIX xsd: PREFIX stardog: IF { ?ds a qb:DataSet . ?measure a qb:MeasureProperty . FILTER (stardog:R("benford", ?ds, ?measure) <= 0.05) } THEN { ?obs ler:inconsistentWith leri:cedar4 . } """; ler:scope qb:DataSet ; ler:component qb:MeasureProperty, cedarterms:population ; rdfs:label "benford(ds)$p.value > 0.05'"@en ; rdfs:comment "Population counts must meet Benford's Law"@en ; dc:creator ; dc:date "2015-01-08T16:03:40+01:00"^^xsd:dateTime .