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
Hashes for pgformat-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2838593e01b097d8fd55dd20b349a748cc8c65c7b6829373a82255ef4e8ec325 |
|
MD5 | acf9ab4eb6b44534302234935d7a79d6 |
|
BLAKE2b-256 | 4ebd6c0183e773a66d9e219ee819d85cb963679e105a8cc48a73ab68e8c41909 |