Skip to content

Position of OPTIONAL influences result #4989

Answered by hmottestad
fkleedorfer asked this question in Q&A
Discussion options

You must be logged in to vote

From the spec:

"In an optional match, either the optional graph pattern matches a graph, thereby defining and adding bindings to one or more solutions, or it leaves a solution unchanged without adding any additional bindings."

In your case the query with the optional clause first will define new solutions, but since it's before the type pattern it won't see the results from that pattern.

The reason it works when the optional is after the type pattern is because of: "or it leaves a solution unchanged without adding any additional bindings." With the optional clause first though, there won't be any solutions to leave unchanged since there are no previous solutions.

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hmottestad
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
wontfix issue won't be fixed (close reason) specification issues related to compliance to standards and external specs
4 participants
Converted from issue

This discussion was converted from issue #4987 on May 27, 2024 08:18.