Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work on NODE KEY as constraint in TxState and SchemaStore Remove support for NODE KEY from TxState Support NODE_KEY add/remove as syntactic sugar over unique/existence Fixed kernel tests after NODE KEY support First round support for NODE KEY as full-stack constraint
- Loading branch information
1 parent
8cc7ea3
commit 5b2bb10
Showing
56 changed files
with
904 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ public enum ConstraintType | |
UNIQUENESS, | ||
NODE_PROPERTY_EXISTENCE, | ||
RELATIONSHIP_PROPERTY_EXISTENCE, | ||
NODE_KEY | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
community/kernel/src/main/java/org/neo4j/kernel/api/constraints/NodeKeyConstraint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (c) 2002-2017 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.kernel.api.constraints; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.neo4j.kernel.api.TokenNameLookup; | ||
import org.neo4j.kernel.api.schema_new.constaints.NodeKeyConstraintDescriptor; | ||
import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor; | ||
import org.neo4j.kernel.api.schema_new.SchemaUtil; | ||
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor; | ||
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptorFactory; | ||
|
||
/** | ||
* Description of uniqueness and existence constraint over nodes given a label and a property key id. | ||
* | ||
* @deprecated use {@link NodeKeyConstraintDescriptor} instead. | ||
*/ | ||
public class NodeKeyConstraint extends NodePropertyConstraint | ||
{ | ||
public NodeKeyConstraint( LabelSchemaDescriptor descriptor ) | ||
{ | ||
super( descriptor ); | ||
} | ||
|
||
public NewIndexDescriptor indexDescriptor() | ||
{ | ||
return NewIndexDescriptorFactory.forSchema( descriptor ); | ||
} | ||
|
||
@Override | ||
public void added( ChangeVisitor visitor ) | ||
{ | ||
visitor.visitAddedNodeKeyConstraint( this ); | ||
} | ||
|
||
@Override | ||
public void removed( ChangeVisitor visitor ) | ||
{ | ||
visitor.visitRemovedNodeKeyConstraint( this ); | ||
} | ||
|
||
@Override | ||
public String userDescription( TokenNameLookup tokenNameLookup ) | ||
{ | ||
String labelName = labelName( tokenNameLookup ); | ||
String boundIdentifier = labelName.toLowerCase(); | ||
String properties = | ||
SchemaUtil.niceProperties( tokenNameLookup, descriptor.getPropertyIds(), boundIdentifier + "." ); | ||
if ( descriptor.getPropertyIds().length > 1 ) | ||
{ | ||
properties = "(" + properties + ")"; | ||
} | ||
return String.format( "CONSTRAINT ON ( %s:%s ) ASSERT %s IS NODE KEY", boundIdentifier, labelName, properties ); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return String.format( "CONSTRAINT ON ( n:label[%s] ) ASSERT n.property[%s] IS NODE KEY", | ||
descriptor.getLabelId(), Arrays.toString( descriptor.getPropertyIds() ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.