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

document the remove clause #101

Merged
merged 2 commits into from
Dec 9, 2024
Merged

document the remove clause #101

merged 2 commits into from
Dec 9, 2024

Conversation

swilly22
Copy link
Contributor

@swilly22 swilly22 commented Dec 9, 2024

Fix #100

Summary by CodeRabbit

  • New Features
    • Introduced documentation for the REMOVE clause in the Cypher query language, including functionality and examples for removing attributes and labels from nodes and relationships.
    • Added a link to the new REMOVE documentation in the Cypher Language documentation index.

@swilly22 swilly22 requested a review from gkorland December 9, 2024 11:18
Copy link
Contributor

coderabbitai bot commented Dec 9, 2024

Warning

Rate limit exceeded

@swilly22 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b650094 and 0b27025.

📒 Files selected for processing (2)
  • cypher/index.md (2 hunks)
  • cypher/remove.md (1 hunks)

Walkthrough

The changes introduce a new documentation file, cypher/remove.md, which details the REMOVE clause in the Cypher query language. It explains how to remove attributes from nodes and relationships, as well as how to remove labels from nodes. The documentation includes examples and expected outcomes to illustrate the functionality of the REMOVE clause.

Changes

Files Change Summary
cypher/remove.md New documentation file created detailing the REMOVE clause, including usage examples and expected results.
cypher/index.md Clause added: [REMOVE](/cypher/remove) in the list of clauses; minor formatting change made.

Assessment against linked issues

