Include optional match in query graph

o Adds requiredIds to query graph to track what is expected to be in scope