Exemple #1
0
    def _check_can_be_instantiated(cls, cache_location):
        """Pre-conditions: the cache location is the URL to a Fuseki server
        and the SPARQLWrapper library exists (transitive dependency of
        RDFlib's sparqlstore).

        """
        if not any(
                cache_location.startswith(prefix)
                for prefix in cls._CACHE_URL_PREFIXES):
            raise InvalidCacheException('cache location is not a Fuseki url')

        try:
            from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore
        except ImportError:
            raise InvalidCacheException('unable to import sparql store')
        del SPARQLUpdateStore
Exemple #2
0
    def open(self):
        """Opens an existing cache.

        """
        try:
            self.graph.open(self.cache_uri, create=False)
            self._add_namespaces(self.graph)
            self.is_open = True
        except Exception:
            raise InvalidCacheException('The cache is invalid or not created')
Exemple #3
0
 def _check_can_be_instantiated(cls):
     try:
         from bsddb import db
     except ImportError:
         try:
             from bsddb3 import db
         except ImportError:
             db = None
     if db is None:
         raise InvalidCacheException('no install of bsddb/bsddb3 found')
     del db