Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARQL Filter #30

Open
nvbach91 opened this issue Jun 17, 2019 · 1 comment
Open

SPARQL Filter #30

nvbach91 opened this issue Jun 17, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@nvbach91
Copy link

Hi, is it possible to use SPARQL Filter to match strings with Regex?

Something like

const context = {
    'Company': `http://ontology.com/Company`,
    'name': `http://ontology.com/hasName`,
    'Name': `http://ontology.com/Name`,
    'a': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type',
    'value': `http://ontology.com/hasStringValue`
};
const query = `
{
    id ... on Company {
        name(a:Name) {
            value(first:20 regex:"/corp/i")
        }
    }
}
`;
PREFIX o: <http://ontology.com/>

SELECT ?id ?name_value WHERE {
  OPTIONAL {
    ?id a o:Company .
    {
      SELECT * WHERE {
        ?id o:hasName ?name .
        ?name a o:Name .
        ?name o:hasStringValue ?name_value .
        FILTER REGEX(?name_value, "corp", "i") .
      }
      LIMIT 20
    }
  }
}

Thanks in advance. Btw, I'm your fan!

@rubensworks rubensworks added the enhancement New feature or request label Jun 17, 2019
@rubensworks
Copy link
Owner

Not possible at the moment, but this has been on my todo-list for a while, so this is definitely coming in the future! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants