Martin,

On Sat, Jan 2, 2010 at 8:37 AM, Martin Stricker
<[email protected]>wrote:

> Stephen,
>
> I'm neither an expert in SPARQL nor Virtuoso, but I tend to believe the
> syntax of the (full) query is invalid - I think UNION can only be used to
> combine graph patterns, not full queries (like in SQL). Maybe some of the
> experts here or on the Virtuoso mailing list[1] could clarify? (The query
> returns: S0022 Error SQ200: No column s-12-2.text)
>


Thank you, I'll try asking the Virtuoso list as well.

Yes, from reading about that error response[2] it is invalid:
"Bad column <name> in trigger column list"
"Bad CORRESPONDING BY column <name>"
"Invalid alias declaration: insert trigger cannot reference old values."
"Invalid alias declaration: delete trigger cannot reference new values."

However, I've seen some samples[3] use subqueries (though perhaps not in
UNIONs) and I would like to find what works for combining the sets of
different subqueries.


Though somewhat irrelevant, I found that removing the UNION term and asking
for the same results in both subqueries will return results, while asking
for different results will not:

http://dbpedia.org/snorql/?query=SELECT+%3Ftext+WHERE+{%0D%0A++{%0D%0A++++SELECT+%3Ftext+WHERE+{%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.}%0D%0A++++++UNION%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.+FILTER+langMatches%28+lang%28%3Ftext%29%2C+%22FR%22+%29}%0D%0A++++}%0D%0A++}%0D%0A++%0D%0A++{%0D%0A++++SELECT+%3Ftext+WHERE+{%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.}%0D%0A++++++UNION%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.+FILTER+langMatches%28+lang%28%3Ftext%29%2C+%22FR%22+%29}%0D%0A++++}%0D%0A++++LIMIT+2%0D%0A++}%0D%0A}


Additionally, this snippet is of interest to me:
>
> SELECT DISTINCT * WHERE {
>    {<http://dbpedia.org/resource/Microsoft> dbpedia2:abstract ?text.}
>    UNION
>    {<http://dbpedia.org/resource/Microsoft> dbpedia2:abstract ?text.
> FILTER langMatches( lang(?text), "FR" )}
> }
> LIMIT 1
>
> How do you know that the second pattern has preference? Is this somewhere
> documented, SPARQL specification, Virtuoso?
>

No, unfortunately I don't know.

I chose that sequence because, through testing, it appeared to place the
later results ahead of the first ones. I'll use it for my purposes, but I
haven't seen any documentation on it and don't know of any guarantee that
this behavior is correct.

This is the same query, but with the UNION reversed (it places the other
results ahead of the preferred, French, result):

http://dbpedia.org/snorql/?query=SELECT+*+WHERE+{%0D%0A++{%0D%0A++++SELECT+DISTINCT+*+WHERE+{%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.+FILTER+langMatches%28+lang%28%3Ftext%29%2C+%22FR%22+%29}%0D%0A++++++UNION%0D%0A++++++{%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMicrosoft%3E+dbpedia2%3Aabstract+%3Ftext.}%0D%0A++++}%0D%0A++++LIMIT+1%0D%0A++}%0D%0A}


Best,
>
> Martin
>
> [1] <https://lists.sourceforge.net/lists/listinfo/virtuoso-users>
>

Thank you,
Stephen Hatton

[2] <http://docs.openlinksw.com/virtuoso/errors.html>
[3] <http://www.openlinksw.com/weblog/oerling/?id=1296>
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to