Objective Addressed Explanation
Document the REMOVE clause (#100)

🐰 In the land of code where queries flow,
The REMOVE clause now steals the show!
With docs so clear, and examples bright,
Removing labels and scores feels just right.
Hop along, dear coder, and give it a try,
With REMOVE in hand, let your queries fly! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (2)
cypher/remove.md (2)

4-6: Consider enhancing the description for better clarity.

The current description is concise but could be more informative. Consider mentioning that this is a core Cypher operation and adding a brief note about when/why one might want to use REMOVE.

 description: >
-    REMOVE is used to remove attributes from node and relationships, in addition to
-    removing labels from nodes.
+    The REMOVE clause is a core Cypher operation used to remove properties from nodes
+    and relationships, as well as to remove labels from nodes. This operation is
+    useful for data cleanup, schema evolution, and maintaining data consistency.

12-19: Enhance example graph for better coverage.

While the current example is good for node operations, consider these improvements:

  1. Add a visual representation or ASCII diagram of the graph for better understanding
  2. Include relationships between nodes to demonstrate REMOVE operations on relationship properties
 ## Example graph
+
+The following diagram shows our example graph structure:
+
+```ascii
+    (Billy:Player)         (Andy:Player)
+         |                      |
+         |                      |
+         v                      v
+    (Lori:Player:Admin)--[r:KNOWS {since: 2020}]-->(Bob:Player)
+```
+
 ```cypher
 CREATE
     (billy :Player {name: 'Billy', score: 84}),
     (andy :Player {name: 'Andy', score: 21}),
-    (lori :Player:Admin {name: 'Lori', score: 90})
+    (lori :Player:Admin {name: 'Lori', score: 90}),
+    (bob :Player {name: 'Bob', score: 55}),
+    (lori)-[:KNOWS {since: 2020}]->(bob)

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 5570e0821f2f5e387443d3ad16ef4b7fea673658 and 5cec2c95f0a7b60c27367006c66645369a4f868a.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `cypher/remove.md` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>cypher/remove.md</summary>

[uncategorized] ~49-~49: A punctuation mark might be missing here.
Context: ...labels(n) ```  Result: |n.name|abels(n)| |------|--------| |"Lori"|[Player]|   ##...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

---

[uncategorized] ~66-~66: A punctuation mark might be missing here.
Context: ...labels(n) ```  Result: |n.name|abels(n)| |------|--------| |"Lori"|[]      | 

(AI_EN_LECTOR_MISSING_PUNCTUATION)

</details>

</details>
<details>
<summary>🪛 Markdownlint (0.35.0)</summary>

<details>
<summary>cypher/remove.md</summary>

33-33: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

---

49-49: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

---

66-66: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

</details>

</details>

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +21 to +36
## Remove attributes

The following query removes the 'score' attribute from the node
representing Andy.

```cypher
MATCH (n {name: 'Andy'})
REMOVE n.score
RETURN n.name, n.score
```

Result:
|n.name|n.score|
|------|-------|
|"Andy"| Null |

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add missing examples and fix table formatting.

The section should include:

  1. Example of removing relationship properties
  2. Example of removing multiple properties at once
  3. Proper table formatting with surrounding blank lines
 ## Remove attributes

+### Remove node properties
+
 The following query removes the 'score' attribute from the node
 representing Andy.

 ```cypher
 MATCH (n {name: 'Andy'})
 REMOVE n.score
 RETURN n.name, n.score

Result:
+

n.name n.score
"Andy" Null

+### Remove relationship properties
+
+The following query removes the 'since' property from KNOWS relationships:
+
+cypher +MATCH (lori {name: 'Lori'})-[r:KNOWS]->(bob) +REMOVE r.since +RETURN type(r), r.since +
+
+Result:
+
+|type(r)|r.since|
+|-------|-------|
+|"KNOWS"| Null |
+
+### Remove multiple properties
+
+You can remove multiple properties in a single REMOVE clause:
+
+cypher +MATCH (n {name: 'Billy'}) +REMOVE n.score, n.name +RETURN n +


<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Markdownlint (0.35.0)</summary>

33-33: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

cypher/remove.md Outdated
Comment on lines 38 to 52
## Remove a label from a node

To remove a label from a node use the REMOVE clause as follows:

```cypher
MATCH (n {name: 'Lori'})
REMOVE n:Admin
RETURN n.name, labels(n)
```

Result:
|n.name|abels(n)|
|------|--------|
|"Lori"|[Player]|

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo and add important notes about label removal.

  1. There's a typo in the table header ("abels" should be "labels")
  2. Add a note about attempting to remove non-existent labels
  3. Fix table formatting
 ## Remove a label from a node

 To remove a label from a node use the REMOVE clause as follows:
+
+Note: Attempting to remove a non-existent label from a node is a no-op operation
+and will not cause an error.

 ```cypher
 MATCH (n {name: 'Lori'})
 REMOVE n:Admin
 RETURN n.name, labels(n)

Result:
+
-|n.name|abels(n)|
+|n.name|labels(n)|
|------|--------|
|"Lori"|[Player]|
+


<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[uncategorized] ~49-~49: A punctuation mark might be missing here.
Context: ...labels(n) ```  Result: |n.name|abels(n)| |------|--------| |"Lori"|[Player]|   ##...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

</details>
<details>
<summary>🪛 Markdownlint (0.35.0)</summary>

49-49: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

cypher/remove.md Outdated
Comment on lines 54 to 68
## Removing multiple labels from a node

Similar to removing a single label from a node we can use the REMOVE clause
to remove multiple labels in one go

```cypher
MATCH (n :Player {name: 'Lori'})
REMOVE n:Admin:Player
RETURN n.name, labels(n)
```

Result:
|n.name|abels(n)|
|------|--------|
|"Lori"|[] |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo and add clarification about multiple label removal.

  1. Fix the typo in table header ("abels" should be "labels")
  2. Add a note about label order independence
  3. Fix table formatting
 ## Removing multiple labels from a node

 Similar to removing a single label from a node we can use the REMOVE clause
-to remove multiple labels in one go
+to remove multiple labels in one go. The order of labels in the REMOVE clause
+does not matter.

 ```cypher
 MATCH (n :Player {name: 'Lori'})
 REMOVE n:Admin:Player
 RETURN n.name, labels(n)

Result:
+
-|n.name|abels(n)|
+|n.name|labels(n)|
|------|--------|
|"Lori"|[] |
+


<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[uncategorized] ~66-~66: A punctuation mark might be missing here.
Context: ...labels(n) ```  Result: |n.name|abels(n)| |------|--------| |"Lori"|[]      | 

(AI_EN_LECTOR_MISSING_PUNCTUATION)

</details>
<details>
<summary>🪛 Markdownlint (0.35.0)</summary>

66-66: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit -->

@gkorland gkorland merged commit 165e935 into main Dec 9, 2024
2 checks passed
@gkorland gkorland deleted the remove-clause branch December 9, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document the REMOVE clause
2 participants