Hello Sebastian,
If ?app always gets exactly one value, what's the purpose in the
subquery?

If you're not sure that ?app is the only (e.g., if triple ?app
nao:identifier "nepomukindexer" can appear in more than one graph), then
you can write, of course,

select distinct ?r where {
     graph ?g {
         ?r nie:url ?url .
     }  .
     ?g nao:maintainedBy ?app .
     filter (?app = (select ?a where { ?a nao:identifier "nepomukindexer" }))
}

or even shorter

select distinct ?r where { 
graph ?g {
         ?r nie:url ?url .
     }  .
     ?g nao:maintainedBy `(select ?a where { ?a nao:identifier "nepomukindexer" 
})` .
}


Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com


On Mon, 2011-07-04 at 14:42 +0200, Sebastian Trüg wrote:
> Hi list,
> 
> in a query like this:
> 
> select distinct ?r where {
>      graph ?g {
>          ?r nie:url ?url .
>      }  .
>      ?g nao:maintainedBy ?app .
>      ?app nao:identifier "nepomukindexer" .
> }
> 
> I would like to use a sub-query to replace ?app since there is only
> exactly one resource which has this identifier. The simplest possibility
> is to use two queries and cache the resource URI of the app in the
> client. But I figure there could be a fancy sub-query which allowed me
> to query the app in-place.
> 
> Is that possible?
> 
> Cheers,
> Sebastian
> 
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security 
> threats, fraudulent activity, and more. Splunk takes this data and makes 
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users



Reply via email to