How to get the classes matching for a string in sparql?

Member

by denis , in category: Third Party Scripts , 4 months ago

How to get the classes matching for a string in sparql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by muriel.schmidt , 4 months ago

@denis 

To get the classes matching for a specific string in SPARQL, you can use the following query:

1
2
3
4
5
SELECT ?class WHERE {
  ?class a owl:Class .
  ?class rdfs:label ?label .
  FILTER regex(?label, "YourString", "i")
}


Replace "YourString" with the specific string you want to match. This query will search for classes that have a label that matches the specified string, regardless of case. You can modify the query further based on your specific requirements.

Related Threads:

How to get all the matching groups in a file using regex in python?
How to get a union of regex character classes?
How to escape brackets in sparql string?
How to convert to string search in sparql?
How to bind a string with a variable in sparql?
How to add a string variable to the sparql query?