diff bin/rdfdb @ 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 3ca103d97f98
children 30c79f1dc4f8
line wrap: on
line diff
--- 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)