Skip to main content

A python library and CLI tool that rewrites and generates cypher queries for supporting sub-graph.

Project description

cypher-subgraph

A python library and CLI tool that rewrites and generates cypher queries for supporting subgraph.

Installation

pip install cypher-subgraph

CLI

Usage: cypher-subgraph [OPTIONS] COMMAND [ARGS]...

  Rewrite or generate query for supporting sub-graph feature.

Options:
  --help  Show this message and exit.

Commands:
  add-to       Rewrite the query read from standard input that the query
               returned values become the member of the specified "subgraph"
               argument.
  delete       Generate a query for deleting specfied "subgraph" argument.
  rewrite-for  Rewrite the query read from standard input that the query is
               executed only in the specified "subgraph" argument.

Examples

There is no known limitation on the reading queries. All the commands work well with Cypher nodes, edges, and paths.

Currently, running commands on multiple subgraphs at the same time is not supported. You should pass the previous rewritten query again to rewrite queries for multiple subgraphs.

add-to

Rewriting the query which the returned values becomes the member of "sg" subgraph:

cypher-subgraph add-to sg << EOF
MATCH (v) RETURN v
EOF

returns:

MATCH (v) WITH v
SET v.__subgraph_sg = true

rewrite-for

Rewrite the query which it only will be executed in the "sg" subgraph:

cypher-subgraph rewrite-for sg << EOF
MATCH (v) RETURN v
EOF

returns:

MATCH (v { __subgraph_sg: true }) RETURN v

delete

Delete subgraph "sg" meta-data:

cypher-subgraph delete sg

returns:

MATCH (v) OPTIONAL MATCH (v)-[e]-() REMOVE v.__subgraph_sg REMOVE e.__subgraph_sg

Implementation

The tool mimics the subgraph feature using the addition property for the nodes and edges. For each node and edge which is inside the "x" subgraph, the property "__subgraph_x" will be set true.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cypher-subgraph-0.1.1.tar.gz (61.9 kB view details)

Uploaded Source

File details

Details for the file cypher-subgraph-0.1.1.tar.gz.

File metadata

  • Download URL: cypher-subgraph-0.1.1.tar.gz
  • Upload date:
  • Size: 61.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for cypher-subgraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7831dbb0504ad64a405a9d6c7c95975b35902cdd76f054ed80389175685cd600
MD5 8d61b4fafe67eb7fd8cd91f0639536b7
BLAKE2b-256 4c8bce5aa16522ed92e18555ec2089263e934ea87d31ba45562372961c14120d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page