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 update/change/delete in block format incremental import #2177

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

Conversation

renetapopova
Copy link
Collaborator

No description provided.

@neo-technology-commit-status-publisher
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-operations-2177.surge.sh

Updated pages:

* `empty` = `CREATE` (default)
* `C`, `CREATE` - Creates new nodes and relationships with or without properties.
* `U`, `UPDATE` - Updates existing nodes, relationships, or properties.
Leaving the property identifier empty is like having a “*” wild card.
Copy link
Member

Choose a reason for hiding this comment

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

Leaving the property identifier empty is like having a “*” wild card.

I don't understand what this refers to, or why it's mentioned with UPDATE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This I saw it in the PRD where I was looking for information. This was the example:

:START_ID,:END_ID,:TYPE,prop1:int{identifier=true},prop2:string{identifier=true},prop3,:ACTION
0        ,1      ,R    ,0                         ,Hi                           ,Bob  ,UPDATE
0        ,1      ,R    ,1                         ,                             ,Joe  ,UPDATE

Leaving the identifier property empty is like having a “*” wild card.

Copy link
Member

Choose a reason for hiding this comment

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

I think that should be a specific note for relationship updates/deletes and the more correct terminology would probably be an "identifier property", of which there can be zero, one or many.

* `:+LABEL` - Add one or more labels to an existing node.
* `:-LABEL` - Remove one or more labels (if they exist) from an existing node.

Multiple labels are separated by a semicolon.
Copy link
Member

Choose a reason for hiding this comment

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

This should be covered elsewhere, but the semicolon for array delimiter is the default and can be configured using a command option. So either this note should mention that information too, or just don't include this information at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't find it anywhere on this page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And I also didn't know that the semicolon for array delimiter is the default. Why do we need to mention that it can be configured using a command option given that it's already configured to be the default?

Copy link
Member

Choose a reason for hiding this comment

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

Because if the manual mentions that it's a semicolon that is the delimiter then it looks like that's that, right. Better to perhaps talk about "array delimiter character (which defaults to semicolon)" to be clear on that!

@renetapopova renetapopova requested a review from tinwelint March 12, 2025 14:10
Copy link
Member

@tinwelint tinwelint left a comment

Choose a reason for hiding this comment

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

I think it's starting to look much better!

Had a comment about -PROPERTY, which is still not quite what it should be

.Remove nodes' properties
[source, cypher, role="nocopy"]
----
:ID,:LABEL,:-PROPERTY,age,hometown
Copy link
Member

Choose a reason for hiding this comment

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

This isn't how it works either. To remove properties you add this :-PROPERTY column and for each entity, the values in this column specifies which properties to remove. E.g:

:ID,:-PROPERTY,somePropToSet,someOtherPropToSet
1,unwantedProp1,"Hello","There"
2,unwantedProp1;unwantedProp2,"Hi","Good bye"

Note that somePropToSet and someOtherPropToSet or completely normal property columns, unrelated to :-PROPERTY.

Copy link
Collaborator Author

@renetapopova renetapopova Mar 12, 2025

Choose a reason for hiding this comment

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

Ok, so in this case:

:ID,:LABEL,:-PROPERTY,age,hometown
person1,Actor,55,New York

