Skip to content

Commit

Permalink
added atomic graphs experimental to the update routine
Browse files Browse the repository at this point in the history
  • Loading branch information
Simaris committed Mar 8, 2020
1 parent f436e7e commit 6ca30ca
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions quit/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rdflib import Graph, ConjunctiveGraph, URIRef
from rdflib.graph import ModificationException
from rdflib.graph import Path
from atomicgraphs.comp_graph import ComparableGraph


class RewriteGraph(Graph):
Expand Down Expand Up @@ -117,6 +118,19 @@ def __repr__(self):
len((c for c in self.graphs() if c not in self.store.contexts()))
)

def update(self, update_object):
comp_graphA = ComparableGraph(self.store)
comp_graphB = ComparableGraph(self.store)
answer = comp_graphB.update(update_object)
diff_tupel = comp_graphA.diff(comp_graphB)
for removeGraph in diff_tupel[1]:
for triple in removeGraph:
self.remove(triple)
for additionalGraph in diff_tupel[0]:
for triple in additionalGraph:
self.add(additionalGraph)
return answer

def _graph(self, c):
if c is None:
return None
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Flask-Cors
pygit2>=1.0.0
sortedcontainers
uritools
git+https://github.com/Simaris/Atomic-Graph@master
git+https://github.com/RDFLib/rdflib-jsonld@master

uwsgi
Expand Down
15 changes: 15 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[pycodestyle]
format = pylint
exclude = tests/*,quit/tools/*
count = False
ignore = E402
max-line-length = 100

[pylava]
format = pylint
skip = tests/*,quit/tools/*
linters = pep8
ignore = E402

[pylava:pep8]
max_line_length = 100

0 comments on commit 6ca30ca

Please sign in to comment.