I recently started using neo4j and its query language "cypher" for working with building/metering data.
My current graph database consists of different nodes (with different labels such as: point,meter,elec,equip ..etc. just to name a few), and each having different properties (not relevant in this context).
What I would like to do, is to get a sub-graph of different nodes which have different labels. For instance I would like to get all the nodes labeled as "point" as well as the ones labeled "equip" and the ones labeled as "meter". To do so I tried the following query:
MATCH (p:point) MATCH (e:equip) MATCH (m:meter) RETURN p, e, m
However that does not work since: This query builds a cartesian product between disconnected patterns.
I am trying to get these so that, if a node labeled "point" is connected to either an "equip" or "meter" node, I would get the relationship. If nothing is connected to the "point" node, it would just be stand alone. Therefore I could have one subgraph with the "point" to "meter"/"equip" connections and visually identify the isolated "point".
I also tried something like:
MATCH (p:point)--(e:equip) RETURN p,e
But that only return the "point" nodes which are somewhat connected to an "equip" node. Not giving me the isolated nodes labeled "point" as well.
Looking forward to your input on this (simple case I guess).
Solved! Go to Solution.