openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
870 stars 210 forks source link

Zero-length literal as a boolean #308

Open schwarja opened 9 years ago

schwarja commented 9 years ago

Query:

SELECT ?X WHERE 
{ 
BIND ("" as ?X)
FILTER(?X)
}

Result is "", but according to SPARQL 1.1 documentation (http://www.w3.org/TR/sparql11-query/#ebv):

If the argument is a plain literal or a typed literal with a datatype of xsd:string, the EBV is false if the operand value has zero length; otherwise the EBV is true.

HughWilliams commented 9 years ago

@schwarja: what are you expecting this query to return as other triples stores like jena return no results also ?

SQL> SPARQL SELECT ?X WHERE { BIND ("" as ?X) FILTER(?X) }; X VARCHAR NOT NULL


1 Rows. -- 4 msec. SQL>

schwarja commented 9 years ago

Exactly, I would expect empty result because BIND("" AS ?X) has zero length, it should be evaluated as false, therefore the condition FILTER(?X) is not satisfied. But Virtuoso returns one row with "" literal.

HughWilliams commented 9 years ago

@schwarja: OK, this has been reported to development to look into ...