Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-28-2020 10:35 AM
I have created a match query that extracts a set of subnodes from a graph.
match (n:ProgNode {compileunit:'Cwe1057.java', inode:'265'})-[*]->(BIGSET:ProgNode) return BIGSET
Thats working fine. But now I need to find a smaller subgraph WITHIN the BIGSET.
match (j:ProgNode {compileunit:'Cwe1057.java', KDM:Transform)-[*]->(LITTLSET:ProgNode {compileunit:'Cwe1057.java', KDM:Primitive) ) return j, LITTLESET
I don't care how many nodes are between them, but if its found, I need the node ID for the first (Transform) and the last (Primitive)
I have tried the simple (<>) as well as :has and its not coming back with anything but nulls
10-28-2020 04:35 PM
Hey @bill.dickenson
Not sure that I understand everything from your description, but in order to query nodes within a subset of nodes you should use WITH
clause.
match (n:ProgNode {compileunit:'Cwe1057.java', inode:'265'})-[*]->(BIGSET:ProgNode)
WITH BIGSET as j
match
(j:ProgNode {compileunit:'Cwe1057.java', KDM:Transform})-[*]->(LITTLSET:ProgNode
{compileunit:'Cwe1057.java', KDM:Primitive})
return j, LITTLESET
10-29-2020 06:54 AM
match (n:ProgNode {compileunit:'Cwe1057.java', inode:'265'})-[]->(j:ProgNode)
WITH j as BIGSET
match
(BIGSET:ProgNode {compileunit:'Cwe1057.java', KDM:'Transform'})-[]->(LITTLESET:ProgNode
{compileunit:'Cwe1057.java', KDM:'Primitive'})
return BIGSET, LITTLESET
Worked perfectly. Thank you. Found another set within that BIGSET so somewhat embarrased but that was simple and easily done. Thank you again
All the sessions of the conference are now available online