How to build case-insensitive sparql filter?

by cali_green , in category: MySQL , 5 months ago

How to build case-insensitive sparql filter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by rollin , 5 months ago

@cali_green 

To build a case-insensitive SPARQL filter, you can use the FILTER keyword along with the UCASE or LCASE functions to convert the data to uppercase or lowercase before doing the comparison. Here is an example query:

1
2
3
4
5
6
7
8
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?person ?name
WHERE {
  ?person a foaf:Person;
          foaf:name ?name.
  FILTER(UCASE(?name) = "JOHN DOE")
}


In this query, the UCASE function is used to convert the values of the ?name variable to uppercase before comparing it with the string "JOHN DOE". This will make the comparison case-insensitive. You can also use LCASE function in a similar way to convert the values to lowercase.

Related Threads:

How to make codeigniter uri case insensitive?
How to make username email case insensitive in symfony?
How to filter dbpedia results in sparql?
How to filter distinct regex matches with sparql?
How to apply global language filter across several fields in sparql?
How to make webpack case sensitive?