Hi all,
Maybe this question has been already answered or is in the documentation,
but I can't find an answer.
I have a code to perform a set of SPARQL queries against a concrete
dataset. My problem is that, the SPARQL query is making use of datatype()
function, and it seems that Jena is not recognizing this function (and
therefore return me an error).
The query that I want to perform is the following:
*SELECT distinct datatype(?o) as ?datatype*
*FROM <@NAMED_GRAPH>*
*WHERE {*
* ?s a <@SUBJECT_TYPE> .*
*?s <@PREDICATE_TYPE> ?o . *
* FILTER isLiteral(?o)*
*}*
*group by ?o*
Originally it was "SELECT distinct(datatype(?o)) as ?datatype" but I saw
that distinct should be used without parenthesis. (I also try with "SELECT
distinct datatype ?o as..." with no positive result).
An example of the query:
SELECT distinct datatype(?o) as ?datatype
FROM <http://bio2rdf.org/bio2rdf.dataset:bio2rdf-affymetrix-20131220>
WHERE {
?s a <http://bio2rdf.org/affymetrix_vocabulary:Genechip-Array> .
?s <http://bio2rdf.org/affymetrix_vocabulary:x-unigene> ?o .
FILTER isLiteral(?o)
}
group by ?o
If I perform the query against the endpoint (
http://s4.semanticscience.org:14001/sparql), it runs fine (in this case is
not returning any result, but no errors are thrown):
http://s4.semanticscience.org:14001/sparql?default-graph-uri=&query=SELECT+distinct+datatype%28%3Fo%29+as+%3Fdatatype%0D%0AFROM+%3Chttp%3A%2F%2Fbio2rdf.org%2Fbio2rdf.dataset%3Abio2rdf-affymetrix-20131220%3E%0D%0AWHERE+%7B%0D%0A+%3Fs+a+%3Chttp%3A%2F%2Fbio2rdf.org%2Faffymetrix_vocabulary%3AGenechip-Array%3E+.%0D%0A%3Fs+%3Chttp%3A%2F%2Fbio2rdf.org%2Faffymetrix_vocabulary%3Ax-unigene%3E+%3Fo+.+++%0D%0A+FILTER+isLiteral%28%3Fo%29%0D%0A%7D%0D%0Agroup+by+%3Fo&format=text%2Fhtml&timeout=0&debug=on
However, when I use my code (which generates the query ok, I check it
printing the query), it returns the following exception:
http://pastebin.com/qhzyxJKn
The code which performs the query is here (the method which throws the
exception is the QueryFactory.create(..): http://pastebin.com/2VVgKyZT
I guess that it is a problem "calling" datatype function, but not sure how
to solve it.
Thanks!
--
Dr. Alejandro Rodríguez González - PhD
Bioinformatics at Centre for Plant Biotechnology and Genomics UPM-INIA
Polytechnic University of Madrid
http://www.alejandrorg.com
Phone: +34 914524900 . Ext: 25550
*Once the game is over, the king and the pawn go back in the same box. -
Italian proverb*