Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[master < T350] Add graphml docs #1020

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

ind1xa
Copy link
Contributor

@ind1xa ind1xa commented Sep 6, 2023

Description

Added documentation for graphml import and export functions.

Pull request type

  • New documentation page

Related PRs and issues

PR this doc page is related to: memgraph/mage#327

Checklist:

  • I checked all content with Grammarly
  • I performed a self-review of my code
  • I made corresponding changes to the rest of the documentation
  • The build passes locally
  • My changes generate no new warnings or errors

@ind1xa ind1xa added the status: ready PR is ready for review label Sep 6, 2023
@ind1xa ind1xa self-assigned this Sep 6, 2023
@ind1xa ind1xa added status: draft PR is in draft phase and removed status: ready PR is ready for review labels Sep 7, 2023
@ind1xa ind1xa added status: ready PR is ready for review and removed status: draft PR is in draft phase labels Sep 7, 2023
```cypher
CALL export_util.graphml(path);
```
where `path` is the path to the JSON file inside the
Copy link
Collaborator

@vpavicic vpavicic Sep 8, 2023

Choose a reason for hiding this comment

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

JSON or graphml?

```cypher
CALL export_util.graphml(path);
```
where `path` is the path to a local JSON file that will be created inside the
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
where `path` is the path to a local JSON file that will be created inside the
where `path` is the path to a local JSON file that will be created inside the

again, json?

Comment on lines +386 to +387
CREATE (JoyceByers:Character {name:'Joyce Byers', portrayed_by:'Winona Ryder'})
CREATE (JimHopper:Character {name:'Jim Hopper', portrayed_by:'David Harbour'})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed this once and I was like... will i fix this... is this worth opening a PR for :D :D naaaah... :D thnx


| Name | Type | Default | Description |
|- |- |- |- |
| readLabels | Bool | False | Create node labels based on the value of the property whose key is "labels". |
Copy link
Collaborator

@vpavicic vpavicic Sep 8, 2023

Choose a reason for hiding this comment

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

Suggested change
| readLabels | Bool | False | Create node labels based on the value of the property whose key is "labels". |
| readLabels | Bool | False | Create node labels by using the value of the `labels` key. |
  1. nodes ain't people
  2. the original sentence is very complicated... is mine ok? why do we need to say "property"?

| readLabels | Bool | False | Create node labels based on the value of the property whose key is "labels". |
| defaultRelationshipType | String | "RELATED" | The default relationship type to use when none is specified in the import file. |
| storeNodeIds | Bool | False | Store node's id attribute as a property. |
| source | Map | { } | A map that has two keys: label and id. Label is mandatory while id's default value is "id". This allows the import of relationships in case the source node is not present in the file. It will search for a source node with a specific label and a property whose key is this map's id value, and whose value is relationship's source node id. For example, with a config map `{source: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n0" doesn't exist, it will search for a source node `(:Device {serial_number: "n0"})`. |
Copy link
Collaborator

@vpavicic vpavicic Sep 8, 2023

Choose a reason for hiding this comment

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

Suggested change
| source | Map | { } | A map that has two keys: label and id. Label is mandatory while id's default value is "id". This allows the import of relationships in case the source node is not present in the file. It will search for a source node with a specific label and a property whose key is this map's id value, and whose value is relationship's source node id. For example, with a config map `{source: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n0" doesn't exist, it will search for a source node `(:Device {serial_number: "n0"})`. |
| source | Map | { } | A map with two keys: `label` and `id`. The `label` is mandatory, while the `id`'s default value is `id`. This allows the import of relationships if the source node is absent in the file. It will search for a source node with a specific label and a property equal to the map's `id` value. The value of that property should be equal to the relationship's source node ID. For example, with a config map `{source: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n0" doesn't exist, it will search for a source node `(:Device {serial_number: "n0"})`. |

What will allow the import of relationships if the source node is absent?
What will search for a source node?

The explanation was really complicated, is what I wrote true?

| defaultRelationshipType | String | "RELATED" | The default relationship type to use when none is specified in the import file. |
| storeNodeIds | Bool | False | Store node's id attribute as a property. |
| source | Map | { } | A map that has two keys: label and id. Label is mandatory while id's default value is "id". This allows the import of relationships in case the source node is not present in the file. It will search for a source node with a specific label and a property whose key is this map's id value, and whose value is relationship's source node id. For example, with a config map `{source: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n0" doesn't exist, it will search for a source node `(:Device {serial_number: "n0"})`. |
| target | Map | { } | A map that has two keys: label and id. Label is mandatory while id's default value is "id". This allows the import of relationships in case the target node is not present in the file. It will search for a target node with a specific label and a property whose key is this map's id value, and whose value is relationship's target node id. For example, with a config map `{target: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n1" doesn't exist, it will search for a target node `(:Device {serial_number: "n1"})`. |
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
| target | Map | { } | A map that has two keys: label and id. Label is mandatory while id's default value is "id". This allows the import of relationships in case the target node is not present in the file. It will search for a target node with a specific label and a property whose key is this map's id value, and whose value is relationship's target node id. For example, with a config map `{target: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n1" doesn't exist, it will search for a target node `(:Device {serial_number: "n1"})`. |
| target | Map | { } | A map with two keys: `label` and `id`. The `label` is mandatory while the `id`'s default value is `id`. This allows the import of relationships in case the target node is absent in the file. It will search for a target node with a specific label and a property equal to the map's `id` value. The value of that property should be equal to the relationship's target node ID. For example, with a config map `{target: {id: 'serial_number', label: 'Device'}}` and an edge defined as `<edge id="e0" source="n0" target="n1" label="CONNECT"><data key="label">CONNECT</data></edge>`, if node "n1" doesn't exist, it will search for a target node `(:Device {serial_number: "n1"})`. |


#### Output:

* `status: string` ➡ "success" if no errors are generated.
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
* `status: string`"success" if no errors are generated.
* `status: string``success` if no errors are 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 is there an asterisk at the beginning of this row'?

```cypher
CALL export_util.graphML(path);
```
where `path` is the path to the JSON file inside the
Copy link
Collaborator

@vpavicic vpavicic Sep 8, 2023

Choose a reason for hiding this comment

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

JSON or graphml?

```cypher
CALL export_util.graphml(path);
```
where `path` is the path to a local JSON file that will be created inside the
Copy link
Collaborator

@vpavicic vpavicic Sep 8, 2023

Choose a reason for hiding this comment

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

JSON or graphml?

Copy link
Collaborator

@vpavicic vpavicic left a comment

Choose a reason for hiding this comment

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

See comments

@vpavicic vpavicic added status: change PR reviewed - needs changes and removed status: ready PR is ready for review labels Sep 8, 2023
@ind1xa ind1xa requested a review from vpavicic September 9, 2023 07:31
@ind1xa ind1xa added status: ready PR is ready for review and removed status: change PR reviewed - needs changes labels Sep 9, 2023
@vpavicic vpavicic added status: ship it PR approved and removed status: ready PR is ready for review labels Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants