On Thu, Aug 21, 2008 at 3:40 PM, Lou Sakey <[EMAIL PROTECTED]> wrote: > Here is a copy of the query. > > PREFIX lou: <http://ns.lou.com/2007/lou-ns#> > PREFIX dc: <http://purl.org/dc/elements/1.1/> > PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> > SELECT * WHERE { > ?subject lou:Sex ?p0. > ?subject lou:BirthDate ?p1. > <http://ns.lou.com/2007/Friends> fam:Person ?subject. > FILTER ( > ( (?p0 = 'Male') && (xsd:dateTime(?p1) <= > xsd:dateTime('2008-01-31T00:00:00')) && (xsd:dateTime(?p1) >= > xsd:dateTime('2008-01-01T00:00:00')) ) > ) } > > > It is expected to find all males born in January of 2008.
This query essentially pulls all triples with lou:Sex and lou:BirthDate properties and only then can apply the filter expression (actually it will do it even later after checking the third graph pattern). Write the first graph pattern as ?subject lou:Sex "Male" and drop the (?p0 = 'Male') filter conjunction to make it restrict the triple set earlier. Generally, filter with graph patterns and not FILTER expression whenever you can. Additionally, the hashes storage does not create p2so (predicate to subject,object) index by default. Add "index-predicates=1" storage option to enable it. Without it, you can expect horrible performance for queries that pull out triples by predicate. Lauri _______________________________________________ redland-dev mailing list [email protected] http://lists.librdf.org/mailman/listinfo/redland-dev
