1
|
1 # rdferry
|
|
2
|
9
|
3 A library for python and typescript.
|
|
4
|
|
5 (Rewrites/replaces my rdfdb and patchablegraph projects)
|
|
6
|
|
7 Goals:
|
|
8
|
|
9 - ferry graphs of RDF statements between disk/server/browser
|
|
10 - keep them in sync
|
|
11 - use starlette, uvicorn, rdflib in python
|
|
12 - use N3.js in typescript
|
|
13
|
|
14 Throughout this doc, 'graph' means PatchableGraph, a class that holds an rdflib.ConjuntiveGraph and edits it only through patches. A patch is a set of
|
|
15 statements to delete and a set to add (in one operation).
|
|
16
|
|
17 ## API plans to turn into tested examples
|
|
18
|
|
19 Each of these items should be a one-liner to set up.
|
|
20
|
|
21 - server boilerplate with metrics and auto index page:
|
|
22 - `svr = StarletteServer()`
|
|
23 - `svr.serve() # if caller hasn't routed '/', serve auto index`
|
|
24
|
|
25 ### py
|
|
26
|
|
27 - SSE -> graph
|
|
28 - `graph = GraphSseClient(url1)`
|
|
29 - `await graph.finishFirstRead()`
|
|
30 - graph -> simple served text (StaticGraph)
|
|
31 - (part of addGraphRoutes)
|
|
32 - graph -> SSE (GraphEvents)
|
|
33 - `svr.addGraphRoutes('name1', graph1)`
|
|
34 - graph -> sparql -> table
|
|
35 - k8s json -> graph
|
|
36 - `graph = K8sRead(type='Deploy', ns='default', name='deploy1', watch=True)`
|
|
37 - but break this into json-fetch and jsonld-convert
|
|
38 - mqtt json/etc -> graph
|
|
39 - csv -> graph
|
|
40 - `graph = FromCsv(r: csvReader)`
|
|
41 - file -> graph -> file
|
|
42 - `graph = WatchFile(file: Path)`
|
|
43 - `await graph.finishFirstRead()`
|
|
44 - `graph = WatchTree(top: Path)`
|
|
45 - `await graph.finishFirstRead()`
|
|
46 - multiple graphs -> readonlygraphaggregate (collector)
|
|
47 - `graph = PatchableAggregate([graph])`
|
|
48 - http request -> statement(s) (rdf_over_http.py)
|
|
49 - `def handler1(stmt, requests): ...`
|
|
50 - `svr.addRdfStatementRoute('/path1', handler1)`
|
|
51 - `def handler2(graph, requests): ...`
|
|
52 - `svr.addGraphInputRoute('/path2', handler2)`
|
|
53
|
|
54 ### js
|
|
55
|
|
56 - SSE -> graph
|
|
57 - new GraphSseClient(url1) (graphSseClient.graph: N3.Store)
|