pyshacl/monkey/memory2.py
def add(self, triple, context, quoted=False):
        """\
        Add a triple to the store of triples.
        """
        # add dictionary entries for spo[s][p][p] = 1 and pos[p][o][s]
        # = 1, creating the nested dictionaries where they do not yet
        # exits.
        Store.add(self, triple, context, quoted=quoted)
        if context is not None:
            self.__all_contexts.add(context)
        subject, predicate, object_ = triple
        self.__add_triple_context(triple, context, quoted)

        spo = self.__spo
        try:
            po = spo[subject]
        except LookupError:
            po = spo[subject] = {}
        try:
            o = po[predicate]
        except LookupError:
            o = po[predicate] = {}
        o[object_] = 1

        pos = self.__pos
        try:
            os = pos[predicate]
        except LookupError:
            os = pos[predicate] = {}
        try:
            s = os[object_]
        except LookupError:
            s = os[object_] = {}
        s[subject] = 1

        osp = self.__osp
        try:
            sp = osp[object_]
        except LookupError:
            sp = osp[object_] = {}
        try:
            p = sp[subject]
        except LookupError:
            p = sp[subject] = {}
        p[predicate] = 1
\
        Add a triple to the store of triples.
        
\
Add a triple to the store of triples.
\ Add a triple to the store of triples .
def add(self, triple, context, quoted=False):
        Store.add(self, triple, context, quoted=quoted)
        if context is not None:
            self.__all_contexts.add(context)
        subject, predicate, object_ = triple
        self.__add_triple_context(triple, context, quoted)
        spo = self.__spo
        try:
            po = spo[subject]
        except LookupError:
            po = spo[subject] = {}
        try:
            o = po[predicate]
        except LookupError:
            o = po[predicate] = {}
        o[object_] = 1
        pos = self.__pos
        try:
            os = pos[predicate]
        except LookupError:
            os = pos[predicate] = {}
        try:
            s = os[object_]
        except LookupError:
            s = os[object_] = {}
        s[subject] = 1
        osp = self.__osp
        try:
            sp = osp[object_]
        except LookupError:
            sp = osp[object_] = {}
        try:
            p = sp[subject]
        except LookupError:
            p = sp[subject] = {}
        p[predicate] = 1
def add ( self , triple , context , quoted = False ) : Store . add ( self , triple , context , quoted = quoted ) if context is not None : self . __all_contexts . add ( context ) subject , predicate , object_ = triple self . __add_triple_context ( triple , context , quoted ) spo = self . __spo try : po = spo [ subject ] except LookupError : po = spo [ subject ] = { } try : o = po [ predicate ] except LookupError : o = po [ predicate ] = { } o [ object_ ] = 1 pos = self . __pos try : os = pos [ predicate ] except LookupError : os = pos [ predicate ] = { } try : s = os [ object_ ] except LookupError : s = os [ object_ ] = { } s [ subject ] = 1 osp = self . __osp try : sp = osp [ object_ ] except LookupError : sp = osp [ object_ ] = { } try : p = sp [ subject ] except LookupError : p = sp [ subject ] = { } p [ predicate ] = 1
\
Add a triple to the store of triples.
\ Add a triple to the store of triples .
"""\
        Add a triple to the store of triples.
        """ # add dictionary entries for spo[s][p][p] = 1 and pos[p][o][s] # = 1, creating the nested dictionaries where they do not yet # exits.
self
triple
context
quoted