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

OPTIONAL support #139

Open
maelle opened this issue Jul 13, 2023 · 7 comments
Open

OPTIONAL support #139

maelle opened this issue Jul 13, 2023 · 7 comments

Comments

@maelle
Copy link
Collaborator

maelle commented Jul 13, 2023

  • FILTER in OPTIONAL is something we'll need for spq_label().
  • should there be a way to say a triple is optional when creating it via spq_mutate()/spq_filter().
  • should there be a way to add a filter for an optional pattern in spq_add() but also spq_mutate()/spq_filter() and if so with what syntax? a call to spq_filter() as argument?!
@maelle
Copy link
Collaborator Author

maelle commented Jul 20, 2023

in #142 we add filters for optional patterns.

@maelle
Copy link
Collaborator Author

maelle commented Oct 12, 2023

related to #202

@maelle
Copy link
Collaborator Author

maelle commented Oct 12, 2023

  • for spq_label() we could try and guess where to place it based on where the variable appears but that seems brittle.
  • what if the user were the ones giving the filters, labels etc for an optional pattern. How should the interface best look like.

In dm there's something called zooming https://dm.cynkra.com/reference/dm_zoom_to.html#ref-examples

@maelle
Copy link
Collaborator Author

maelle commented Oct 12, 2023

spq_init() %>%
  spq_add(blabla) %>%
  spq_filter(blabla) %>%
  spq_optional({
    spq_add(blop) %>%
    spq_label(blop) %>%
    spq_filter(blop)
})

is maybe too close to the SPARQL syntax.

@lvaudor
Copy link
Owner

lvaudor commented Oct 12, 2023

I think we could consider that for spq_label, spq_filter, spq_mutate the result is optional if the "ancestor variable" is optional.

So

  1. we'd complete query$vars with a new column stating whether the variable is optional or not: the variable would be considered optional if involved only in optional triple patterns.
  2. all spq_label, spq_filter, spq_mutate calls with an optional variable as the ancestor variable would be optional.

@maelle
Copy link
Collaborator Author

maelle commented Oct 12, 2023

ok, I'll try that (maybe next week if not this week), let's see how far we can go with this.

do you have more examples?

@maelle maelle pinned this issue Oct 12, 2023
@maelle
Copy link
Collaborator Author

maelle commented Oct 19, 2023

I think we could consider that for spq_label, spq_filter, spq_mutate the result is optional if the "ancestor variable" is optional.

@lvaudor do you have examples for when this would happen for the filtering and mutating?

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

No branches or pull requests

2 participants