Skip to content

Commit

Permalink
Merge 6732c51 into 9da21db
Browse files Browse the repository at this point in the history
  • Loading branch information
mwatts15 authored Jun 18, 2018
2 parents 9da21db + 6732c51 commit 3e789e2
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,7 @@
import logging
logger = logging.getLogger(__name__)

# import md5
import random
import warnings

from hashlib import md5


from rdflib.namespace import RDF, RDFS, SKOS

Expand All @@ -267,7 +262,6 @@
import tempfile

from six import BytesIO
from six import b
from six.moves.urllib.parse import urlparse

__all__ = [
Expand Down Expand Up @@ -394,11 +388,14 @@ def add(self, triple):
def addN(self, quads):
"""Add a sequence of triple with context"""

self.__store.addN((s, p, o, c) for s, p, o, c in quads
if isinstance(c, Graph)
and c.identifier is self.identifier
and _assertnode(s,p,o)
)
triples_stored = self.__store.addN((s, p, o, c) for s, p, o, c in quads
if isinstance(c, Graph)
and c.identifier is self.identifier
and _assertnode(s, p, o)
)
if triples_stored is None:
return -1
return triples_stored

def remove(self, triple):
"""Remove a triple from the graph
Expand Down Expand Up @@ -1348,14 +1345,16 @@ def _graph(self, c):
else:
return c


def addN(self, quads):
"""Add a sequence of triples with context"""

self.store.addN(
triples_stored = self.store.addN(
(s, p, o, self._graph(c)) for s, p, o, c in quads if
_assertnode(s, p, o)
)
if triples_stored is None:
return -1
return triples_stored

def remove(self, triple_or_quad):
"""
Expand Down Expand Up @@ -1685,12 +1684,15 @@ def add(self, triple):
def addN(self, quads):
"""Add a sequence of triple with context"""

self.store.addN(
triples_stored = self.store.addN(
(s, p, o, c) for s, p, o, c in quads
if isinstance(c, QuotedGraph)
and c.identifier is self.identifier
and _assertnode(s, p, o)
)
if triples_stored is None:
return -1
return triples_stored

def n3(self):
"""Return an n3 identifier for the Graph"""
Expand Down

0 comments on commit 3e789e2

Please sign in to comment.