>why do you want to cast boolean to integer in the first place?
Someone else pointed out to me that XPath lets you do it and asked why,
if SPARQL uses XPath casting functions, it wasn't consistent on this point.
Bob
On 5/10/2011 5:30 AM, Andy Seaborne wrote:
On 09/05/11 20:53, Bob DuCharme wrote:
http://www.w3.org/TR/2010/WD-sparql11-query-20101014/#FunctionMapping
gives me the impression that conversion of a boolean to an integer
should work, but this query
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?oInt WHERE {
?s ?p ?o .
BIND (xsd:integer(?o) as ?oInt )
}
just comes up blank with this data:
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://ex/> .
ex:thing1 ex:required "true"^^xsd:boolean .
I'm using ARQ 2.8.8. Shouldn't it turn true into a 1 and false into a 0?
(Then again, the part of the spec referenced above says that this is
"allowed," not "required"...)
Hmm. Didn't catch that one. The rules for casting from boolean to a
numeric type are ... bizarre.
I'll fix the code for this case -- (curious) but why do you want to
cast boolean to integer in the first place?
Andy
thanks,
Bob