Yes, you can use multiple "Union" in a sparql query.
2012/9/10 Katja Siegemund <[email protected]> > Hm, well, but how can I use UNION for multiple times? I have a lot of > "or's" in my query :( > > > > Am 10.09.2012 12:29, schrieb Francesco Panico: > >> Hi >> >> >> Your query selects all triples without "source", at first. If the two >> elements without an "author" have a "source", they will be discarded, >> because the values added by "optional" clause have to respect "where >> clauses" anyway. >> You can check it. >> >> You can try to use UNION construct, because you want to retrieve a list >> with >> -item without a source >> -item without author >> >> SELECT ?r >> WHERE {?r a ro:FR. >> FILTER NOT EXISTS {?r ro:hasSource ?a} >> >> UNION{ ?r a ro:FR. >> FILTER NOT EXISTS {?r ro:isAuthoredBy ?a} >> } >> } >> >> >> I hope it is useful. >> Regards >> Francesco. >> >> >> >> >> >> >> 2012/9/10 Katja Siegemund <[email protected]**> >> >> Hi, >>> >>> I'm having trouble with constructing a query that uses "or". I already >>> tried optional, but it does not lead to the expected result. I'd be glad >>> if >>> someone could help me. I'd like to query for: >>> >>> all var bindings that have no author or no source. >>> >>> I tried: >>> >>> SELECT ?r WHERE {?r a ro:FR. FILTER NOT EXISTS {?r ro:hasSource ?a} >>> OPTIONAL {FILTER NOT EXISTS {?r ro:isAuthoredBy ?a}}}"; >>> >>> But it only computes the first part (source). >>> >>> If I have 3 items without a source and 2 others with no author, then I >>> should get 5 results instead only the first 3. What am I doing wrong? >>> >>> Thanks in advance, >>> Katja >>> >>> >>> >> > > -- > Dipl.-Medieninf. Katja Siegemund > Research Assistant > > Technische Universität Dresden > Department of Computer Science > > Phone +49 (0)40 572 44 55 1 > Email [email protected] > WWW http://st.inf.tu-dresden.de/ > > -- ufficio: 0542 32640 mail: [email protected] cell: 349 3508348 skype: [email protected]
