Mercurial > code > home > repos > rdferry
view README.md @ 12:ba73d8ba81dc default tip
refactor
author | drewp@bigasterisk.com |
---|---|
date | Mon, 18 Mar 2024 16:51:44 -0700 |
parents | b72f4ba1345d |
children |
line wrap: on
line source
# rdferry A library for python and typescript. (Rewrites/replaces my rdfdb and patchablegraph projects) Goals: - ferry graphs of RDF statements between disk/server/browser - keep them in sync - use starlette, uvicorn, rdflib in python - use N3.js in typescript 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 statements to delete and a set to add (in one operation). ## API plans to turn into tested examples Each of these items should be a one-liner to set up. - server boilerplate with metrics and auto index page: - `svr = StarletteServer()` - `svr.serve() # if caller hasn't routed '/', serve auto index` ### py - SSE -> graph - `graph = GraphSseClient(url1)` - `await graph.finishFirstRead()` - graph -> simple served text (StaticGraph) - (part of addGraphRoutes) - graph -> SSE (GraphEvents) - `svr.addGraphRoutes('name1', graph1)` - graph -> sparql -> table - k8s json -> graph - `graph = K8sRead(type='Deploy', ns='default', name='deploy1', watch=True)` - but break this into json-fetch and jsonld-convert - mqtt json/etc -> graph - csv -> graph - `graph = FromCsv(r: csvReader)` - file -> graph -> file - `graph = WatchFile(file: Path)` - `await graph.finishFirstRead()` - `graph = WatchTree(top: Path)` - `await graph.finishFirstRead()` - multiple graphs -> readonlygraphaggregate (collector) - `graph = PatchableAggregate([graph])` - http request -> statement(s) (rdf_over_http.py) - `def handler1(stmt, requests): ...` - `svr.addRdfStatementRoute('/path1', handler1)` - `def handler2(graph, requests): ...` - `svr.addGraphInputRoute('/path2', handler2)` ### js - SSE -> graph - new GraphSseClient(url1) (graphSseClient.graph: N3.Store)