

def graph(self, argstr, i):
    "\n        Parse trig graph, i.e.\n\n           <urn:graphname> = { .. triples .. }\n\n        return -1 if it doesn't look like a graph-decl\n        raise Exception if it looks like a graph, but isn't.\n        "
    j = self.sparqlTok('GRAPH', argstr, i)
    if (j >= 0):
        i = j
    r = []
    j = self.labelOrSubject(argstr, argstr, r)
    if (j >= 0):
        graph = r[0]
        i = j
    else:
        graph = self._store.graph.identifier
    j = self.skipSpace(argstr, i)
    if (j < 0):
        self.BadSyntax(argstr, i, 'EOF found when expected graph')
    if (argstr[j:(j + 1)] == '='):
        i = self.skipSpace(argstr, (j + 1))
        if (i < 0):
            self.BadSyntax(argstr, i, "EOF found when expecting '{'")
    else:
        i = j
    if (argstr[i:(i + 1)] != '{'):
        return (- 1)
    j = (i + 1)
    oldParentContext = self._parentContext
    self._parentContext = self._context
    reason2 = self._reason2
    self._reason2 = becauseSubGraph
    self._context = self._store.newGraph(graph)
    while 1:
        i = self.skipSpace(argstr, j)
        if (i < 0):
            self.BadSyntax(argstr, i, "needed '}', found end.")
        if (argstr[i:(i + 1)] == '}'):
            j = (i + 1)
            break
        j = self.directiveOrStatement(argstr, i)
        if (j < 0):
            self.BadSyntax(argstr, i, "expected statement or '}'")
    self._context = self._parentContext
    self._reason2 = reason2
    self._parentContext = oldParentContext
    return j

dataset/ETHPy150Open RDFLib/rdflib/rdflib/plugins/parsers/trig.py TrigSinkParser.graph/VarMisuse@56/161 `i`->`argstr`