 <p>The following seems to work:</p> <pre><code>match (aType:Type:Class)-[:ANNOTATED_BY]-&gt;()-[:OF_TYPE]-&gt;(anAnnotationType:Type), (aType:Type)-[:DECLARES]-&gt;(aMethod:Method) optional match (aMethod)-[:ANNOTATED_BY]-&gt;()-[:OF_TYPE]-&gt;(tType:Type) with anAnnotationType, aMethod, tType where anAnnotationType.fqn = "com.mycompany.services.Service" and aMethod.name =~ "update.*" and ((tType is null) or not (tType.fqn = "com.mycompany.services.Transact")) return aMethod.name, tType </code></pre>