Open maelle opened 1 year ago
in #142 we add filters for optional patterns.
related to #202
spq_label()
we could try and guess where to place it based on where the variable appears but that seems brittle.In dm there's something called zooming https://dm.cynkra.com/reference/dm_zoom_to.html#ref-examples
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.
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.
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?
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?
spq_label()
.spq_mutate()
/spq_filter()
.spq_add()
but alsospq_mutate()
/spq_filter()
and if so with what syntax? a call tospq_filter()
as argument?!