How to filter distinct regex matches with sparql?

by arnoldo.moen , in category: MySQL , 5 months ago

How to filter distinct regex matches with sparql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by raven_corwin , 5 months ago

@arnoldo.moen 

You can filter distinct regex matches in SPARQL by using the DISTINCT keyword in combination with the regex function. Here is an example query that demonstrates how to filter distinct regex matches in a SPARQL query:


PREFIX foaf: http://xmlns.com/foaf/0.1/SELECT DISTINCT ?name WHERE { ?person foaf:name ?name . FILTER regex(?name, "John", "i") }


In this query, we are querying for the distinct values of the ?name variable where the value matches the regex pattern "John" case-insensitively. The DISTINCT keyword ensures that only distinct values are returned in the result set.

Related Threads:

How to get multiple first matches from regex?
How to use ansible regex to display nth matches?
How to find specific matches in a string using regex?
How to select distinct on multiple columns in sparql?
How to filter dbpedia results in sparql?
How to build case-insensitive sparql filter?