Skip to main content

Property Graph Exchange Format (PG) parser and serializer

Project description

pgformat

Test PyPI

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.

API

The package exports two functions: parseGraph and parseStatements:

from pgformat import parseGraph, parseStatements

graph = parseGraph("a -> b")
statements = parseStatements("x\na -> b")

The return format consists of plain lists and arrays for direct conversion to JSON.

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

pgformat-0.1.1.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

pgformat-0.1.1-py2.py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 2 Python 3

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