spd
spd

Reputation: 354

Neo4J Subgraph Labelling and accessing it back

I am considering a pattern matching activity using Neo4J Graph DB. There are n number of patterns I want to match in a database, but each node will be matched only to one pattern. The nodes that are returned by the cypher match query will be assigned patternName property. But to avoid duplication of patternName property for each node in a subgraph (pattern), I am exploring options to group that subgraph and label it as a whole, such that using that label I would be able to access that whole pattern again.

Tried

  1. Vnodes by APOC- But these don't persists, hence I won't be able to get the for a particular patternName using virtual Nodes
  2. Grouping by APOC- but this grouping is based on a particular property, I want to add a new property for a whole group.

What are the options I can go with? Is this possible.

I am avoiding to create a new node for every pattern, also not trying to duplicate the properties for all the nodes in one pattern.

Upvotes: 0

Views: 40

Answers (1)

cybersam
cybersam

Reputation: 66967

Since a node can have any number of labels, you can add an appropriate pattern label to each node. Such labels persist in the DB and do not require new nodes, relationships, or properties.

Upvotes: 0

Related Questions