def setUp(self): TestCase.setUp(self) files = [find_first_fixture(f) for f in self.kbfixtures] fourstore_setup(self.kbname) fourstore_backend(self.kbname) fourstore_import(self.kbname, files) fourstore_httpd(self.kbname, self.port) settings.SPARQL_ENDPOINT = "http://localhost:%d/sparql/" % self.port
def handle(self, *args, **options): try: files = get_rdf_files(args, recursive=options["recursive"]) if not files: raise CommandError("You must specify at least one valid RDF file.") fourstore_setup(settings.FOURSTORE_KBNAME) fourstore_backend(settings.FOURSTORE_KBNAME) fourstore_import(settings.FOURSTORE_KBNAME, files) except AttributeError: raise CommandError("You must set FOURSTORE_KBNAME and FOURSTORE_PORT in your settings.py.") except OSError: raise CommandError("Please ensure 4store is installed and accessible in $PATH.") finally: fourstore_kill(settings.FOURSTORE_KBNAME, settings.FOURSTORE_PORT)