it will remove some property (which I don't know what it is), and will leave the rest.
Is that the case?
Also in your example, there is no label but further up, you said that nodes are identified by their unique property value for the key/label combination that the header specifies. Doesn't this mean that the header should contain a label as well?

Copy link
Member

Choose a reason for hiding this comment

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

Your example should be:

:ACTION,:ID,:-PROPERTY
U,person1,age;hometown

and then a more meaningful example would probably state the full capabilities of update, i.e. to add/remove labels and set/remove properties all at the same time (I'm not good at examples):

:ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int
U,person1,Actor,Producer,age;hometown,"Henry",185

(And also the usual way of identifying nodes in incremental still apply, i.e. you need to specify e.g. uid and Person to let it know which uniqueness constraint you're looking up the nodes in.

See, one CSV entry can specify all types of updates to one entity at the same time. Here the node person1 is updated with:

  • added Actor label
  • removed Producer label
  • removed age and hometown properties
  • set name="Henry" property
  • set height=185 property


=== Remove existing properties

You can remove properties from existing nodes or relationships by specifying them after the keyword `:-PROPERTY` in the header file.
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: "You can remove properties from existing nodes or relationships by adding a :-PROPERTY column in the header. In the contents of this field you can add zero or more property names to remove from the entity".

.Remove nodes' properties
[source, cypher, role="nocopy"]
----
:ID,:LABEL,:-PROPERTY,age,hometown
Copy link
Member

Choose a reason for hiding this comment

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

Your example should be:

:ACTION,:ID,:-PROPERTY
U,person1,age;hometown

and then a more meaningful example would probably state the full capabilities of update, i.e. to add/remove labels and set/remove properties all at the same time (I'm not good at examples):

:ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int
U,person1,Actor,Producer,age;hometown,"Henry",185

(And also the usual way of identifying nodes in incremental still apply, i.e. you need to specify e.g. uid and Person to let it know which uniqueness constraint you're looking up the nodes in.

See, one CSV entry can specify all types of updates to one entity at the same time. Here the node person1 is updated with:

  • added Actor label
  • removed Producer label
  • removed age and hometown properties
  • set name="Henry" property
  • set height=185 property

.Remove relationships' properties
[source, cypher, role="nocopy"]
----
:START_ID,:END_ID,:TYPE,:-PROPERTY, role, description
Copy link
Member

Choose a reason for hiding this comment

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

This example has the same problem as above

@renetapopova renetapopova requested a review from tinwelint March 12, 2025 16:06
@recrwplay
Copy link
Contributor

This PR includes documentation updates
View the updated docs at https://neo4j-docs-operations-2177.surge.sh

Updated pages:

:ACTION,uid:ID(label:Person),name,:LABEL
CREATE,person1,"Keanu Reeves",Actor
UPDATE,person2,"Laurence Fishburne",Actor
DELETE,person4
Copy link
Member

Choose a reason for hiding this comment

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

I don't know how we do elsewhere, but technically the "correct" line would include all the other column separators too e.g. DELETE,person4,, but it's not strictly necessary. I'd guess the example looks better without them 🤷

U,person2,KNOWS,person1,def,"Laurence Fishburne","Hello Neo"
----

The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist.
Copy link
Member

Choose a reason for hiding this comment

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

"acts" -> "helps" ?

----

The data in the `p1` column for these relationships acts "more uniquely" selecting relationships, if multiple of `1,KNOWS,2` exist.
Identifier properties will match the selected relationships and as such not be set on the relationships (they already have it).
Copy link
Member

Choose a reason for hiding this comment

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

There can be multiple identifier properties defined in the header. Perhaps you already mention this implicitly in this sentence, your call.

----
uid:ID(label:Person),:+LABEL,:-LABEL,name,age
person1,Actor,Producer,"Keanu Reeves",55
person2,Actor;Director,"Laurence Fishburne",60
Copy link
Member

Choose a reason for hiding this comment

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

This row is missing content in its -LABEL column. It has

  • uid:ID{label:Person} = person1
  • :+LABEL = Actor;Director (i.e. add both these labels)
  • :-LABEL = Laurence Fishburne (i.e. remove label Laurence Fishburne)
  • name = 60
  • age = <empty>


You can remove properties from existing nodes or relationships by a `:-PROPERTY` column in the header.
In the contents of this field you can add zero or more property names to remove from the entity.
All nodes are identified by their `:ID` and all relationships by their `:START_ID`, `:END_ID`, and `:TYPE`.
Copy link
Member

Choose a reason for hiding this comment

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

Is it intentional to state this fact here too, about how nodes/relationships are identified?

[source, cypher, role="nocopy"]
----
:ACTION,uid:ID(label:Person),:-PROPERTY
U,person1,55;New York
Copy link
Member

Choose a reason for hiding this comment

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

The contents of the field which in this example is 55;New York should be property names, not property values e.g. instead age;hometown

[source, cypher, role="nocopy"]
----
:ACTION,:START_ID,:END_ID,:TYPE,:-PROPERTY
U,person1,movie1,ACTED_IN,Neo;"The chosen one"
Copy link
Member

Choose a reason for hiding this comment

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

Likewise here: Neo;"The chosen one" are property values. The contents of this field should be property names, e.g. name;role or something like that.

[source, cypher, role="nocopy"]
----
:ACTION,uid:ID(label:Person),:LABEL,:-LABEL,:-PROPERTY,name,height:int
U,person1,Actor,Producer,46;New York,"Henry",185
Copy link
Member

Choose a reason for hiding this comment

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

Same problem with :-PROPERTY here, i.e. 45;New York should instead be age;hometown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants