An open API service indexing awesome lists of open source software.

https://github.com/jhb/paragraph

graph management system for labeled property graphs
https://github.com/jhb/paragraph

flask graph-database neo4j python ui zodb

Last synced: 3 months ago
JSON representation

graph management system for labeled property graphs

Awesome Lists containing this project

README

        

# paragraph
cms for labeled property graphs

Usage example from neo4j:

>>> from paragraph.NeoGraphDB import NeoGraphDB
>>> db = NeoGraphDB()
>>> alice = db.add_node('Person', name='alice')

Alice is a node. Nodes have a unique id and labels:

>>> alice
(Person ... alice)

But a note also stores properties like a dictionary:

>>> dict(alice)
{'_id': '...', 'name': 'alice'}
>>> alice.id == alice['_id']
True

Why does id show up in the node properties, but not the labels? Because at least for neo4j labels
are stored on nodes anyhow, but id needs to be stored "manually", hence the property with the
special marker for technical attributes, the underscore "_".

Now lets link alice to bob:

>>> bob = db.add_node('Person', name='bob')
>>> edge = db.add_edge(alice, 'friend_of', bob, foo='bar')
>>> edge.id
'...'
>>> edge.source == alice
True
>>> edge.target == bob
True
>>> edge.reltype
'friend_of'

And again, all other properties are stored dictionary-style in the edge:

>>> edge
(Person ... alice) --[friend_of]--> (Person ... bob)
>>> dict(edge)
{'_id': '...', 'foo': 'bar'}

Lets move from alice one hop outwards:

>>> nodes = alice.oN('friend_of').nodes
>>> nodes == {bob}
True