Hello.
I ran the following cypher.
(:Account)-[:Date]->(:Date)-[:ACTED]->(:Log)-[:ACTED*]-(:Log)-[:DETECTED]->(:Rule)
To explain the cypher above,
- (Account) Only one node exists.
- There are several (Date) nodes that connect to the (Account) node (approximately 10).
- There are several (approximately 50 or more) (Log) nodes leading from the (Date) node to the first [ACTED] relationship.
- The above [3] (Log) nodes are again [:ACTED] for each (Log) node, so from now on, they are connected in a single line to the (:Log) node.
In this case, the number of (Log) nodes connected by the [ACTED] relationship is 10 to 1000 or more per (Log). - Many (:Log) nodes connected in a single line will one day be connected to the (:Rule) node connected in a [:DETECTED] relationship.
Assuming that you find a large number of (:Log) nodes in the [5] and graph the flow, it can be massive in shape or overload the server.
And here's the question.
Q-1.
How do I output only some of the many (:Logs) and keep the relationship with the rest of the nodes intact?
Q-2.
Many (:Log) nodes that are connected in [5] single lines have a property value called eventName.
The format is:
eventName: 'A'
Which cypher outputs only some of the many (:Log) logs, gets the corresponding number of (
:Log) nodes, gets the number of each eventName, and creates a new node with each information?
Examples include.
Total_Nodes: 1024
A: 5
B: 38
C: 124
...
The picture below is the result of me running the following cypher.
MATCH (account:Account:Iam)-[:DATE]->(date:Date)-[:ACTED]->(log:Log)
WHERE account.name = 'ar_hk'
OPTIONAL MATCH (log2:Log)-[:DETECTED]->(rule:Rule)
WHERE log2.userIdentity_userName = 'ar_hk'
WITH account, date, log, COLLECT(log2) AS logs, COLLECT(rule) AS rules
RETURN account, date, log, logs, rules
The yellow node is the Account node.
The blue node is the Date node.
The pink node is the Log node.
The red node is the Rule node.
In the graph in the picture, there are many connected Log nodes, which are pink nodes, each of which is the first and last of each flow.