sttl.datashape.constraint.sparql.rq Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of corese-core Show documentation
Show all versions of corese-core Show documentation
Corese is a Semantic Web Factory (triple store and SPARQL endpoint) implementing RDF, RDFS, SPARQL 1.1
Query and Update.
#
# SPARQL Based Constraint
# Evaluate SPARQL query with pre-bind of variable $this with focus nodes
# SPARQL query returns solutions that fail the Constraint
#
prefix sh:
template sh:sparql (?shape, ?sh, ?vis, ?s, ?cst) {
sh:safe(?shape, ?sh, ?suc)
}
where {
graph ?shape {
?sh sh:sparql ?cst
?cst sh:select ?q
filter not exists { ?cst sh:deactivated true }
# collect prefix definitions
# TBD: do it once and record it
{
select ?cst
(group_concat(concat("prefix ", ?pr, ": <", str(?ns), ">") ; separator="\n")
as ?define)
where {
?cst sh:prefixes ?ns
[] sh:declare [ sh:prefix ?pr ; sh:namespace ?ns ]
}
group by ?cst
}
}
values ($this ?path ?value) { unnest(kg:sparql(concat(?define, ?q), "$this", ?s)) }
# SPARQL query returns solutions that fail
bind (false as ?suc)
bind (st:report(sh:sparql, ?cst, ?shape, ?s, ?path, ?value, ?suc, ?vis) as ?b)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy