How do I find a subset within a subset?

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

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

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