Stephen, your query simply asks to fill ?text if language "de"/"he" is available (with the OPTIONAL keyword the query does not fail), if not, ?text will be empty.
You may look at "Matching Alternatives"[1], but I don't think there is a way to encode "... the next available language ..." into a query. But: You may use UNION to define an order of preferred languages within the WHERE part. I would probably ask OPTIONAL for both, "de" and "en" & would solve the problem at application level. Best wishes, Martin [1] <http://www.w3.org/TR/rdf-sparql-query/#alternatives> Am 29.12.2009 um 21:21 schrieb Stephen Hatton: > Hi! > > I'm trying to build localization into a DBpedia application, but > I've got a problem. I'm trying to use multilingual results from > DBpedia in the follow way: > • If available, show results in (for example) German. > • If not available, show results in the next available language > (which usually is English). > SPARQL example: > > SELECT ?text WHERE { > <http://dbpedia.org/resource/Berlin> dbpprop:abstract ?text. > OPTIONAL { FILTER langMatches( lang(?text), "de" ) } > } > > The problem is that the query never chooses an available language > when the preferred language is not available. > For example, no results are returned if the following code is used: > FILTER langMatches( lang(?text), "he" ) > The same happens for other languages as well. > > Does anyone know of a solution to this? > > 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 > _______________________________________________ > Dbpedia-discussion mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion ------------------------------------------------------------------------------ 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
