{ "info": { "author": "Nick Morley", "author_email": "nick.morley111@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# primal-grakn\n\nA convenience wrapper around the official [grakn-python client](https://github.com/graknlabs/grakn/tree/master/client-python).\n\n## Features\n\n- Less code / boilerplate.\n- Response data looks and acts like primitive data structures (python lists / dicts etc.). Thus more immediately intelligble, accessable, and JSON-serialisable.\n- Some added conveniences such as match_or_insert function.\n- Still access all underlying grakn-python client functionality where needed.\n\n## Why\n\nThe [grakn-python client](https://github.com/graknlabs/grakn/tree/master/client-python) provides a complete and efficient object-oriented method of interaction with a Grakn instance. It can require a lot of code and recursion to get data. This extension aims to provide convenience through reducing code involved in connecting to Grakn and working with response data. It reflects a manner of working with Grakn through python that I have found to be preferrable.\n\n## Usage\n\n### Example\n\n```python\nimport primal_grakn.primal_grakn as grakn\n\nwith grakn.Graph(uri='myuri', keyspace='mykeyspace') as graph:\n query = 'insert $a isa animal has name \\\"squirrel\\\";' # Escape your quotes, or use a raw string\n concept_map = graph.execute('match $a isa animal; get;')\n print(concept_map)\n [{'a': {\n 'id': 'V4144',\n 'type': 'animal',\n 'base_type': 'entity',\n 'attributes': [{\n 'id': 'V4216',\n 'label': 'name',\n 'value': 'squirrel'\n }]\n }}]\n print(concept_map.object) # Get the underlying ConceptMap object\n print(concept_map['a'].object) # Get the underlying Concept object\n graph.commit() # Don't forget to commit changes if you make them. N.B. this also closes the session\n```\n\n### API\n\n#### primal_grakn.Graph\n\n| Name | Type | Description | Params | Example |\n| --- | --- |--- | --- | --- |\n| Graph | Class | Initiates the session. |