James was kind enough to spend some time talking me through the query. My original query (which timed out) was:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> select ?s ?name where { ?s <http://www.historicengland.org.uk/data/schema/simplename/name> ?name . OPTIONAL {?s <http://www.historicengland.org.uk/data/schema/county> ?county}. OPTIONAL {?s <http://www.historicengland.org.uk/data/schema/district/> ?district}. OPTIONAL {?s <http://www.historicengland.org.uk/data/schema/parish> ?parish}. FILTER (CONTAINS(lcase(?county),"east sussex") || CONTAINS( lcase(?district),"lewes") || CONTAINS( lcase(?parish),"lewes")) } limit 10 Putting the FILTER under each statement helped it immensely. select ?s where { ?s <http://www.historicengland.org.uk/data/schema/simplename/name>?name. ?s <http://www.historicengland.org.uk/data/schema/parish/> ?parish . FILTER (CONTAINS(lcase(?parish),"lewes")) ?s <http://www.historicengland.org.uk/data/schema/district/> ?district . FILTER (CONTAINS(lcase(?district),"lewes")) ?s <http://www.historicengland.org.uk/data/schema/county/> ?county . FILTER (CONTAINS(lcase(?county),"east sussex")) } Putting back the OPTIONAL and running it a third time, slowed it down (though not as badly as the first iteration). M
