|
@@ -283,7 +283,6 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
|
|
|
|
:param rdflib.URIRef graph: URI of the named graph to add.
|
|
:param rdflib.URIRef graph: URI of the named graph to add.
|
|
"""
|
|
"""
|
|
- logger.exception('Called add_graph.')
|
|
|
|
cdef:
|
|
cdef:
|
|
lmdb.MDB_txn *_txn
|
|
lmdb.MDB_txn *_txn
|
|
Buffer _sc
|
|
Buffer _sc
|
|
@@ -293,17 +292,17 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
c = c.identifier
|
|
c = c.identifier
|
|
|
|
|
|
ck = self.to_key(c)
|
|
ck = self.to_key(c)
|
|
- if not self._key_exists(<unsigned char*>ck, KLEN, b'c:'):
|
|
|
|
|
|
+ if not self._key_exists(<unsigned char*>&ck, KLEN, b'c:'):
|
|
# Insert context term if not existing.
|
|
# Insert context term if not existing.
|
|
if self.is_txn_rw:
|
|
if self.is_txn_rw:
|
|
|
|
+ #logger.debug('Working in existing RW transaction.')
|
|
_txn = self.txn
|
|
_txn = self.txn
|
|
else:
|
|
else:
|
|
|
|
+ #logger.debug('Opening a temporary RW transaction.')
|
|
_check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &_txn))
|
|
_check(lmdb.mdb_txn_begin(self.dbenv, NULL, 0, &_txn))
|
|
# Open new R/W transactions.
|
|
# Open new R/W transactions.
|
|
- #logger.debug('Opening a temporary RW transaction.')
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
- #logger.debug('Working in existing RW transaction.')
|
|
|
|
# Add to list of contexts.
|
|
# Add to list of contexts.
|
|
key_v.mv_data = &ck
|
|
key_v.mv_data = &ck
|
|
key_v.mv_size = KLEN
|
|
key_v.mv_size = KLEN
|
|
@@ -314,6 +313,9 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
))
|
|
))
|
|
if not self.is_txn_rw:
|
|
if not self.is_txn_rw:
|
|
_check(lmdb.mdb_txn_commit(_txn))
|
|
_check(lmdb.mdb_txn_commit(_txn))
|
|
|
|
+ # Kick the main transaction to see the new terms.
|
|
|
|
+ lmdb.mdb_txn_reset(self.txn)
|
|
|
|
+ _check(lmdb.mdb_txn_renew(self.txn))
|
|
except:
|
|
except:
|
|
if not self.is_txn_rw:
|
|
if not self.is_txn_rw:
|
|
lmdb.mdb_txn_abort(_txn)
|
|
lmdb.mdb_txn_abort(_txn)
|
|
@@ -343,7 +345,7 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
try:
|
|
try:
|
|
spok_v.mv_size = TRP_KLEN
|
|
spok_v.mv_size = TRP_KLEN
|
|
# If context was specified, remove only associations with that context.
|
|
# If context was specified, remove only associations with that context.
|
|
- match_set.seek()
|
|
|
|
|
|
+ match_set.keys.seek()
|
|
if context is not None:
|
|
if context is not None:
|
|
ck_v.mv_data = &ck
|
|
ck_v.mv_data = &ck
|
|
ck_v.mv_size = KLEN
|
|
ck_v.mv_size = KLEN
|
|
@@ -622,7 +624,9 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
_check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET))
|
|
_check(lmdb.mdb_cursor_get(cur, &key_v, &data_v, lmdb.MDB_SET))
|
|
while True:
|
|
while True:
|
|
c_uri = self.from_key((<Key*>data_v.mv_data)[0])
|
|
c_uri = self.from_key((<Key*>data_v.mv_data)[0])
|
|
- contexts.append(rdflib.Graph(self, uri=c_uri, store=self))
|
|
|
|
|
|
+ contexts.append(
|
|
|
|
+ Graph(self, uri=c_uri)
|
|
|
|
+ )
|
|
try:
|
|
try:
|
|
_check(lmdb.mdb_cursor_get(
|
|
_check(lmdb.mdb_cursor_get(
|
|
cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
|
|
cur, &key_v, &data_v, lmdb.MDB_NEXT_DUP))
|
|
@@ -739,7 +743,7 @@ cdef class LmdbTriplestore(BaseLmdbStore):
|
|
data_v.mv_size = TRP_KLEN
|
|
data_v.mv_size = TRP_KLEN
|
|
|
|
|
|
flt_res = Graph(self, res.capacity, uri=uri)
|
|
flt_res = Graph(self, res.capacity, uri=uri)
|
|
- res.seek()
|
|
|
|
|
|
+ res.keys.seek()
|
|
while res.keys.get_next(&spok):
|
|
while res.keys.get_next(&spok):
|
|
data_v.mv_data = spok
|
|
data_v.mv_data = spok
|
|
try:
|
|
try:
|