query.clean.intersection.rq Maven / Gradle / Ivy
#
# Factorize all occurrences of same intersection list
# into the same list everywhere
# x owl:intersectionOf list
#
# Olivier Corby - Wimmics Inria UCA - 2021
#
delete {
?s ?p ?dx
?dx owl:intersectionOf ?dl
?b rdf:first ?f ; rdf:rest ?r
}
insert {
?s ?p ?xx
}
where {
# lx is the list of subject that share the same intersection list
{select ?list (aggregate(?x) as ?lx)
where {
select ?x (xt:sort(aggregate(?e)) as ?list)
where {
?x owl:intersectionOf ?l .
?l rdf:rest*/rdf:first ?e
}
group by ?x
}
group by ?list
having (xt:size(?lx) > 1)
}
# xx will replace other occurrences dx
bind (xt:first(?lx) as ?xx)
# other occurrence dx
values ?dx { unnest(xt:rest(?lx)) }
?s ?p ?dx
?dx owl:intersectionOf ?dl
?dl rdf:rest* ?b
?b rdf:first ?f ; rdf:rest ?r
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy