{ "info": { "author": "Globality Engineering", "author_email": "engineering@globality.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3.7" ], "description": "# opencypher\n\n[OpenCypher](https://www.opencypher.org/) AST and Builder API\n\nOpenCypher defines an _abstract syntax tree_ based on the published OpenCypher\n[EBNF grammar](https://s3.amazonaws.com/artifacts.opencypher.org/cypher.ebnf)\nand a builder-oriented API for constructing Cypher queries.\n\nOpenCypher leans heavily on Python 3.7 `dataclasses` and `typing`.\n\n\n## Setup\n\n pip install opencypher\n\n\n## Usage\n\nThe core API exposes a fluent builder interface for constructing queries and patterns:\n\n from opencypher.api import match, node\n\n query = match(\n node(\"person\", \"Person\").rel_in().node(\"pet\", \"Pet\")\n ).ret(\n \"person\",\n \"pet\",\n )\n\n print(query) # MATCH (person:Person)-[]->(pet :Pet) RETURN person, pet\n\nThe builder supports chaining patterns and chaining clauses; queries may terminate on either\na return statement (`.ret()`) or on any updating clause (e.g. `create()`, `delete()`, `merge()`,\nand so forth.\n\n from opencypher.api import match, node\n\n query = match(\n node(\"alice\", \"Person\", {\"name\": \"Alice\"}),\n ).match(\n node(\"bob\", \"Person\", {\"name\": \"Bob\"}),\n ).merge(\n node(\"bob\").rel_in(types=\"IS_FRIENDS_WITH\").node(\"alice\"),\n ).merge(\n node(\"alice\").rel_in(types=\"IS_FRIENDS_WITH\").node(\"bob\"),\n )\n\nThe resulting `Cypher` query object integrates with -- but does not depend on -- the\n[Neo4J Python driver](https://github.com/neo4j/neo4j-python-driver):\n\n from neo4j import GraphDatabase\n\n driver = GraphDatabase.driver(\"bolt://localhost:7687\", auth=(\"neo4j\", \"password\"))\n\n with driver.session() as session:\n session.run(str(query), dict(query))\n\n\n## Caveats\n\nSome compromises have been made with respect to the completeness of the AST:\n\n 1. The grammar for expressions (and literals, atoms, etc.) has been deliberately simplified\n and reduces to `str` in many cases. The expression grammar is likely to get more complete\n over time.\n\n 2. Some forms of argumementation (e.g. `Set` items) are not easy to construct using the builder\n API (although these remain available within the AST).\n\n 3. Several top level query clauses are not yet implemented, including:\n\n - `CALL`\n - `WITH`\n\n 4. Parameters do not automatically generate unique identifiers/prefixes. Parameter names will be\n derived from variable names where known, but no fallback exists yet for anonyomous pattern terms.\n\n 5. Parameters do not support numeric values (`$1`); symbolic names (`$foo`) *are* supported.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/globality-corp/opencypher", "keywords": "opencypher cypher neo4j", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "opencypher", "package_url": "https://pypi.org/project/opencypher/", "platform": "", "project_url": "https://pypi.org/project/opencypher/", "project_urls": { "Homepage": "https://github.com/globality-corp/opencypher" }, "release_url": "https://pypi.org/project/opencypher/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "OpenCypher AST and Builder API", "version": "0.3.0" }, "last_serial": 4687224, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f78585a70f5ec05e0c524ca3b0c4d7c1", "sha256": "c9039d8750f1c9c4dacb700182db3a98548756be7ddb23cc09e5d0e99669d6c3" }, "downloads": -1, "filename": "opencypher-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f78585a70f5ec05e0c524ca3b0c4d7c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11687, "upload_time": "2019-01-09T21:02:35", "url": "https://files.pythonhosted.org/packages/cd/47/5581eb68e4bacaca66bf694a18c17aa21ab426e78c52095cea41d1819323/opencypher-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "57f83c8dbdcee1abc9c0ba9819cd4344", "sha256": "fb31bdd74f130532e0fdccb15c2ce94350c4cb995a57365c707d9586cc145e14" }, "downloads": -1, "filename": "opencypher-0.2.0.tar.gz", "has_sig": false, "md5_digest": "57f83c8dbdcee1abc9c0ba9819cd4344", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13773, "upload_time": "2019-01-09T22:25:09", "url": "https://files.pythonhosted.org/packages/ec/9d/2ad563924a5c8e60067e8f498e75d14f2e87057ed3167364e2f5d6075a72/opencypher-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "82bac6061f42f825ae68bce915a7e6d6", "sha256": "b18a24a2f7d9a76b6f2de67d43f931714401764e86c9c13cd46e9839cc213e46" }, "downloads": -1, "filename": "opencypher-0.2.1.tar.gz", "has_sig": false, "md5_digest": "82bac6061f42f825ae68bce915a7e6d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13836, "upload_time": "2019-01-09T22:34:20", "url": "https://files.pythonhosted.org/packages/5b/d3/e08b5e6fd46346d5566054af7a378068c62c99d06f72349e29fd58eacf69/opencypher-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "28daad6c47fa6a56ced1e8036fc9fb98", "sha256": "a4ff374c0abce993eb94eb93cb9b013cb35f2e6f3ee635bda408bfe8097bd2d9" }, "downloads": -1, "filename": "opencypher-0.3.0.tar.gz", "has_sig": false, "md5_digest": "28daad6c47fa6a56ced1e8036fc9fb98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15720, "upload_time": "2019-01-11T23:04:21", "url": "https://files.pythonhosted.org/packages/e7/df/25b2b6bdb3179d171e487aa1fd2239fe22403663f01d764a99fac60d533f/opencypher-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "28daad6c47fa6a56ced1e8036fc9fb98", "sha256": "a4ff374c0abce993eb94eb93cb9b013cb35f2e6f3ee635bda408bfe8097bd2d9" }, "downloads": -1, "filename": "opencypher-0.3.0.tar.gz", "has_sig": false, "md5_digest": "28daad6c47fa6a56ced1e8036fc9fb98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15720, "upload_time": "2019-01-11T23:04:21", "url": "https://files.pythonhosted.org/packages/e7/df/25b2b6bdb3179d171e487aa1fd2239fe22403663f01d764a99fac60d533f/opencypher-0.3.0.tar.gz" } ] }