Hi Sebastian,

I think the first query doesn't work because you are trying to filter first
subquery variable in the scope of second subquery.

Regards,
Alexander

2010/3/23 Sebastian Hellmann <[email protected]>

>  Hello,
> the IN is very fast and I would recommend to anyone using it.
> btw. will IN be a part of the next SPARQL recommendation?
>
> I have just a short question (tested on dbpedia):
> SELECT DISTINCT ?subject  { {
> ?subject a ?expanded0 } UNION {
> ?subject a ?expanded1 }
> FILTER ( ?expanded0 IN ( 
> <http://dbpedia.org/ontology/Airline><http://dbpedia.org/ontology/Airline>,
> <http://dbpedia.org/ontology/Band> <http://dbpedia.org/ontology/Band>) ).
> FILTER ( ?expanded1 IN ( 
> <http://dbpedia.org/ontology/Album><http://dbpedia.org/ontology/Album>,
> <http://dbpedia.org/ontology/Book> <http://dbpedia.org/ontology/Book>) ).
>
>  }  LIMIT 50
>
> The query above doesn't work, while this one works:
>
> SELECT DISTINCT ?subject  { {
> ?subject a ?expanded0 .
> FILTER ( ?expanded0 IN ( 
> <http://dbpedia.org/ontology/Airline><http://dbpedia.org/ontology/Airline>,
> <http://dbpedia.org/ontology/Band> <http://dbpedia.org/ontology/Band>) ).
> } UNION {
> ?subject a ?expanded1 .
> FILTER ( ?expanded1 IN ( 
> <http://dbpedia.org/ontology/Album><http://dbpedia.org/ontology/Album>,
> <http://dbpedia.org/ontology/Book> <http://dbpedia.org/ontology/Book>) ).
>
> } }  LIMIT 50
>
> Is there a reason behind it or just a glitch?
> Regards,
> Sebastian
>
> Am 23.03.2010 02:56, schrieb Alexander Sidorov:
>
> Hi Ivan,
>
> Thank you! I should guess by analogy with SQL...
>
> Does IN operator work with subqueries? I have the following query:
>
> SELECT DISTINCT ?s ?p ?o
> FROM <http://www.semanticweb.org/ontologies/2010/1/EventsContent.owl#>
> WHERE
> {
>   ?s ?p ?o
>   FILTER
>   (
>     ?s in
>     (
>       (
>         SELECT DISTINCT ?event
>         FROM <
> http://www.semanticweb.org/ontologies/2010/1/EventsContent.owl#>
>         WHERE
>         {
>           ?event ?property ?value .
>           ?value bif:contains "virtuoso" OPTION (SCORE ?valueScore) .
>         }
>         GROUP BY ?event
>         ORDER BY DESC (sum(?valueScore))
>       )
>     )
>   )
> }
>
> but it returns only first event.
>
> Regards,
> Alexander
>
> 2010/3/23 Ivan Mikhailov <[email protected]>
>
>> Hello Alexander,
>>
>> > Let's imagine we have a list of entities uris' as input and we need to
>> retrieve all triples for each entity.
>>  > Is there any way to execute it using one query?
>>
>>  We have an IN operator extension:
>>
>> select ?p ?o
>> where
>> {
>>  ?s ?p ?o .
>>  filter (?s in (<someGraph#entity1>, <someGraph#entity2>, ...
>>    <someGraph#entityN> ) )
>> }
>>
>> Best Regards,
>>
>> Ivan Mikhailov
>> OpenLink Software
>> http://virtuoso.openlinksw.com
>>
>>
>>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during 
> beta.http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> Virtuoso-users mailing 
> [email protected]https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
>
>
> --
> Dipl. Inf. Sebastian Hellmann
> Department of Computer Science, University of Leipzig
> Homepage: http://bis.informatik.uni-leipzig.de/SebastianHellmann
> Research Group: http://aksw.org
>
>

Reply via email to