Data Requirements Consistency Checks
From SemWebQuality.org
(Difference between revisions)
(7 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
==Contradictory Unique Value Rules== | ==Contradictory Unique Value Rules== | ||
+ | |||
+ | '''With generic superproperty''' | ||
<syntaxhighlight lang="n3"> | <syntaxhighlight lang="n3"> | ||
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | ||
− | SELECT (? | + | PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> |
+ | |||
+ | SELECT | ||
+ | (?genprop AS ?GenericProperty) | ||
+ | (?dr1 AS ?UniqueRequirement) | ||
+ | (?dr2 AS ?NonUniqueRequirement) | ||
WHERE{ | WHERE{ | ||
− | ? | + | ?dr1 a dqm:UniqueValueRule . |
− | ? | + | ?dr1 dqm:testedClass ?class1 . |
+ | ?class1 rdfs:subClassOf ?genclass . | ||
?class1 dqm:hasURI ?class1URI . | ?class1 dqm:hasURI ?class1URI . | ||
− | ? | + | ?dr1 dqm:testedProperty1 ?prop1 . |
+ | ?prop1 rdfs:subPropertyOf ?genprop . | ||
?prop1 dqm:hasURI ?prop1URI . | ?prop1 dqm:hasURI ?prop1URI . | ||
OPTIONAL{ | OPTIONAL{ | ||
− | ? | + | ?dr2 a dqm:PropertyRequirement . |
− | ? | + | ?dr2 dqm:testedClass ?class2 . |
+ | ?class2 rdfs:subClassOf ?genclass . | ||
?class2 dqm:hasURI ?class2URI . | ?class2 dqm:hasURI ?class2URI . | ||
− | ? | + | ?dr2 dqm:testedProperty1 ?prop2 . |
+ | ?prop2 rdfs:subPropertyOf ?genprop . | ||
?prop2 dqm:hasURI ?prop2URI . | ?prop2 dqm:hasURI ?prop2URI . | ||
− | FILTER | + | FILTER(?dr1 != ?dr2) |
MINUS{ | MINUS{ | ||
− | ? | + | ?dr2 a dqm:UniqueValueRule |
+ | } | ||
+ | } | ||
+ | FILTER(bound(?dr2)) | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | '''Without generic superproperty''' | ||
+ | <syntaxhighlight lang="n3"> | ||
+ | PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | ||
+ | SELECT (?dr1 AS ?UniqueValueRequirement) (?dr2 AS ?InconsistentRequirement) | ||
+ | WHERE{ | ||
+ | ?dr1 a dqm:UniqueValueRule . | ||
+ | ?dr1 dqm:testedClass ?class1 . | ||
+ | ?class1 dqm:hasURI ?class1URI . | ||
+ | ?dr1 dqm:testedProperty1 ?prop1 . | ||
+ | ?prop1 dqm:hasURI ?prop1URI . | ||
+ | OPTIONAL{ | ||
+ | ?dr2 a dqm:PropertyRequirement . | ||
+ | ?dr2 dqm:testedClass ?class2 . | ||
+ | ?class2 dqm:hasURI ?class2URI . | ||
+ | ?dr2 dqm:testedProperty1 ?prop2 . | ||
+ | ?prop2 dqm:hasURI ?prop2URI . | ||
+ | FILTER(str(?prop1URI) = str(?prop2URI) && str(?class1URI) = str(?class2URI) && ?dr1 != ?dr2) | ||
+ | MINUS{ | ||
+ | ?dr2 a dqm:UniqueValueRule | ||
} | } | ||
} | } | ||
Line 23: | Line 58: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
==Duplicate Property Requirements== | ==Duplicate Property Requirements== | ||
+ | <syntaxhighlight lang="n3"> | ||
+ | PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | ||
+ | SELECT (?tclassURI1 AS ?Class) (?tpropURI1 AS ?Property) (?dr1 AS ?DataRequirement) | ||
+ | WHERE { | ||
+ | ?dr1 a dqm:PropertyRequirement . | ||
+ | ?dr1 dqm:testedClass ?tclass1 . | ||
+ | ?tclass1 dqm:hasURI ?tclassURI1 . | ||
+ | ?dr1 dqm:testedProperty1 ?tprop1 . | ||
+ | ?tprop1 dqm:hasURI ?tpropURI1 . | ||
+ | } | ||
+ | ORDER BY ?tclassURI1 ?tpropURI1 ?dr1 | ||
+ | </syntaxhighlight> | ||
+ | |||
<syntaxhighlight lang="n3"> | <syntaxhighlight lang="n3"> | ||
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> | ||
Line 45: | Line 92: | ||
} | } | ||
} | } | ||
− | <syntaxhighlight> | + | </syntaxhighlight> |
Latest revision as of 12:37, 27 February 2015
Contradictory Unique Value Rules
With generic superproperty
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> SELECT (?genprop AS ?GenericProperty) (?dr1 AS ?UniqueRequirement) (?dr2 AS ?NonUniqueRequirement) WHERE{ ?dr1 a dqm:UniqueValueRule . ?dr1 dqm:testedClass ?class1 . ?class1 rdfs:subClassOf ?genclass . ?class1 dqm:hasURI ?class1URI . ?dr1 dqm:testedProperty1 ?prop1 . ?prop1 rdfs:subPropertyOf ?genprop . ?prop1 dqm:hasURI ?prop1URI . OPTIONAL{ ?dr2 a dqm:PropertyRequirement . ?dr2 dqm:testedClass ?class2 . ?class2 rdfs:subClassOf ?genclass . ?class2 dqm:hasURI ?class2URI . ?dr2 dqm:testedProperty1 ?prop2 . ?prop2 rdfs:subPropertyOf ?genprop . ?prop2 dqm:hasURI ?prop2URI . FILTER(?dr1 != ?dr2) MINUS{ ?dr2 a dqm:UniqueValueRule } } FILTER(bound(?dr2)) }
Without generic superproperty
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> SELECT (?dr1 AS ?UniqueValueRequirement) (?dr2 AS ?InconsistentRequirement) WHERE{ ?dr1 a dqm:UniqueValueRule . ?dr1 dqm:testedClass ?class1 . ?class1 dqm:hasURI ?class1URI . ?dr1 dqm:testedProperty1 ?prop1 . ?prop1 dqm:hasURI ?prop1URI . OPTIONAL{ ?dr2 a dqm:PropertyRequirement . ?dr2 dqm:testedClass ?class2 . ?class2 dqm:hasURI ?class2URI . ?dr2 dqm:testedProperty1 ?prop2 . ?prop2 dqm:hasURI ?prop2URI . FILTER(str(?prop1URI) = str(?prop2URI) && str(?class1URI) = str(?class2URI) && ?dr1 != ?dr2) MINUS{ ?dr2 a dqm:UniqueValueRule } } FILTER(bound(?prop2URI)) }
Duplicate Property Requirements
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> SELECT (?tclassURI1 AS ?Class) (?tpropURI1 AS ?Property) (?dr1 AS ?DataRequirement) WHERE { ?dr1 a dqm:PropertyRequirement . ?dr1 dqm:testedClass ?tclass1 . ?tclass1 dqm:hasURI ?tclassURI1 . ?dr1 dqm:testedProperty1 ?tprop1 . ?tprop1 dqm:hasURI ?tpropURI1 . } ORDER BY ?tclassURI1 ?tpropURI1 ?dr1
PREFIX dqm:<http://purl.org/dqm-vocabulary/v1.1/dqm#> PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> SELECT ?dr1 ?dr2 WHERE { ?dr1 a dqm:PropertyRequirement . ?dr1 dqm:testedClass ?tclass1 . ?tclass1 dqm:hasURI ?tclassURI1 . ?dr1 dqm:testedProperty1 ?tprop1 . ?tprop1 dqm:hasURI ?tpropURI1 . OPTIONAL{ ?dr2 a dqm:PropertyRequirement . ?dr2 dqm:testedClass ?tclass2 . ?tclass2 dqm:hasURI ?tclassURI2 . ?dr2 dqm:testedProperty1 ?tprop2 . ?tprop2 dqm:hasURI ?tpropURI2 . FILTER(?dr1!=?dr2 && str(?tclassURI1) = str(?tclassURI2) && str(?tpropURI1) = str(?tpropURI2)) } }