Open paralin opened 1 year ago
Hmm, this one is tricky, since we never defined what will happen with empty values.
Definitely, the returns don't make any sense from user's point of view. I think LabelContext
is trying to be nil-safe and ignores the empty argument in the last two cases.
I think we should enforce the following behavior:
LabelContext("")
- list none (it searches for a typed empty string)LabelContext(quad.IRI(""))
- list none (it searches for an empty IRI)LabelContext(quad.Raw(""))
- list node2
(same as nil
)LabelContext(nil)
- list node2
(what you would expect)The problem is that we need to check the code to make sure it doesn't expect something like this to work:
var label quad.Value
if something {
label = quad.IRI("x")
}
// expects that if label is nil, the filter will be skipped
p = p.LabelContext(label)
Example program:
None of these successfully limit to just the quad with the empty Label:
How can I do that?
Additionally, I don't understand why empty string "" and nil both return the values that have populated Label fields but not the one that has an empty Label field. Shouldn't it be the other way around?