Stephen Hatton wrote:
Hi!
I'm trying to build localization into a DBpedia application (which
uses the Virtuoso Database), but I've run into some problems.
To return multilingual results (using a given language or, if it isn't
available, falling back to an available language),
I'm using the following sort of SPARQL query (at dbpedia.org/snorql
<http://dbpedia.org/snorql> ):
SELECT * WHERE {
{
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
}
#UNION
#{
#SELECT DISTINCT * WHERE {
#{<http://dbpedia.org/resource/Google> dbpedia2:abstract ?text.}
#UNION
#{<http://dbpedia.org/resource/Google> dbpedia2:abstract ?text.
FILTER langMatches( lang(?text), "FR" )}
#}
#LIMIT 1
#}
}
This works as long as only the first half is active. With the second
half also uncommented, it returns "S0022 Error SQ200: No column
s-13-2.text."
The problems I have are:
* How would I combine the results of two or more subqueries, and...
* What are the rules for the order or precedence of results from
unions?
To be more specific with the second question:
if the first subquery of the example code above has its union
statements reversed, it will return an English result instead of a
French one.
Example:
SELECT DISTINCT * WHERE {
{<http://dbpedia.org/resource/Microsoft> dbpedia2:abstract ?text.
FILTER langMatches( lang(?text), "FR" )}
UNION
{<http://dbpedia.org/resource/Microsoft> dbpedia2:abstract ?text.}
}
LIMIT 1
Does anyone know of answers to these problems?
Thank you,
Stephen Hatton
------------------------------------------------------------------------
------------------------------------------------------------------------------
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
------------------------------------------------------------------------
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users
Stephen,
Just for the record.
What you spotted was a SPARQL bug.
It is now fixed, and we have a live instance of the fix at:
http://lod.openlinksw.com (our larger Linked Open Data Cache) instance.
iSPARQL URL for your query: http://bit.ly/8cRA8J (query tab will show
you the query text or click on the query URI to get into the query
editor etc..).
SPARQL URL: http://bit.ly/8twani
Live DBpedia instance will soon be updated also, but for now the problem
is still there as per:
http://bit.ly/8pszfq
--
Regards,
Kingsley Idehen Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO
OpenLink Software Web: http://www.openlinksw.com