Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matching of strings in SPARQL?

In ANSI SQL, you can write something like:

Select * From DBTable Where DBTable.Description LIKE "MEET"

or

Select * From DBTable Where DBTable.Description LIKE "%MEET%"

What I would like help with is writing the SPARQL equivalent of the above please.

like image 374
Kobojunkie Avatar asked Jun 17 '12 10:06

Kobojunkie


People also ask

Which clauses in SPARQL can be used to match partial information in an RDF graph?

The query consists of two parts: the SELECT clause identifies the variables to appear in the query results, and the WHERE clause provides the basic graph pattern to match against the data graph.

Is SPARQL case sensitive?

CAPS: Though SPARQL is case-insensitive, SPARQL keywords in this section are written in uppercase for readability. Italics: Terms in italics are placeholder values that you replace in the query.

What is SPARQL prefix?

"PREFIX", however (without the "@"), is the SPARQL instruction for a declaration of a namespace prefix. It allows you to write prefixed names in queries instead of having to use full URIs everywhere. So it's a syntax convenience mechanism for shorter, easier to read (and write) queries.

What is SPARQL used for?

SPARQL, short for “SPARQL Protocol and RDF Query Language”, enables users to query information from databases or any data source that can be mapped to RDF. The SPARQL standard is designed and endorsed by the W3C and helps users and developers focus on what they would like to know instead of how a database is organized.


1 Answers

Use a regex filter. You can find a short tutorial here

Here's what it looks like:

PREFIX ns: <http://example.com/namespace>

SELECT ?x
WHERE
{ ?x ns:SomePredicate ?y .
  FILTER regex(?y, "YOUR_REGEX", "i") }

YOUR_REGEX must be an expression of the XQuery regular expression language

i is an optional flag. It means that the match is case insensitive.

like image 187
toniedzwiedz Avatar answered Oct 22 '22 04:10

toniedzwiedz