This repository was archived by the owner on Sep 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
[master < T350] Add graphml docs #1020
Open
ind1xa
wants to merge
6
commits into
master
Choose a base branch
from
T350-MAGE-add-graphml-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bcb7b99
add graphml docs
ind1xa 983235a
add examples
ind1xa a25a322
add import data
ind1xa d02866a
Apply suggestions from code review
vpavicic a8225d2
PR review changes
ind1xa a60be34
Merge branch 'T350-MAGE-add-graphml-docs' of https://github.com/memgr…
ind1xa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,7 +21,7 @@ export const Highlight = ({children, color}) => ( | |||||
| ); | ||||||
|
|
||||||
| Module for exporting a graph database or query results in different formats. Currently, this | ||||||
| module supports [**exporting database to a JSON file format**](#jsonpath) and [**exporting query results in a CSV file format**](#csv_queryquery-file_path-stream). | ||||||
| module supports [**exporting database to a JSON file format**](#jsonpath), [**exporting query results in a CSV file format**](#csv_queryquery-file_path-stream) and [**exporting database to a graphML file format**](#graphmlpath-config). | ||||||
|
|
||||||
| [](https://github.com/memgraph/mage/blob/main/python/export_util.py) | ||||||
|
|
||||||
|
|
@@ -165,6 +165,83 @@ where `path` is the path to a local CSV file that will be created inside the | |||||
|
|
||||||
| </Tabs> | ||||||
|
|
||||||
| ### `graphml(path, config)` | ||||||
|
|
||||||
| #### Input: | ||||||
|
|
||||||
| * `path: string` ➡ path to the graphML file that will contain the exported graph database. | ||||||
| * `config: Map (default={})` ➡ configuration parameters explained below. | ||||||
|
|
||||||
| #### Parameters: | ||||||
|
|
||||||
| | Name | Type | Default | Description | | ||||||
| |- |- |- |- | | ||||||
| | stream | Bool | False | Stream the file content directly to the client into the status field. | | ||||||
| | format | String | " " | Set the export format to either "gephi" or "tinkerpop". | | ||||||
| | caption | List | [ ] | A list of keys of properties whose value is eligible as value for the `label` data element in Gephi format. Order is important and if no match is found, then there is a fallback to the node's first property. If the node has no properties then the ID is used. | | ||||||
| | useTypes | Bool | False | Store property values' type information. | | ||||||
| | leaveOutLabels | Bool | False | Do not store node's labels. | | ||||||
| | leaveOutProperties | Bool | False | Do not store node's properties. | | ||||||
|
|
||||||
| #### Output: | ||||||
|
|
||||||
| * `status: string` ➡ file content if stream is set to `True` in configuration parameters, `success` otherwise. | ||||||
|
|
||||||
| #### Usage: | ||||||
|
|
||||||
| The `path` you have to provide as procedure argument depends on how you started | ||||||
| Memgraph. | ||||||
|
|
||||||
| <Tabs | ||||||
| groupId="export_to_json_usage" | ||||||
| defaultValue="docker" | ||||||
| values={[ | ||||||
| {label: 'Docker', value: 'docker'}, | ||||||
| {label: 'Linux', value: 'linux'}, | ||||||
| ] | ||||||
| }> | ||||||
|
|
||||||
| <TabItem value="docker"> | ||||||
|
|
||||||
| If you ran Memgraph with Docker, database will be exported to a graphML file inside | ||||||
| the Docker container. We recommend exporting the database to the graphML file | ||||||
| inside the `/usr/lib/memgraph/query_modules` directory. | ||||||
|
|
||||||
| You can call the procedure by running the following query: | ||||||
|
|
||||||
| ```cypher | ||||||
| CALL export_util.graphml(path); | ||||||
| ``` | ||||||
| where `path` is the path to the JSON file inside the | ||||||
| `/usr/lib/memgraph/query_modules` directory in the running Docker container (e.g., | ||||||
| `/usr/lib/memgraph/query_modules/export.graphml`). | ||||||
|
|
||||||
| :::info | ||||||
| You can [**copy the exported CSV file to your local file system**](/memgraph/how-to-guides/work-with-docker#how-to-copy-files-from-and-to-a-docker-container) using the [`docker cp`](https://docs.docker.com/engine/reference/commandline/cp/) command. | ||||||
| ::: | ||||||
| </TabItem> | ||||||
|
|
||||||
| <TabItem value="linux"> | ||||||
|
|
||||||
| To export database to a local graphML file create a new directory (for example, | ||||||
| `export_folder`) and run the following command to give the user `memgraph` the | ||||||
| necessary permissions: | ||||||
|
|
||||||
| ``` | ||||||
| sudo chown memgraph export_folder | ||||||
| ``` | ||||||
|
|
||||||
| Then, call the procedure by running the following query: | ||||||
|
|
||||||
| ```cypher | ||||||
| CALL export_util.graphml(path); | ||||||
| ``` | ||||||
| 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 | |
| where `path` is the path to a local JSON file that will be created inside the |
again, json?
Comment on lines
+386
to
+387
Collaborator
There was a problem hiding this comment.
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
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
vpavicic marked this conversation as resolved.
Show resolved
Hide resolved
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON or graphml?