# Fuzzy String Match in Sparql

**URL:** <https://community.stardog.com/t/fuzzy-string-match-in-sparql/4885>\
**Category:** Support\
**Created:** [March 22, 2024, 3:12am UTC](https://community.stardog.com/t/fuzzy-string-match-in-sparql/4885 "2024-03-22T03:12:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesar](https://avatars.discourse-cdn.com/v4/letter/c/e47774/32.png) [@Cesar](https://community.stardog.com/u/Cesar)\
**Post date:** [March 22, 2024, 3:12am UTC](https://community.stardog.com/t/fuzzy-string-match-in-sparql/4885/1 "2024-03-22T03:12:28Z")

</div>

Hi,

My question is whether we can use kind of partially match function within our sparql queries. I know it's not particularly related to Stardog and lots of functions are now available here [SPARQL 1.1 Query Language](https://www.w3.org/TR/sparql11-query/#func-strings), and an effective use of regex does the job. I was still wondering whether any predefined functions etc are already available for string fuzzy match. For instance,  
"I'm a student" matches with "I'm a Student" or "I am aa Student" or "I am a Students"  
"That's great!" matches with "This is great." or "That's great." or "Great!"  
These are just a few examples in which typos, grammatical mistakes or wordings are ignored

Any thoughts or suggestions are appreciated. Thank you

---

<div class="post-metadata">

**Author:** ![Lars\_Heling](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/lars_heling/32/1657_2.png) [@Lars\_Heling](https://community.stardog.com/u/Lars_Heling)\
**Post date:** [March 22, 2024, 6:29am UTC](https://community.stardog.com/t/fuzzy-string-match-in-sparql/4885/2 "2024-03-22T06:29:15Z")

</div>

Hi Cesar,

you can try the semantic mode of the [Full-text search](https://docs.stardog.com/query-stardog/full-text-search) feature in Stardog which determines the similarity of strings based on their embeddings instead of lexical similarity. However, be aware of the potential impact on [indexing performance and memory usage](https://docs.stardog.com/query-stardog/full-text-search#performance-concerns-for-semantic-search). Depending on your requirements, lexical full-text search might even be sufficient.  
Alternatively, there is the [stardog-extensions repo](https://github.com/semantalytics/stardog-extensions) with a variety of string similarity functions that you can [extend Stardog with](https://docs.stardog.com/developing/extending-stardog/). Note that this repo is not an official Stardog repo and it is not maintained by Stardog. If you have more specific requirements, you can also write your own [query functions](https://docs.stardog.com/developing/extending-stardog/query-functions).

Best regards,  
Lars
