1. gweis
  2. ordf

Commits

w...@styx.org  committed da87522

better support for virtuoso store

  • Participants
  • Parent commits c347a63
  • Branches default

Comments (0)

Files changed (3)

File ordf/command.py

View file
     parser.add_option("--reindex", action="store_true",
                        dest="reindex", default=False,
                        help="Reindex indices reading from a single reader")
-
+    parser.add_option("--nocs", action="store_true",
+                      dest="nocs", default=False,
+                      help="Do not process changesets")
     def parse_config(self):
         super(ORDF, self).parse_config()
 
         if self.options.writers:
             self.config["ordf.writers"] = self.options.writers
 
-        if self.options.save and not self.options.message:
-            self.parser.print_help()
-            print "ERROR: missing log message"
-            exit(1)
+        if not self.options.nocs:
+            if self.options.save or self.options.remove:
+                if not self.options.message:
+                    self.parser.print_help()
+                    print "ERROR: missing log message"
+                    exit(1)
 
         if self.options.reindex:
             reader = self.config.get("ordf.readers")
                 user = self.options.user
             else:
                 user = getuser()
-            ctx = self.handler.context(user, self.options.message)
+
+            if not self.options.nocs:
+                ctx = self.handler.context(user, self.options.message)
 
             agent = Agent()
             agent.nick(Literal(user))
                     proc.result(g)
 
                     self.log.info("add %s" % (g.identifier,))
+                    if self.options.nocs:
+                        self.handler.put(g)
+
                 elif self.options.remove:
                     self.log.info("del %s" % (g.identifier,))
+                    if self.options.nocs:
+                        self.handler.remove(g)
 
-                ctx.add(g)
+                if not self.options.nocs:
+                    ctx.add(g)
 
-            self.log.info("commit changes")
-            cs = ctx.commit()
+            if not self.options.nocs:
+                self.log.info("commit changes")
+                cs = ctx.commit()
+
         elif self.options.reindex:
             reader = getattr(self.handler, self.reindex_reader)
             for graph in reader:

File ordf/handler/rdf.py

View file
         old.remove((None, None, None))
         for statement in g.triples((None, None, None)):
             old.add(statement)
+        self.store.commit()
         if hasattr(self.store, "sync"):
             self.store.sync()
     def __delitem__(self, k):
         old = Graph(self.store, identifier=get_identifier(k))
         old.remove((None, None, None))
+        self.store.commit()
         if hasattr(self.store, "sync"):
             self.store.sync()
 

File ordf/vocab/fresnel.py

View file
         self._compiled = True
 
         for l in self.distinct_subjects(RDF["type"], FRESNEL["Lens"]):
-            log.debug("Compile: %s" % l)
             lens = Lens(fresnel=self, identifier=l) 
             lens += self.bnc((l, None, None))
             self.lenses[l] = lens
-            log.debug("XXX\n%s" % lens.serialize(format="n3"))
             for cls in lens.objects(l, FRESNEL["classLensDomain"]):
                 self.classLenses[cls] = lens
             for cls in lens.objects(l, FRESNEL["instanceLensDomain"]):