Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.RelationshipType


    }

    @Override
    public void setAssociationValue( QualifiedName stateName, EntityReference newEntity )
    {
        RelationshipType association = association( stateName );
        Relationship rel = underlyingNode.getSingleRelationship( association, Direction.OUTGOING );
        if( rel != null )
        {
            Node otherNode = rel.getEndNode();
            if( otherNode.getProperty( ENTITY_ID ).equals( identity().identity() ) )
View Full Code Here


    }
  }
 
  @Override
  protected Number getForeignKeyValue(EORelationship rel) {
    RelationshipType relType = Neo4JUtils.getRelationshipType(rel);
    Relationship r = getNode().getSingleRelationship(relType, Direction.OUTGOING);
   
    if (r == null) {
      return null;
    } else {
View Full Code Here

    }
  }

  @Override
  protected void setForeignKeyValue(EORelationship rel, Number referencedId) {
    RelationshipType relType = Neo4JUtils.getRelationshipType(rel);
    Relationship r = getNode().getSingleRelationship(relType, Direction.OUTGOING);
   
    if (referencedId == null) {
      if (r != null) {
        r.delete();
View Full Code Here

    // remove all relationships that this node owns (in relational database these would be simply foreign key values
    // therefore removing a row would remove it's owned foreign keys. We could simply traverse through all of its
    // surrounding outgoing relationships and delete them, but it would delete join entity relationships too.
    for (EORelationship rel : entity.relationships()) {
      if (! rel.isCompound() && ! rel.isToMany()) {
        RelationshipType relType = Neo4JUtils.getRelationshipType(rel);
        Relationship r = getNode().getSingleRelationship(relType, Direction.OUTGOING);
       
        if (r != null) {
          r.delete();
        }
View Full Code Here

   *
   * @param r
   * @return Neo4J relationship type
   */
  public static RelationshipType getRelationshipType(EORelationship r) {
    RelationshipType ret = resultsCache.get(r);
   
    if (ret == null) {
      EOEntity e = r.entity();
      String label = e.name() + ":" + r.name();
     
View Full Code Here

  private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(NodesRelatedTo.class);

  final Cursor<Relationship> relationshipsIterator;
 
  public NodesRelatedTo(Results<Node> relatedTo, EORelationship rel) {
    final RelationshipType relationshipType = Neo4JUtils.getRelationshipType(rel);
   
    final Cursor<Node> nodeCursor = relatedTo;
   
    Cursor<Cursor<Relationship>> twoLevelIt = new Cursor<Cursor<Relationship>>() {
      public void remove() {
View Full Code Here

    } else {

      // handle relationship
      final RelationshipInterface relationship = (RelationshipInterface) modificationEvent.getGraphObject();
      final RelationshipType relType = modificationEvent.getRelationshipType();

      // only interested in CONTAINS relationships
      if (!("CONTAINS".equals(relType.name()))) {
        return null;
      }

      if (modificationEvent.isDeleted()) { // && "CONTAINS".equals(relType.name())) {
View Full Code Here

          logger.log(Level.INFO, "Creating relationship of type {0}", type);

          List<GenericNode> nodes        = createTestNodes(GenericNode.class, 2);
          final NodeInterface startNode  = nodes.get(0);
          final NodeInterface endNode    = nodes.get(1);
          final RelationshipType relType = RelType.IS_AT;
          NodeHasLocation rel       = app.create(startNode, endNode, NodeHasLocation.class);

          assertTrue(rel != null);
          assertTrue(rel.getType().equals(relType.name()));

        }
      }

      tx.success();
View Full Code Here

  }

  @Override
  public String getType() {

    final RelationshipType relType = getRelType();
    if (relType != null) {
      return relType.name();
    }

    return null;
  }
View Full Code Here

      })
    ;

    int numRels = relTypes.size();
    for(int i=0; i<numRels; i++) {
      RelationshipType relType = relTypes.get(i);
      Direction direction = directions.get(i);
      description = description.relationships(relType, direction);
    }

    return description;
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.RelationshipType

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.