Skip to content

Commit

Permalink
Leave original update untouched
Browse files Browse the repository at this point in the history
  • Loading branch information
white-gecko committed Jun 30, 2023
1 parent 7287bfa commit 185e385
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions quit/tools/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,15 @@ def evalInsertData(ctx: QueryContext, u: CompValue) -> dict:
# add triples
g = ctx.graph
filled = _filterNonExistingTriples(g, u.triples)
if filled:
_append(res["delta"], 'default', 'additions', filled)
u.triples = filled
_append(res["delta"], 'default', 'additions', filled)

# add quads
# u.quads is a dict of graphURI=>[triples]
for g in u.quads:
# type error: Argument 1 to "get_context" of "ConjunctiveGraph" has incompatible type "Optional[Graph]"; expected "Union[IdentifiedNode, str, None]"
cg = ctx.dataset.get_context(g) # type: ignore[arg-type]
filledq = _filterExistingTriples(cg, u.quads[g])
if filledq:
_append(res["delta"], cg.identifier, 'additions', filledq)
u.quads[g] = filledq
_append(res["delta"], cg.identifier, 'additions', filledq)

rdflib.plugins.sparql.update.evalInsertData(ctx, u)

Expand All @@ -123,19 +119,15 @@ def evalDeleteData(ctx: QueryContext, u: CompValue) -> dict:
# remove triples
g = ctx.graph
filled = _filterNonExistingTriples(g, u.triples)
if filled:
_append(res["delta"], 'default', 'removals', filled)
u.triples = filled
_append(res["delta"], 'default', 'removals', filled)

# remove quads
# u.quads is a dict of graphURI=>[triples]
for g in u.quads:
# type error: Argument 1 to "get_context" of "ConjunctiveGraph" has incompatible type "Optional[Graph]"; expected "Union[IdentifiedNode, str, None]"
cg = ctx.dataset.get_context(g)
filledq = _filterNonExistingTriples(cg, u.quads[g])
if filledq:
_append(res["delta"], cg.identifier, 'removals', filledq)
u.quads[g] = filledq
_append(res["delta"], cg.identifier, 'removals', filledq)

rdflib.plugins.sparql.update.evalDeleteData(ctx, u)

Expand Down

0 comments on commit 185e385

Please sign in to comment.