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
- Host: GitHub
- URL: https://github.com/jhb/paragraph
- Owner: jhb
- License: other
- Created: 2020-04-24T09:01:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-07T07:55:17.000Z (over 4 years ago)
- Last Synced: 2025-02-24T07:58:57.900Z (3 months ago)
- Topics: flask, graph-database, neo4j, python, ui, zodb
- Language: Python
- Homepage:
- Size: 1.28 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# paragraph
cms for labeled property graphsUsage 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']
TrueWhy 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