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

A way to perform substring matching #917

Open
trivigy opened this issue Feb 4, 2020 · 1 comment
Open

A way to perform substring matching #917

trivigy opened this issue Feb 4, 2020 · 1 comment
Labels

Comments

@trivigy
Copy link

trivigy commented Feb 4, 2020

This is more of a question. Is there a way to perform a query matching a substring of a subject or an object using the golang API? I cannot figure out how to do this and was wondering if it is even possible.

example
Say I have a quad like this: <folder:abc> <path> "/some/path/to/nowhere" and I want to find all the nodes that have an object matching /some/path/*

@iddan iddan added the question label Feb 6, 2020
@trivigy
Copy link
Author

trivigy commented May 2, 2020

One solution I encountered is using a regex matching. But I am guessing this is highly inefficient. Any other recommendations are very welcome.

predPath, err := cayley.StartPath(r.DB).OutPredicates().
	RegexWithRefs(regexp.MustCompile("rdf:_\\d+")).
	Iterate(ctx).AllValues(r.DB)

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

No branches or pull requests

2 participants