Examples of Relationship


Examples of org.neo4j.graphdb.Relationship

        keyColumnValues.toArray( new Object[keyColumnValues.size()] ) );
  }

  private Relationship deleteTempNodeAndUpdateRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node rowKeyNode) {
    Node ownerNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    Relationship inverseRelationship = updateInverseRelationship( rowKey, rowKeyNode, ownerNode );

    RelationshipType associationType = relationshipType( associationKey );
    Relationship relationship = null;
    if ( !associationKey.getCollectionRole().equals( associationKey.getTable() ) ) {
      relationship = ownerNode.createRelationshipTo( inverseRelationship.getStartNode(), associationType );
      applyColumnValues( rowKey, relationship );
    }
    return relationship;
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

    }
    return relationship;
  }

  private Relationship updateInverseRelationship(RowKey rowKey, Node rowKeyNode, Node ownerNode) {
    Relationship inverseRelationship = rowKeyNode.getRelationships( Direction.INCOMING ).iterator().next();
    Relationship newInverseRelationship = inverseRelationship.getStartNode().createRelationshipTo( ownerNode, inverseRelationship.getType() );
    applyColumnValues( rowKey, newInverseRelationship );
    inverseRelationship.delete();
    inverseRelationship.getEndNode().delete();
    return newInverseRelationship;
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

  }

  private PropertyContainer createRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node node) {
    EntityKey ownerEntityKey = associationKey.getEntityKey();
    Node ownerNode = neo4jCRUD.findNode( ownerEntityKey, ENTITY );
    Relationship relationship = ownerNode.createRelationshipTo( node, relationshipType( associationKey ) );
    applyColumnValues( rowKey, relationship );
    return relationship;
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

      break;
    }
  }

  private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    Relationship relationship = neo4jCRUD.findRelationship( associationKey, action.getKey() );
    applyTupleOperations( relationship, action.getValue().getOperations() );
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

  }

  private Relationship deleteTempNodeAndCreateRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node tempNode) {
    Node ownerNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    Iterator<Relationship> iterator = tempNode.getRelationships( Direction.INCOMING ).iterator();
    Relationship tempRelationship = iterator.next();
    Relationship relationship = ownerNode.createRelationshipTo( tempRelationship.getStartNode(), relationshipType( associationKey ) );
    applyColumnValues( rowKey, relationship );
    tempRelationship.delete();
    tempNode.delete();
    return relationship;
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

    return relationship;
  }

  private PropertyContainer createRelationshipWithEntity(AssociationKey associationKey, RowKey rowKey, Node node) {
    Node ownerNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    Relationship relationship = ownerNode.createRelationshipTo( node, relationshipType( associationKey ) );
    applyColumnValues( rowKey, relationship );
    return relationship;
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

      break;
    }
  }

  private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    Relationship relationship = neo4jCRUD.findRelationship( associationKey, action.getKey() );
    if ( relationship != null ) {
      applyTupleOperations( relationship, action.getValue().getOperations() );
    }
  }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

    query.append( " - " );
    query.append( relationshipCypher( associationKey, rowKey, parameters, entityKey.getColumnNames().length ) );
    query.append( " - () RETURN r" );
    ExecutionResult result = engine.execute( query.toString(), parameters );
    ResourceIterator<Relationship> column = result.columnAs( "r" );
    Relationship relationship = null;
    if ( column.hasNext() ) {
      relationship = column.next();
    }
    column.close();
    return relationship;
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

        UniqueFactory<Relationship> factory = new UniqueFactory.UniqueRelationshipFactory(graph, PROP_INDEX_REL) {

            @Override
            protected Relationship create(Map<String, Object> properties) {
                Relationship rel = source.createRelationshipTo(target, type);
                rel.setProperty(PROP_ID, properties.get(PROP_ID));
                return rel;
            }

            @Override
            protected void initialize(Relationship rel, Map<String, Object> properties) {
                rel.setProperty(PROP_CREATED, System.currentTimeMillis());
            }
        };
        return factory.getOrCreate(PROP_ID, key);
    }
View Full Code Here

Examples of org.neo4j.graphdb.Relationship

    }
  }

  private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    RowKey rowKey = action.getKey();
    Relationship relationship = createRelationshipUnlessExists( findNode( associationKey.getEntityKey() ), associationKey, rowKey );
    applyTupleOperations( relationship.getEndNode(), action.getValue().getOperations() );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.