Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Node


    return new Tuple();
  }

  @Override
  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    Node entityNode = findNode( associationKey.getEntityKey() );
    if ( entityNode == null ) {
      return null;
    }
    return new Association( new Neo4jAssociationSnapshot( entityNode, relationshipType( associationKey ), associationKey ) );
  }
View Full Code Here


  }

  @Override
  public void removeAssociation(AssociationKey key, AssociationContext associationContext) {
    if ( key != null ) {
      Node node = findNode( key.getEntityKey() );
      Iterable<Relationship> relationships = node.getRelationships( Direction.OUTGOING, relationshipType( key ) );
      for ( Relationship rel : relationships ) {
        removeRelationship( rel );
      }
    }
  }
View Full Code Here

  private void putTupleOperation(Node node, TupleOperation operation) {
    node.setProperty( operation.getColumn(), operation.getValue() );
  }

  private Node createNodeUnlessExists(EntityKey key) {
    Node node = findNode( key );
    if ( node == null ) {
      node = createNode( key );
    }
    return node;
  }
View Full Code Here

    }
    return node;
  }

  private Node createNode(EntityKey key) {
    Node node = provider.createNode();
    node.setProperty( TABLE_PROPERTY, key.getTable() );
    for ( int i = 0; i < key.getColumnNames().length; i++ ) {
      node.setProperty( key.getColumnNames()[i], key.getColumnValues()[i] );
    }
    indexer.index( node, key );
    return node;
  }
View Full Code Here

    throw new UnsupportedOperationException( "LockMode " + lockMode + " is not supported by the Neo4j GridDialect" );
  }

  @Override
  public Tuple getTuple(EntityKey key, TupleContext context) {
    Node entityNode = entityQueries.get( key.getMetadata() ).findEntity( executionEngine, key.getColumnValues() );
    if ( entityNode == null ) {
      return null;
    }
    return createTuple( entityNode, context );
  }
View Full Code Here

    return new Tuple( new Neo4jTupleSnapshot( entityNode, tupleContext.getAllAssociatedEntityKeyMetadata(), tupleContext.getAllRoles() ) );
  }

  @Override
  public void insertOrUpdateTuple(EntityKey key, Tuple tuple, TupleContext tupleContext) {
    Node node = entityQueries.get( key.getMetadata() ).findOrCreateEntity( executionEngine, key.getColumnValues() );
    applyTupleOperations( key, tuple, node, tuple.getOperations(), tupleContext );
    GraphLogger.log( "Inserted/Updated node: %1$s", node );
  }
View Full Code Here

    }
  }

  private Relationship createRelationshipWithEmbeddedNode(AssociationKey associationKey, Tuple associationRow, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {
    EntityKey entityKey = getEntityKey( associationRow, associatedEntityKeyMetadata );
    Node embeddedNode = entityQueries.get( entityKey.getMetadata() ).createEmbedded( executionEngine, entityKey.getColumnValues() );
    Relationship relationship = createRelationshipWithTargetNode( associationKey, associationRow, embeddedNode );
    applyProperties( associationKey, associationRow, relationship );
    return relationship;
  }
View Full Code Here

    return relationship;
  }

  private Relationship findOrCreateRelationshipWithEntityNode(AssociationKey associationKey, Tuple associationRow, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {
    EntityKey targetEntityKey = getEntityKey( associationRow, associatedEntityKeyMetadata );
    Node targetNode = entityQueries.get( targetEntityKey.getMetadata() ).findEntity( executionEngine, targetEntityKey.getColumnValues() );
    return createRelationshipWithTargetNode( associationKey, associationRow, targetNode );
  }
View Full Code Here

    }
  }

  private Relationship createRelationshipWithTargetNode(AssociationKey associationKey, Tuple associationRow, Node targetNode) {
    EntityKey entityKey = associationKey.getEntityKey();
    Node ownerNode = entityQueries.get( entityKey.getMetadata() ).findEntity( executionEngine, entityKey.getColumnValues() );
    Relationship relationship = ownerNode.createRelationshipTo( targetNode, withName( associationKey.getMetadata().getCollectionRole() ) );
    applyProperties( associationKey, associationRow, relationship );
    return relationship;
  }
View Full Code Here

  }

  @Override
  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    EntityKey entityKey = associationKey.getEntityKey();
    Node entityNode = entityQueries.get( entityKey.getMetadata() ).findEntity( executionEngine, entityKey.getColumnValues() );
    GraphLogger.log( "Found owner node: %1$s", entityNode );
    if ( entityNode == null ) {
      return null;
    }
    return new Association(
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.Node

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.