When you create a graph via
Graph(True) it is automatically synced to ZefHub.
A local-only graph can also be synced via
g | sync | run.
Synced graphs can be shared with other users.
To give other users access to your graph, you can run:
"firstname.lastname@example.org" | grant[KW.view][g] | run
email@example.com can then see your graph by its UID, i.e. they
can then run:
g = Graph("<uid here>")
where the uid can be discovered by running
Privileges that are allowed are:
KW.view: viewing (subscribing to) the graph contents.
KW.host: taking the host role of a graph.
KW.append: appending to the graph. This could be done by taking the host role or by sending merge requests.
KW.discover: seeing the graph's tags in
KW.modify_rights: changing the privileges of the graph.
To make a graph publically available, you can use:
"group:everyone" | grant[KW.view][g] | run
As sharing UIDs is tedious, you can also tag your graphs:
g | tag["secret-santa-planning"] | run
You and other users with viewing rights can then access this graph via
Unless specified, your tags will be grouped into your user namespace. If you
want to override this, you can provide a qualified name with extra
g | tag["ACME-company/secret-santa-planning"] | run
Revoking access privileges
revoke zefop is the opposite of
"firstname.lastname@example.org" | revoke[KW.view][g] | run
Appending to a shared graph
If you have subscribed to a graph that you have append-privileges, then you can directly add new facts to the graph:
g = Graph("secret-santa-planning")
(ET.Participant, RT.Name, "Krampus") | g | run
This will cause a "merge request" to be sent via the network and wait for a successful response to be received.
If many rapid updates need to be applied, you should take the host role:
for i in range(1000):
ET.Participant | g | run
Acquiring host role means that all updates are performed in-memory with maximum speed. These updates are synchronized with ZefHub in a background process. Note that only one python process can have host role at any one time.
In the future, graph tags will be made available via projects. So expect to see something similar to:
g = Graph()
g | sync["project-name"] | run
g | tag["specific-graph"] | run
g2 = Graph("project-name", "specific-graph")
g == g2