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

Question: Is it possible to merge two pointers? #3

Open
danielbeeke opened this issue Apr 5, 2023 · 2 comments
Open

Question: Is it possible to merge two pointers? #3

danielbeeke opened this issue Apr 5, 2023 · 2 comments

Comments

@danielbeeke
Copy link

Use case:

Imagine a SHACL property and then one pointer on the property itself so that you could get for example sh:path etc. And the other pointer inside the list of the sh:or so that you could get for example sh:path or any other nested triple. (if it was given in the or statement.)

@danielbeeke
Copy link
Author

danielbeeke commented Apr 5, 2023

I tried something like:

pointers[0].clone({
    ptrs: pointers.flatMap(pointer => pointer.ptrs)
  }).trim()

Not totally sure if this is correct, but it seems to do the trick.

@bergos
Copy link
Member

bergos commented Apr 7, 2023

There should be a more convenient method to do that.

If you call .trim() at the end, you can also use the .terms property and the .node() method, but that requires that all ptrs are in the same dataset!

pointers[0].node(pointers.flatMap(p => p.terms))

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

No branches or pull requests

2 participants