Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure Constraints section #1041

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from

Conversation

JPryce-Aklundh
Copy link
Contributor

@JPryce-Aklundh JPryce-Aklundh commented Sep 11, 2024

Before this is merged:

Fix links in Cheat Sheet and Operations Manual
Create a redirect from constraints/examples to constraints/managing-constraints

@JPryce-Aklundh JPryce-Aklundh added the cherry-pick-this-to-5.x Cherry pick this PR changes to the 5.x branch label Sep 11, 2024
@JPryce-Aklundh JPryce-Aklundh marked this pull request as ready for review September 19, 2024 09:47
@Hunterness Hunterness self-assigned this Sep 19, 2024
Copy link
Collaborator

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked at 2 files so far, and had some comments I assume will be general around naming and how we refer to things.

I resolved all of these after just looking at the file they were made on, will open new comments if I see places that were missed (hopefully none XD)

Copy link
Collaborator

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments on the not-constraint-section-files XD

| | xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]
| ensure that, for a given node label or relationship type and set of properties, all properties are present on the respective nodes or relationships, and the combination of property values is unique.
| xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]
| Ensures that property values are unique and exists for all nodes with a specific label or all relationships with a specific type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Ensures that property values are unique and exists for all nodes with a specific label or all relationships with a specific type.
| Ensures that the combined property values are unique and all exists for all nodes with a specific label or all relationships with a specific type.

maybe? to better match the updated property uniqueness one? 🤔

or maybe in the other order if that is better grammar

Suggested change
| Ensures that property values are unique and exists for all nodes with a specific label or all relationships with a specific type.
| Ensures that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.

a|
Only xref::constraints/examples.adoc#constraints-examples-node-uniqueness[node] and xref::constraints/examples.adoc#constraints-examples-relationship-uniqueness[relationship] property uniqueness constraints.
Only xref::constraints/managing-constraints.adoc#create-property-uniqueness-constraints[node and relationship uniqueness constraints].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Only xref::constraints/managing-constraints.adoc#create-property-uniqueness-constraints[node and relationship uniqueness constraints].
Only xref::constraints/managing-constraints.adoc#create-property-uniqueness-constraints[node and relationship property uniqueness constraints].

Copy link
Collaborator

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments from looking at the updates on the syntax page and the new version of constraints/index.adoc (still need to check that the removed parts now is covered in the managing-constraints file when I get to it, but one thing at the time XD)


Best practice when creating a constraint is to give the constraint a name.
This name must be unique among both indexes and constraints.
If a name is not explicitly given, a unique name will be auto-generated.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing the info about names?

This command creates a property uniqueness constraint on nodes with the specified label and properties.

[source, syntax, role="noheader", indent=0]
.Syntax for creating a node uniqueness constraint on a single property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.Syntax for creating a node uniqueness constraint on a single property
.Syntax for creating a node property uniqueness constraint on a single property

----
CREATE CONSTRAINT [constraint_name] [IF NOT EXISTS]
FOR (n:LabelName)
REQUIRE n.propertyName IS [NODE] UNIQUE
[OPTIONS "{" option: value[, ...] "}"]
----

[source, syntax, role="noheader", indent=0]
.Syntax for creating a composite node uniqueness constraint on multiple properties
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.Syntax for creating a composite node uniqueness constraint on multiple properties
.Syntax for creating a composite node property uniqueness constraint on multiple properties

This command creates a property uniqueness constraint on relationships with the specified relationship type and properties.

[source, syntax, role="noheader", indent=0]
.Syntax for creating a relationship uniqueness constraint on a single property label:new[Introduced in 5.7]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.Syntax for creating a relationship uniqueness constraint on a single property label:new[Introduced in 5.7]
.Syntax for creating a relationship property uniqueness constraint on a single property label:new[Introduced in 5.7]

----
CREATE CONSTRAINT [constraint_name] [IF NOT EXISTS]
FOR ()-"["r:RELATIONSHIP_TYPE"]"-()
REQUIRE r.propertyName IS [REL[ATIONSHIP]] UNIQUE
[OPTIONS "{" option: value[, ...] "}"]
----

[source, syntax, role="noheader", indent=0]
.Syntax for creating a composite relationship uniqueness constraint on multiple properties label:new[Introduced in 5.7]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.Syntax for creating a composite relationship uniqueness constraint on multiple properties label:new[Introduced in 5.7]
.Syntax for creating a composite relationship property uniqueness constraint on multiple properties label:new[Introduced in 5.7]


The returned columns from the show command is:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are removing them from here I want a link to them from here at least

@@ -314,9 +226,8 @@ SHOW [
[WHERE expression]
----

To get the full set of output columns, a yield clause is needed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels odd to keep the description sentence for the WHERE case (The simple version of the command allows for a `WHERE` clause and will give back the default set of output columns:) but not the YIELD case 🤔

[[constraints-syntax-list]]
== Syntax for listing constraints

List constraints in the database, either all or filtered on constraint type.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to remove this sentence? Create doesn't seem to have them but the drop does 🤷

Comment on lines +9 to +10
* *Property existence constraints* ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type.
label:enterprise-edition[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels odd to me that the label is on the line below and not the same line as for the other two below

* *Property existence constraints* ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type.
label:enterprise-edition[]
* *Property type constraints* ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[]
* *Key constraints* ensure that property values are unique and exists for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here as for the other file

Suggested change
* *Key constraints* ensure that property values are unique and exists for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]
* *Key constraints* ensure that the combined property values are unique and all exists for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]

or

Suggested change
* *Key constraints* ensure that property values are unique and exists for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]
* *Key constraints* ensure that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type. label:enterprise-edition[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-this-to-5.x Cherry pick this PR changes to the 5.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants