virtuoso - Is it possible to do a SPARQL DELETE{} WHERE{} with a FILTER(COUNT(DISTINCT ?obj) > x) in the WHERE clause? -
i want achieve delete deletes triples there less x distinct objects per subject.
the intended query should after feeling:
delete { ?sub ?pred ?obj . } { {select ?sub ?pred ?obj (count(?obj) ?count) { ?sub ?pred ?obj . } group ?sub } filter(?count < 14) }
the above not work.
also group by
necessary achieve ?obj
per ?sub
part, can't figure how this.
can push me in right direction solve task?
note subquery isn't legal query. if try validate subquery on sparql.org's query validator, output:
syntax error:
non-group key variable in select: ?pred
strangely enough, though, whole query does validate update validator. it's not clear attempted query you're trying delete, , statement:
i want achieve delete deletes triples there less x distinct objects per subject.
doesn't make clear either. if you're trying delete triples subject related less 10 distinct objects on all predicates used subject, you'd find them this:
select ?s ?p ?o { ?s ?p ?o { select ?s { ?s ?pp ?oo } group ?s having (count(distinct ?oo) < 10) } }
then, extending delete easy:
delete { ?s ?p ?o } { ?s ?p ?o { select ?s { ?s ?pp ?oo } group ?s having (count(distinct ?oo) < 10) } }
Comments
Post a Comment