How to find the similarity between common nodes of multiple type nodes?

Hello, I have a strange use case but probably is related to this topic. If not, let me know if a new topic is needed.
I've some object Item (orange), String (blue) and Condition (grey) that defines my items.


The grey dots are the logical representation of the orange dots and are generated separately for each node because some nodes are very generic (or, and) and their position in the tree (that could be nested as required) is important.
The requirements is to find correlation between orange dots considering blue and the tree structure (and value) of grey ones. In this case blue are shared, so ok, while grey ones have different id but same value.
Using Jaccard the similarity between them is 0.875 (I image because only the root of the tree is considered) while should be 1.0.
Example code I'm actually using:

## DEMO OBJ
MERGE(it1:Item {name: "AAA"})
MERGE(it2:Item {name: "BBB"})

MERGE(st1:String {value: "stringAAA"})
MERGE(st2:String {value: "stringBBB"})
MERGE(it1)-[:uses]->(st1)
MERGE(it2)-[:uses]->(st1)
MERGE(it1)-[:uses]->(st2)
MERGE(it2)-[:uses]->(st2)

MERGE(p1:Part {id: 1, type: "And", value: "-"})
MERGE(sp11:Part {id: 2, type: "All", value: "-"})
MERGE(sp12:Part {id: 3, type: "Set", value: "-"})

MERGE(p1)-[:then]->(sp11)
MERGE(p1)-[:then]->(sp12)

MERGE(p2:Part {id: 4, type: "And", value: "-"})
MERGE(sp21:Part {id: 5, type: "All", value: "-"})
MERGE(sp22:Part {id: 6, type: "Set", value: "-"})

MERGE(p2)-[:then]->(sp21)
MERGE(p2)-[:then]->(sp22)

MERGE(it1)-[:from]->(p1)
MERGE(it2)-[:from]->(p2)


## CREATE GRAPH
CALL gds.graph.create(
    'myGraph',
    ['Item', 'String', 'Part'],
    {
        uses: {
            type: 'uses'
        },
        from: {
            type: 'from'
        },
        then: {
            type: 'then'
        }
    }
);

## SHOW SIMILARITY
CALL gds.nodeSimilarity.stream('myGraph')
YIELD node1, node2, similarity
RETURN gds.util.asNode(node1).name AS Item1, gds.util.asNode(node2).name AS Item2, similarity
ORDER BY similarity DESCENDING, Item1, Item2

## WRITE SIMILARITY BACK
CALL gds.nodeSimilarity.write('myGraph', {
    writeRelationshipType: 'SIMILAR',
    writeProperty: 'score'
})
YIELD nodesCompared, relationshipsWritten

How do you suggest to approach this use case?

Thanks