view rdfdb/syncedgraph.py @ 89:1120c6489888

refactor, redo the SyncedGraph class ordering, fix most typing errors
author drewp@bigasterisk.com
date Tue, 05 Apr 2022 00:54:53 -0700
parents a96f4eb95ef0
children
line wrap: on
line source

"""
client code uses a SyncedGraph, which has a few things:

AutoDepGraphApi - knockoutjs-inspired API for querying the graph in a
way that lets me call you again when there were changes to the things
you queried

CurrentStateGraphApi - a way to query the graph that doesn't gather
your dependencies like AutoDepGraphApi does

GraphEditApi - methods to write patches to the graph for common
operations, e.g. replacing a value, or editing a mapping

WsClientProtocol one connection with the rdfdb server.
"""

from typing import Optional
from rdfdb.autodepgraphapi import AutoDepGraphApi
from rdfdb.grapheditapi import GraphEditApi
# everybody who writes literals needs to get this
from rdfdb.rdflibpatch_literal import patch
from rdfdb.syncedgraph_base import SyncedGraphBase
from rdflib import URIRef
patch()


class SyncedGraph(AutoDepGraphApi, GraphEditApi):
    '''
    SyncedGraphBase
       |       |
    CurState AutoDep
       |       |
    GraphEdit  |
          |    |
       SyncedGraph
    '''
    def __init__(self, rdfdbRoot: URIRef, label: str, receiverHost: Optional[str] = None):
        SyncedGraphBase.__init__(self, rdfdbRoot, label, receiverHost)
        AutoDepGraphApi.__init__(self)