Skip to content
/ paragraph Public

graph management system for labeled property graphs

License

Notifications You must be signed in to change notification settings

jhb/paragraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

graph management system for labeled property graphs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published