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

Support @optional directive use on macro edges #586

Open
obi1kenobi opened this issue Oct 1, 2019 · 1 comment
Open

Support @optional directive use on macro edges #586

obi1kenobi opened this issue Oct 1, 2019 · 1 comment

Comments

@obi1kenobi
Copy link
Contributor

Currently, the @optional directive may not be applied on macro edges. This is because definitions of macro edges are allowed to rely on the composition of multiple edges, and there is no general way to know which of these multiple edges the @optional semantics should apply to.

For macro edges whose definitions only rely on a single edge, this is simple -- when the macro edge is marked @optional, the only edge becomes @optional.

When the definition contains multiple edges, we need a way to allow the creator of the definition to specify which edges become @optional and which remain required when the macro edge is marked @optional. This is perhaps best accomplished by adding another directive that can only be used at macro definition time, and relying on it to mark edges in the definition that should become optional.

@bojanserafimov
Copy link
Collaborator

Problem: The result of an optional traversal is the same as the union of the result with mandatory traversal, and the result with no traversal. If you mark some edges inside the macro as mandatory-under-optional, this property no longer holds.

Proposal: I think defining the semantics such that all edges in the macro are optional by default will buy us a couple of years until someone requests mandatory-under-optional edges. It's also easy to implement and avoids the problem above. The only downside I see is that nested optionals are bad practice in OrientDB. But I think it's time to move on from prioritizing OrientDB.

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