Changeset - 1ba1d46a70a2
[Not reviewed]
default
0 4 0
Drew Perttula - 8 years ago 2017-05-24 08:26:39
drewp@bigasterisk.com
put song: prefix into song files
Ignore-this: 50e8d3947e925aa3edff31ed9d893b50
4 files changed with 14 insertions and 8 deletions:
0 comments (0 inline, 0 general)
bin/effecteval
Show inline comments
 
@@ -68,6 +68,7 @@ class SongEffects(PrettyErrorHandler, cy
 

	
 
        p = yield songEffectPatch(self.settings.graph, dropped, song, event, ctx=song)
 
        self.settings.graph.patch(p)
 
        self.settings.graph.suggestPrefixes({'song': URIRef(song + '/')})
 
        
 
class SongEffectsUpdates(cyclone.websocket.WebSocketHandler):
 
    def connectionMade(self, *args, **kwargs):
bin/rdfdb
Show inline comments
 
@@ -180,9 +180,10 @@ class WatchedFiles(object):
 

	
 
    This object watches directories. Each GraphFile watches its own file.
 
    """
 
    def __init__(self, dirUriMap, patch, getSubgraph):
 
    def __init__(self, dirUriMap, patch, getSubgraph, addlPrefixes=None):
 
        self.dirUriMap = dirUriMap # {abspath : uri prefix}
 
        self.patch, self.getSubgraph = patch, getSubgraph
 
        self.addlPrefixes = addlPrefixes
 
        
 
        self.graphFiles = {} # context uri : GraphFile
 
        
 
@@ -239,7 +240,8 @@ class WatchedFiles(object):
 
            
 
        ctx = uriFromFile(self.dirUriMap, inFile)
 
        gf = GraphFile(self.notifier, inFile, ctx,
 
                       self.patch, self.getSubgraph)
 
                       self.patch, self.getSubgraph,
 
                       addlPrefixes=self.addlPrefixes)
 
        self.graphFiles[ctx] = gf
 
        log.info("%s do initial read", inFile)
 
        gf.reread()
 
@@ -262,7 +264,8 @@ class WatchedFiles(object):
 
            assert '//' not in outFile, (outFile, self.dirUriMap, ctx)
 
            log.info("starting new file %r", outFile)
 
            self.graphFiles[ctx] = GraphFile(self.notifier, outFile, ctx,
 
                                             self.patch, self.getSubgraph)
 
                                             self.patch, self.getSubgraph,
 
                                             addlPrefixes=self.addlPrefixes)
 

	
 
    def dirtyFiles(self, ctxs):
 
        """mark dirty the files that we watch in these contexts.
 
@@ -282,13 +285,13 @@ class Db(object):
 
    """
 
    the master graph, all the connected clients, all the files we're watching
 
    """
 
    def __init__(self, dirUriMap):
 
    def __init__(self, dirUriMap, addlPrefixes=None):
 
      
 
        self.clients = []
 
        self.graph = ConjunctiveGraph()
 

	
 
        self.watchedFiles = WatchedFiles(dirUriMap,
 
                                         self.patch, self.getSubgraph)
 
                                         self.patch, self.getSubgraph, addlPrefixes)
 
        
 
        self.summarizeToLog()
 

	
 
@@ -466,7 +469,8 @@ if __name__ == "__main__":
 
    log.setLevel(logging.DEBUG if options.verbose else logging.INFO)
 

	
 
    db = Db(dirUriMap={os.environ['LIGHT9_SHOW'].rstrip('/') + '/':
 
                       showconfig.showUri() + '/'})
 
                       showconfig.showUri() + '/'},
 
            addlPrefixes={'show': URIRef(showconfig.showUri() + '/')})
 

	
 
    from twisted.python import log as twlog
 
    twlog.startLogging(sys.stdout)
light9/rdfdb/graphfile.py
Show inline comments
 
@@ -63,7 +63,7 @@ class GraphFile(object):
 
    """
 
    one rdf file that we read from, write to, and notice external changes to
 
    """
 
    def __init__(self, notifier, path, uri, patch, getSubgraph):
 
    def __init__(self, notifier, path, uri, patch, getSubgraph, addlPrefixes=None):
 
        """
 
        uri is the context for the triples in this file. We assume
 
        sometimes that we're the only ones with triples in this
 
@@ -84,6 +84,8 @@ class GraphFile(object):
 
            'effect': 'http://light9.bigasterisk.com/effect/',
 
            'dev': 'http://light9.bigasterisk.com/device/',
 
        }
 
        if addlPrefixes:
 
            self.namespaces.update(addlPrefixes)
 
        
 
        if not os.path.exists(path):
 
            # can't start notify until file exists
light9/rdfdb/syncedgraph.py
Show inline comments
 
@@ -126,7 +126,6 @@ class SyncedGraph(CurrentStateGraphApi, 
 
        log.debug('patch is done %s', debugKey)
 

	
 
    def suggestPrefixes(self, prefixes):
 
        song note edit should put song: to the song uri
 
        self.addlPrefixes.update(prefixes)
 

	
 
    def sendFailed(self, result):
0 comments (0 inline, 0 general)