Hello Sebastian,
Unfortunately there's no way to calculate the graph to delete by
something more complicated than constant expression. If that creates
severe problems then I will extend the processor to support something
like
clear graph (
select ?mg where {
?mg nrl:coreGraphMetadataFor ?g .
FILTER(?g in (<urn:nepomuk:local:8a9e692a>)) .
FILTER(
!bif:exists((select (1) where { graph ?g { ?s ?p ?o . } . }))
) .
} )
;
but it will delete only the first selected graph.
A workaround that can be used right now is
sparql select (bif:exec(bif:sprintf("sparql clear graph <%s>", str(?mg))))
where {
?mg nrl:coreGraphMetadataFor ?g .
FILTER(?g in (<urn:nepomuk:local:8a9e692a>)) .
FILTER(
!bif:exists((select (1) where { graph ?g { ?s ?p ?o . } . }))
) .
} ;
(tested on commercial 06.02.3130 but it should work identically on all "version
6" virtuosos as well)
Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com
On Wed, 2011-06-29 at 12:41 +0200, Sebastian Trüg wrote:
> Hi list,
>
> With this query:
>
> clear graph ?mg where {
> ?mg nrl:coreGraphMetadataFor ?g .
> FILTER(?g in (<urn:nepomuk:local:8a9e692a>)) .
> FILTER(
> !bif:exists((select (1) where { graph ?g { ?s ?p ?o . } . }))
> ) .
> }
>
> I get the following error:
>
> "SP031: SPARQL compiler: non-global variable 'mg' can not be used
> outside any group pattern or result-set list"
>
> Any idea how to fix this? How to remove graphs which are related to
> empty graphs the way I am trying in the query?
>
> Cheers,
> Sebastian