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
 
@@ -142,13 +142,13 @@ class Subcomposer(tk.Frame):
 
                return newUri
 
            return u
 
        delQuads = self.currentSub().allQuads()
 
        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):
 
        graph = self.graph
 
        def ann():
 
            print "currently: session=%s currentSub=%r _currentChoice=%r" % (
light9/rdfdb/graphfile.py
Show inline comments
 
@@ -26,12 +26,13 @@ class GraphFile(object):
 
            # can't start notify until file exists
 
            try:
 
                os.makedirs(os.path.dirname(path))
 
            except OSError:
 
                pass
 
            f = open(path, "w")
 
            f.write("#new\n")
 
            f.close()
 
            iolog.info("%s created", path)
 
            self.lastWriteTimestamp = os.path.getmtime(path)
 

	
 

	
 
        self.flushDelay = 2 # seconds until we have to call flush() when dirty
 
@@ -86,12 +87,21 @@ class GraphFile(object):
 

	
 
        n3 parser fails on "1.e+0" even though rdflib was emitting that itself
 
        """
 
        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
 
            traceback.print_exc()
 
            log.error("%s syntax error", self.path)
 
            return
0 comments (0 inline, 0 general)