Tags

SPARQL for SKOS integrity constraints

I blogged before on how to test SKOS integrity constraints, constraints which couldn't be expressed with OWL2 as defined by W3C.
I'm aware of two solutions that cover those constraints:

Both use SPARQL to check the constraints; the difference being that within the SPIN environment one needs to write the SPARQL queries themselves,
while in the Pellet IC environment OWL axioms (considered under the closed world assumption) are translated to SPARQL in the background.

Anyhow, since I'm still eager to learn more and better SPARQL, I was curious how they compared.
This table summarizes what I found out.

SKOS Constraint SPIN SPARQL OWL2IC SPARQL (1)
S13
skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties
# Constraint S13a: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
ASK WHERE {
?this skos:prefLabel ?label .
?this skos:altLabel ?label .
}
# Constraint S13b: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
ASK WHERE {
?this skos:prefLabel ?label .
?this skos:hiddenLabel ?label .
}
# Constraint S13c: skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties.
ASK WHERE {
?this skos:hiddenLabel ?label .
?this skos:altLabel ?label .
}
Validating constraint: disjointProperties prefLabel altLabel hiddenLabel

SELECT ?x0
WHERE
{ ?x0 skos:altLabel ?x1 ;
skos:prefLabel ?x1 .
}

SELECT ?x0
WHERE
{ ?x0 skos:prefLabel ?x1 ;
skos:hiddenLabel ?x1 .
}

GENERATED FROM OWL axiom

[] a owl:AllDisjointProperties ;
owl:members (skos:prefLabel skos:altLabel skos:hiddenLabel) .
S14
A resource has no more than one value of skos:prefLabel per language tag
# Constraint S14: a resource has no more than one value of skos:prefLabel per language tag.
ASK WHERE {
?this skos:prefLabel ?label1 .
?this skos:prefLabel ?label2 .
LET (?label1lang := lang(?label1)) .
LET (?label2lang := lang(?label2)) .
FILTER ((?label1lang = ?label2lang) && (?label1 != ?label2)) .
}
# This condition cannot be encoded as a OWL integrity constraint directly.
S27
skos:related is disjoint with the property skos:broaderTransitive
# Constraint S27: skos:related is disjoint with the property skos:broaderTransitive.
ASK WHERE {
?this skos:related ?object1 .
?this skos:broaderTransitive ?object2 .
FILTER (?object1 = ?object2) .
}
Validating constraint: related disjointPropertyWith broaderTransitive

SELECT ?x0
WHERE
{ ?x1 owl:bottomObjectProperty ?x0 ;
skos:related ?x0 .
}

GENERATED FROM OWL axiom

skos:related owl:propertyDisjointWith skos:broaderTransitive .
S46
skos:exactMatch owl:propertyDisjointWith skos:broadMatch , skos:relatedMatch
# Constraint S46: skos:exactMatch is disjoint with each of the properties skos:broadMatch and skos:relatedMatch.
ASK WHERE {
?this skos:exactMatch ?exactMatch .
OPTIONAL {
?this skos:broadMatch ?broadMatch .
} .
OPTIONAL {
?this skos:relatedMatch ?relatedMatch .
} .
FILTER ((?exactMatch = ?broadMatch) || (?exactMatch = ?relatedMatch)) .
}
Validating constraint: exactMatch disjointPropertyWith relatedMatch
SELECT ?x0
WHERE
{ ?x1 skos:relatedMatch ?x0 ;
skos:exactMatch ?x0 .
}

SELECT ?x0
WHERE
{ ?x1 skos:exactMatch ?x0 ;
skos:broadMatch ?x0 .
}

GENERATED FROM OWL axiom

skos:exactMatch owl:propertyDisjointWith skos:broadMatch , skos:relatedMatch .

(1) In the case of Pellet ICV I've taken the SPARQL queries as they appeared on stout while using the --verbose argument on the command line.

If you know of other approaches, please let me know.

Comments

Federico Rieckhof (unauthenticated)
Sep 24, 2010

Hello, what about Jena Rules ? With the noValues predicate we can also formulate constraints

Living in the XML and RDF world
Jan 17, 2011

Thanks for this additional input. Will look into it.