changeset 1561:e05656f00070

rdfdb graph.sequentialUri won't reuse ids even if you haven't used them in stmts yet Ignore-this: cb556ba9836041ef1ba7778081ced7a1
author Drew Perttula <drewp@bigasterisk.com>
date Wed, 24 May 2017 08:29:01 +0000
parents e993c5e1df1a
children 900c2b2ea956
files light9/rdfdb/currentstategraphapi.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/light9/rdfdb/currentstategraphapi.py	Wed May 24 08:27:47 2017 +0000
+++ b/light9/rdfdb/currentstategraphapi.py	Wed May 24 08:29:01 2017 +0000
@@ -71,7 +71,10 @@
         """
         for i in itertools.count(1):
             newUri = prefix + str(i)
-            if not list(self._graph.triples((newUri, None, None))):
+            if not list(self._graph.triples((newUri, None, None))) and newUri not in getattr(self, '_reservedSequentials', []):
+                if not hasattr(self, '_reservedSequentials'):
+                    self._reservedSequentials = set()
+                self._reservedSequentials.add(newUri)
                 return newUri