Hi all, Yesterday I was lurking in #jena's channel as I often do, when a user posted that his query PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX res: <http://www.w3.org/2005/sparql-results#>describe * where {?movie rdf:type dbpedia-owl:Film.?movie rdfs:label ?label.?movie rdfs:label ?movie_title.FILTER langMatches(lang(?movie_title), "EN") .filter regex( ?label, "Inglourious Basterds", "i").} against DBpedia SPARQL endpoint was failing with Exception in thread "main" com.hp.hpl.jena.sparql.resultset.ResultSetException: Expected only object keys [type, value, xml:lang, datatype] but encountered 'lang'
I got the same Exception in my Eclipse workspace. While debugging with jena-2.12.0, I found that the Exception occurred in this code in jena-arq JSONInput [1] Now, what intrigued me, was that in JSONResultsKW [2], there are constants that are used to filter the keys returned in JSON, IIUC. When the error is raised, these possible values include "xml:lang", as in the W3C documentation. However, DBpedia Virtuoso seems to be using "lang" as the key, without the xml prefix [3]. Is it a bug in arq, is DBpedia endpoint not following the specification, or is the error somewhere else? Reading the W3C page it doesn't mention describe queries, so not sure if it doesn't apply for this kind o query. Replacing describe by select the query seems to works (didn't look what's happening with his filter). Here's the code he used [4] Thanks! ps: sent it hours ago, but I couldn't find it in the archives so re-sending it now. [1] https://github.com/apache/jena/blob/6ed1c766e74861db3a2219f9e7eb84ecc1ea8ef0/jena-arq/src/main/java/com/hp/hpl/jena/sparql/resultset/JSONInput.java#L266 [2] https://github.com/apache/jena/blob/6ed1c766e74861db3a2219f9e7eb84ecc1ea8ef0/jena-arq/src/main/java/com/hp/hpl/jena/sparql/resultset/JSONResultsKW.java#L23 [3] http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=PREFIX+dbpedia-owl%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2F%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+res%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2005%2Fsparql-results%23%3E%0D%0Adescribe+*+where++%7B%0D%0A%3Fmovie+rdf%3Atype+dbpedia-owl%3AFilm.%0D%0A%3Fmovie+rdfs%3Alabel+%3Flabel.%0D%0A%3Fmovie+rdfs%3Alabel+%3Fmovie_title.%0D%0AFILTER+langMatches%28lang%28%3Fmovie_title%29%2C+%22EN%22%29+.%0D%0Afilter+regex%28+%3Flabel%2C+%22Inglourious+Basterds%22%2C+%22i%22%29.%0D%0A%7D&format=application%2Fsparql-results%2Bjson&timeout=30000&debug=on [4] http://rdf.pastebay.net/1531054
