Changeset - c20c2eea6fce
[Not reviewed]
default
0 2 0
Drew Perttula - 12 years ago 2013-06-11 20:25:02
drewp@bigasterisk.com
another hack to stop graphfile from thinking its own new empty file means it should delete all the statements in that context
Ignore-this: 94639afbbe8d3a0abd8a06e16922394f
2 files changed with 11 insertions and 1 deletions:
0 comments (0 inline, 0 general)
bin/subcomposer
Show inline comments
 
@@ -145,7 +145,7 @@ class Subcomposer(tk.Frame):
 
        addQuads = [(repl(s), p, repl(o), newUri) for s,p,o,c in delQuads]
 
        # patch can't span contexts yet
 
        self.graph.patch(Patch(addQuads=addQuads, delQuads=[]))
 
        #self.graph.patch(Patch(addQuads=[], delQuads=delQuads))
 
        self.graph.patch(Patch(addQuads=[], delQuads=delQuads))
 
        
 
        
 
    def setupSubChoiceLinks(self):
light9/rdfdb/graphfile.py
Show inline comments
 
@@ -29,6 +29,7 @@ class GraphFile(object):
 
            except OSError:
 
                pass
 
            f = open(path, "w")
 
            f.write("#new\n")
 
            f.close()
 
            iolog.info("%s created", path)
 
            self.lastWriteTimestamp = os.path.getmtime(path)
 
@@ -89,6 +90,15 @@ class GraphFile(object):
 
        old = self.getSubgraph(self.uri)
 
        new = Graph()
 
        try:
 
            contents = open(self.path).read()
 
            if contents.startswith("#new"):
 
                log.debug("%s ignoring empty contents of my new file", self.path)
 
                # this is a new file we're starting, and we should not
 
                # patch our graph as if it had just been cleared. We
 
                # shouldn't even be here reading this, but
 
                # lastWriteTimestamp didn't work.
 
                return
 

	
 
            new.parse(location=self.path, format='n3')
 
        except SyntaxError as e:
 
            print e
0 comments (0 inline, 0 general)