Property Graph Exchange Format (PG) parser and serializer
Project description
pgformat
Property Graph Exchange Format (PG) parser and serializer
This package implements parsers and serializers to for labeled property graphs in Property Graph Exchange Format.
Table of Contents
Install
Requires Python 3.
pip install pgformat
Usage
The package comes with a simple command line client to convert between serialization forms of Property Graph Exchange format and an API to be used in python code. The command line client by default reads PG Format and emits PG JSONL.
usage: pgformat [-h] [-t {ndjson,json,pg}] [source]
Parse and transform property graphs in PG Format.
positional arguments:
source input file (default: - for standard input)
options:
-h, --help show this help message and exit
-t {ndjson,json,pg}, --to {ndjson,json,pg}
target format
The functionality is a subset of the pgraph command line tool written in NodeJS.
The command line client can also be called via python -m pgformat.
API
The package exports the functions parseGraph, parseStatements, and serializeGraph:
from pgformat import parseGraph, parseStatements, serializeGraph
statements = parseStatements("x\na -> b") # list of statements
graph = parseGraph("a -> b") # full graph
pg = serializeGraph(graph) # back to PG Format
The format of graph and statements is a data structure of plain lists and arrays for direct conversion to JSON. This may be changed in a future version.
License
Licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgformat-0.2.0.tar.gz.
File metadata
- Download URL: pgformat-0.2.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
215b6650b669f73d87219a910cabfaef04f90c1b90711129ed7b4f6b9fb1502b
|
|
| MD5 |
e293f132f54e3e25a4000590c952acb9
|
|
| BLAKE2b-256 |
7d3ddb5c9e4e1c5006e86cd7fbfffb99256510051ad78e75ff9a86febf155cdb
|
File details
Details for the file pgformat-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: pgformat-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2838593e01b097d8fd55dd20b349a748cc8c65c7b6829373a82255ef4e8ec325
|
|
| MD5 |
acf9ab4eb6b44534302234935d7a79d6
|
|
| BLAKE2b-256 |
4ebd6c0183e773a66d9e219ee819d85cb963679e105a8cc48a73ab68e8c41909
|