Use the "i" option to make the regex case insensitive

On Tue, 7 Dec 2021, 19:55 Matt Whitby, <[email protected]> wrote:

> I have a Sparql question if that's okay.
>
> There are only around 8m triples in our test data, so pretty small.
>
> The query takes a good couple of minutes to run (and sometimes just times
> out).
>
> I dare say running an lcase against each field doesn't help matters, but
> with no other way of doing a case-insensitive search (well, Regex - but who
> likes Regex?) I'm not sure.
>
> Any obvious ways to make it less bad?
>
> 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),"lewes") || CONTAINS(
> lcase(?district),"lewes") || CONTAINS( lcase(?parish),"lewes"))
>
> }
> limit 10
>

Reply via email to