private RelationshipTypeResult( RelationshipType relationshipType ) { this.relationshipType = relationshipType.name(); } }
@Override public int hashCode() { return 31 * relationshipType.name().hashCode() + propertyKey.hashCode(); } }
@Override public boolean equals( Object that ) { if ( this == that ) { return true; } if ( that == null || that.getClass() != getClass() ) { return false; } return name.equals( ((RelationshipType) that).name() ); }
@Override public StandardExpander remove( RelationshipType type ) { Exclusion excluded = exclusion.get( type.name() ); if ( excluded == Exclusion.ALL ) { return this; } Map<String, Exclusion> newExclusion = new HashMap<>( exclusion ); newExclusion.put( type.name(), Exclusion.ALL ); return new ExcludingExpander( defaultExclusion, newExclusion ); }
@Override public ConstraintDefinition createPropertyExistenceConstraint( RelationshipType type, String propertyKey ) { int relationshipTypeId = getOrCreateRelationshipTypeId( type.name() ); int propertyKeyId = getOrCreatePropertyKeyId( propertyKey ); validateRelationshipConstraintCanBeCreated( relationshipTypeId, propertyKeyId ); createRelTypePropertyExistenceConstraintRule( relationshipTypeId, propertyKeyId ); return new RelationshipPropertyExistenceConstraintDefinition( this, type, propertyKey ); }
@Override protected String underlyingObjectToObject( RelationshipType object ) { return object.name(); } };
@Override public StandardExpander remove( RelationshipType type ) { Map<String, Exclusion> exclude = new HashMap<>(); exclude.put( type.name(), Exclusion.ALL ); return new ExcludingExpander( Exclusion.include( direction ), exclude ); }
private void appendRelationship( PrintWriter out, Relationship rel ) { out.print( "create (" ); out.print( identifier( rel.getStartNode() ) ); out.print( ")-[:" ); out.print( quote( rel.getType().name() ) ); formatProperties( out, rel ); out.print( "]->(" ); out.print( identifier( rel.getEndNode() ) ); out.println( ")" ); }
private void noSide( KernelTransaction ktx, DbStructureVisitor visitor, RelationshipType relType, int relTypeId ) { String userDescription = format("MATCH ()-[%s]->() RETURN count(*)", colon( relType.name() )); long amount = ktx.dataRead().countsForRelationship( ANY_LABEL, relTypeId, ANY_LABEL ); visitor.visitRelCount( ANY_LABEL, relTypeId, ANY_LABEL, userDescription, amount ); }
@Override ResourceIterator<Relationship> doExpand( Path path, BranchState state ) { final Node node = path.endNode(); ResourceIterator<Relationship> resourceIterator = asResourceIterator( node.getRelationships().iterator() ); return newResourceIterator( new FilteringIterator<>( resourceIterator, rel -> { Exclusion exclude = exclusion.get( rel.getType().name() ); exclude = (exclude == null) ? defaultExclusion : exclude; return exclude.accept( node, rel ); } ), resourceIterator ); }
@Override public int hashCode() { HashFunction hf = HashFunction.incrementalXXH64(); long hash = hf.initialise( 31 ); hash = hf.updateWithArray( hash, labels, label -> label.name().hashCode() ); hash = hf.updateWithArray( hash, relTypes, relType -> relType.name().hashCode() ); hash = hf.updateWithArray( hash, propertyKeys, String::hashCode ); return hf.toInt( hash ); }
private void rightSide( KernelTransaction ktx, DbStructureVisitor visitor, Label label, int labelId, RelationshipType relType, int relTypeId ) { String userDescription = format( "MATCH ()-[%s]->(%s) RETURN count(*)", colon( relType.name() ), colon( label.name() ) ); long amount = ktx.dataRead().countsForRelationship( ANY_LABEL, relTypeId, labelId ); visitor.visitRelCount( ANY_LABEL, relTypeId, labelId, userDescription, amount ); }
private void leftSide( KernelTransaction ktx, DbStructureVisitor visitor, Label label, int labelId, RelationshipType relType, int relTypeId ) { String userDescription = format( "MATCH (%s)-[%s]->() RETURN count(*)", colon( label.name() ), colon( relType.name() ) ); long amount = ktx.dataRead().countsForRelationship( labelId, relTypeId, ANY_LABEL ); visitor.visitRelCount( labelId, relTypeId, ANY_LABEL, userDescription, amount ); }
RelationshipData( Relationship relationship ) { this.startNode = relationship.getStartNode(); this.type = relationship.getType().name(); this.endNode = relationship.getEndNode(); } }
private void assertRelationshipEquals( InputEntity input, Relationship relationship ) { // properties assertPropertiesEquals( input, relationship ); // type assertEquals( input.stringType, relationship.getType().name() ); }
@Mapping( "metadata" ) public MapRepresentation metadata() { if ( isDeleted() ) { return new MapRepresentation( map( "id", rel.getId(), "deleted", Boolean.TRUE ) ); } else { return new MapRepresentation( map( "id", rel.getId(), "type", rel.getType().name() ) ); } }
protected int relationshipTypeId( RelationshipType type ) { try ( Transaction tx = db.beginTx() ) { int id = ktx().tokenRead().relationshipType( type.name() ); tx.success(); return id; } }