Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Relationship


      break;
    }
  }

  private void putAssociationOperation(Association association, AssociationKey associationKey, AssociationOperation action, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {
    Relationship relationship = associationQueries.get( associationKey.getMetadata() ).findRelationship( executionEngine, associationKey, action.getKey() );

    if (relationship != null) {
      for ( String relationshipProperty : associationKey.getMetadata().getRowKeyIndexColumnNames() ) {
        relationship.setProperty( relationshipProperty, action.getValue().get( relationshipProperty ) );

      }
      GraphLogger.log( "Updated relationship: %1$s", relationship );
    }
    else {
View Full Code Here


    }
  }

  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

    Relationship relationship = createRelationshipUnlessExists( findNode( associationKey.getEntityKey() ), associationKey, rowKey );
    applyTupleOperations( relationship.getEndNode(), action.getValue().getOperations() );
  }

  private Relationship createRelationshipUnlessExists(Node startNode, AssociationKey associationKey, RowKey rowKey) {
    Relationship relationship = indexer.findRelationship( relationshipType( associationKey ), rowKey );
    if ( relationship == null ) {
      return createRelationship( startNode, associationKey, rowKey );
    }
    return relationship;
  }
View Full Code Here

    return indexer.findNode( entityKey );
  }

  private void removeAssociationOperation(AssociationKey associationKey, AssociationOperation action) {
    RowKey rowKey = action.getKey();
    Relationship relationship = indexer.findRelationship( relationshipType( associationKey ), rowKey );
    removeRelationship( relationship );
  }
View Full Code Here

    indexer.remove( entityNode );
    entityNode.delete();
  }

  private Relationship createRelationship(Node startNode, AssociationKey associationKey, RowKey rowKey) {
    Relationship relationship = startNode.createRelationshipTo( provider.createNode(), relationshipType( associationKey ) );
    for ( int i = 0; i < rowKey.getColumnNames().length; i++ ) {
      relationship.setProperty( rowKey.getColumnNames()[i], rowKey.getColumnValues()[i] );
    }
    indexer.index( relationship );
    return relationship;
  }
View Full Code Here

    serialize( object, type, targetNode, formatVersion );
  }

  @Nonnull
  public <T> T deserializeWithRelationship( @Nonnull Class<T> type, @Nonnull RelationshipType relationshipType, @Nonnull Node node, @Nonnull Version formatVersion ) throws IOException {
    @Nullable Relationship relationship = node.getSingleRelationship( relationshipType, Direction.OUTGOING );
    assert relationship != null;
    return deserialize( type, formatVersion, relationship.getEndNode() );
  }
View Full Code Here

        {
            throw new IllegalArgumentException( "Null movie" );
        }
        final Node actorNode = ((ActorImpl) actor).getUnderlyingNode();
        final Node movieNode = ((MovieImpl) movie).getUnderlyingNode();
        final Relationship rel = actorNode.createRelationshipTo( movieNode,
            RelTypes.ACTS_IN );
        final Role role = new RoleImpl( rel );
        if ( roleName != null )
        {
            role.setName( roleName );
View Full Code Here

    neo4jCRUD.remove( key );
  }

  @Override
  public Tuple createTupleAssociation(AssociationKey associationKey, RowKey rowKey) {
    Relationship relationship = createRelationship( associationKey, rowKey );
    GraphLogger.log( "Relationship: %1$s", relationship );
    if ( relationship == null ) {
      // This should only happen for bidirectional associations, when we are creating the association on the owner side.
      // We can ignore the creation of the relationship in this case and we will create it when dealing with the inverese side of
      // the same association
View Full Code Here

    }
  }

  private Relationship createRelationshipWithEmbeddedNode(AssociationKey associationKey, RowKey rowKey) {
    Node embeddedNode = neo4jCRUD.createNode( rowKey.getEntityKey(), EMBEDDED );
    Relationship relationship = createRelationshipWithTargetNode( associationKey, rowKey, embeddedNode );
    applyProperties( associationKey, rowKey, relationship );
    return relationship;
  }
View Full Code Here

      // We have to wait the creation of the target side of the association before
      // we can obtain the targetKey
      return null;
    }

    Relationship relationship = neo4jCRUD.findRelationship( associationKey, rowKey );
    if ( relationship != null ) {
      return relationship;
    }

    Node targetNode = neo4jCRUD.findNode( targetKey, ENTITY );
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.Relationship

Copyright © 2018 www.massapicom. 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.