neo4j - Map different relationship types to one collection -


i trying map ontology terms neo4j data-structure.
precise have term class , 2 types of relationships (is_a , part_of). have following classes:

term class:

@nodeentity public class term {     @graphid     private long nodeid;     @indexed(unique=true)     private string id;     private string name;     private string definition;      @relatedtovia(type="is_a",direction=direction.incoming)     private set<term2term> is_a_children;      @relatedtovia(type="is_a",direction=direction.outgoing)     set<term2term> is_a_parents;      @relatedtovia(type="part_of",direction = direction.incoming)     set<term2term> part_of_children;      @relatedtovia(type="part_of",direction = direction.outgoing)     set<term2term> part_of_parents; } 

term2term class:

@relationshipentity public class term2term {      @graphid     long id;     @startnode private term child;     @endnode private term parent; } 

the mapping works fine , accessing specific collections (i.e. is_a_children) works fine. have use case have populate navigationtree data. should this:

-term 1    - term 1.1 (is_a)      -term 1.1.1 (part_of)   - term 1.2 (part_of)   - term 1.3 (is_a)      - term 1.3.1 (part_of)      - term 1.3.2. (is_a) .... 

the navigationaltree has no notion of different relationship types.

i need combine different relationship collections (i.e. is_a_children , part_of_children) 1 collection , still keep information type of relationship (in order display it)

of course can create getter sets.union (guava) of 2 sets, way lose information relationship type. non-hackish way use 1 generic relationship type instead of 2 relationship types (is_a,part_of) in graph database , add type property relationship.

is there other way?

update 1:

it seems have use inheritence solve spring data neo4j - @relationshiptype issues
http://forum.springsource.org/showthread.php?124110-neo4j-inheritance-with-relationshipentities&highlight=neo4j+inheritance+with+relationshipentities


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -