robstewart57/hsparql

problem with filterExpr

fedeinthemix opened this issue · 2 comments

Hi, I'm experimenting with the examples in the tests and have some difficulties using filterExpr. Specifically, with the following example I get an empty result, while if I comment out the filterExpr line, I get a long list of results, some of which should satisfy the condition of the filter:

berlinersSelect :: Query SelectQuery
berlinersSelect = do
    xsd  <- prefix "xsd" (iriRef "http://www.w3.org/2001/XMLSchema#")
    prop <- prefix "prop" (iriRef "http://dbpedia.org/property/")
    dbo  <- prefix "dbo" (iriRef "http://dbpedia.org/ontology/")
    foaf <- prefix "foaf" (iriRef "http://xmlns.com/foaf/0.1/")
    resc <- prefix "resc" (iriRef "http://dbpedia.org/resource/")

    name     <- var
    birth    <- var
    death    <- var
    person   <- var
    knownfor <- var

    triple person (prop .:. "birthPlace") (resc .:. "Berlin")
    triple person (dbo  .:. "birthDate")  birth
    triple person (foaf .:. "name")       name
    triple person (dbo  .:. "deathDate")  death

    filterExpr $ birth .<. ("1900-01-01" :: T.Text, xsd .:. "date")

    optional $ triple person (prop .:. "KnownFor") knownfor

    return SelectQuery { queryVars = [name, birth, death, person, knownfor] }

I'm not sure if I'm doing something wrong, or if there is a problem with the code.

Hi @fedeinthemix this was actually a bug, which I've fixed in 7ff050c .

Your example should now return bound results. Thanks for reporting!