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
Cutting a long story short.
Use HTTP Transparent Negotiation when de-referencing the description of
entity: <http://dbpedia.org/resource/Microsoft> from
http://dbpedia-live.openlinksw.com, as in:
http://dbpedia-live.openlinksw.com/resource/Microsoft. This instance has
all the language data sets loaded (unilike the Static DBpedia instance).
Hope this helps you understand that part of the problem lies with the
static DBpedia instance which doesn't load all the language datasets
(unlike the DBpedia-Live instance).
Kingsley
------------------------------------------------------------------------
------------------------------------------------------------------------------
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
--
Regards,
Kingsley Idehen Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO
OpenLink Software Web: http://www.openlinksw.com