neo4j / sdn-rx

Nextgen Spring Data module for Neo4j supporting (not only) reactive data access and immutable support
https://neo4j.github.io/sdn-rx
Apache License 2.0
65 stars 23 forks source link

runtime managed labels #214

Closed sergeily closed 4 years ago

sergeily commented 4 years ago

it would be great to have runtime-managed-labels option such as OGM annotation @Labels

ogm-manual

meistermeier commented 4 years ago

Could you give an example for an use-case? We did not bring this feature into the 1.0 because we consider labels as type descriptions/definitions. So it would make more sense for example to create new (derived/extending) classes/types in your domain to use if an entity change.

sergeily commented 4 years ago

Hi,

For example: On our physical graph we have several logical subgraphs and part of nodes belongs to different subgraphs Each subgraph (and accordingly each node) has own label.

Something like:

create (n:Column:GraphA:GraphB {name:'NodeA'})
create (n:Column:GraphA {name:'NodeB'})
create (n:Column:GraphA:GraphC {name:'NodeC'})

if we need to find path from NodeX to NodeY we use subgraph label (relevant path for specific subgraph) also When we need to find relationships of NodeX we use subgraph label for connected nodes

Node's subgraph label is not permanent and changed according to runtime conditions. We can add node to subgraph (create if node not exists and add subgraph label) and connect to other nodes and also we can remove node from specific subgraph. Add/Remove node to/from subgraph means add/remove subgraph label.

When we use SDN+OGM it's possible to configure entity like:

@NodeEntity(label="Column")
public class DaeColumnNode extends DaeNode {
    ......
    private String name;
    ......
    @Labels
    private Set<String> labels;
    ......
}

and operate (manage) labels at runtime. Permanent labels are defined as class description, dynamic (addition) labels will be collected at runtime