Mercurial > code > home > repos > light9
changeset 1559:1ba1d46a70a2
put song: prefix into song files
Ignore-this: 50e8d3947e925aa3edff31ed9d893b50
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Wed, 24 May 2017 08:26:39 +0000 |
parents | 7eb3676b8fd6 |
children | e993c5e1df1a |
files | bin/effecteval bin/rdfdb light9/rdfdb/graphfile.py light9/rdfdb/syncedgraph.py |
diffstat | 4 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/effecteval Tue May 23 06:58:02 2017 +0000 +++ b/bin/effecteval Wed May 24 08:26:39 2017 +0000 @@ -68,6 +68,7 @@ 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):
--- a/bin/rdfdb Tue May 23 06:58:02 2017 +0000 +++ b/bin/rdfdb Wed May 24 08:26:39 2017 +0000 @@ -180,9 +180,10 @@ 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 @@ 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 @@ 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 @@ """ 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 @@ 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)
--- a/light9/rdfdb/graphfile.py Tue May 23 06:58:02 2017 +0000 +++ b/light9/rdfdb/graphfile.py Wed May 24 08:26:39 2017 +0000 @@ -63,7 +63,7 @@ """ 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 @@ '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
--- a/light9/rdfdb/syncedgraph.py Tue May 23 06:58:02 2017 +0000 +++ b/light9/rdfdb/syncedgraph.py Wed May 24 08:26:39 2017 +0000 @@ -126,7 +126,6 @@ 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):