Unexpected behaviour in Filter Query · Issue #532 · RDFLib/rdflib (original) (raw)
Hi,
rdflib 4.2.1 on Ubuntu 14.04 LTS, python 2.7.10
I'm running the following query on this data in MEPs.n3
:
@base <http://purl.org/linkedpolitics/MembersOfParliament_background> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix lpv: <vocabulary/> .
@prefix NationalParty: <NationalParty/> .
<EUmember_1026>
a lpv:MemberOfParliament ;
lpv:MEP_ID "1026" ;
lpv:countryOfRepresentation <EUCountry_FR> ;
lpv:dateOfBirth "1946-07-13"^^xsd:date ;
lpv:politicalFunction [
a lpv:PoliticalFunction ;
lpv:beginning "1989-10-13"^^xsd:date ;
lpv:end "1992-01-14"^^xsd:date ;
lpv:institution NationalParty:sans_etiquette
] , [
a lpv:PoliticalFunction ;
lpv:beginning "2005-02-24"^^xsd:date ;
lpv:end "2007-01-30"^^xsd:date ;
lpv:institution NationalParty:Union_pour_la_democratie_francaise
] ;
foaf:familyName "Bourlanges" ;
foaf:givenName "Jean-Louis" .
query:
from rdflib import Graph g = Graph() g.load("MEPs.n3", format='n3')
getnewMeps =""" PREFIX lpv: http://purl.org/linkedpolitics/vocabulary/ prefix foaf: http://xmlns.com/foaf/0.1/ prefix xsd: http://www.w3.org/2001/XMLSchema#
SELECT DISTINCT ?name ?lastname WHERE { ?member a lpv:MemberOfParliament . ?member foaf:givenName ?name . ?member foaf:familyName ?lastname . ?member lpv:politicalFunction ?function . ?function lpv:beginning ?date .
FILTER (?date >= "2004-06-20"^^xsd:date) } """
result = g.query(getnewMeps) for bind in result: # is empty!! print bind
The dataset contains only one entity, and I expect it to be returned in the result, but that is not the case. If I remove the FILTER clause, the result is not empty, as expected.
The query works in other libraries (Corese, Jena, a virtuoso endpoint)