Exemple #1
0
 def test_repopulate(self):
     self.cache.populate()
     set_metadata_cache(self.cache)
     self.cache.delete()
     self.cache.populate()
     title = get_metadata('title', 30929)
     self.assertIn('Het loterijbriefje', title)
Exemple #2
0
 def test_repopulate(self):
     self.cache.populate()
     set_metadata_cache(self.cache)
     self.cache.delete()
     self.cache.populate()
     title = get_metadata('title', 30929)
     self.assertIn('Het loterijbriefje', title)
Exemple #3
0
 def test_read_deleted_cache(self):
     self.cache.populate()
     set_metadata_cache(self.cache)
     self.cache.delete()
     try:
         get_metadata('title', 50405)
     except InvalidCacheException:
         pass
 def test_read_unpopulated_cache(self):
     set_metadata_cache(self.cache)
     try:
         get_metadata('title', 50405)
     except InvalidCacheException:
         pass
     except:
         raise
 def test_read_deleted_cache(self):
     self.cache.populate()
     set_metadata_cache(self.cache)
     self.cache.delete()
     try:
         get_metadata('title', 50405)
     except InvalidCacheException:
         pass
Exemple #6
0
 def test_read_unpopulated_cache(self):
     set_metadata_cache(self.cache)
     try:
         get_metadata('title', 50405)
     except InvalidCacheException:
         pass
     except:
         raise
    def test_refresh(self):
        self.cache.populate()
        set_metadata_cache(self.cache)
        title = get_metadata('title', 30929)
        self.assertIn(u('Het loterijbriefje'), title)

        self.cache.refresh()
        title = get_metadata('title', 30929)
        self.assertIn(u('Het loterijbriefje'), title)
Exemple #8
0
    def test_refresh(self):
        self.cache.populate()
        set_metadata_cache(self.cache)
        title = get_metadata('title', 30929)
        self.assertIn(u('Het loterijbriefje'), title)

        self.cache.refresh()
        title = get_metadata('title', 30929)
        self.assertIn(u('Het loterijbriefje'), title)
Exemple #9
0
 def tearDown(self):
     set_metadata_cache(None)
     self.cache.delete()
Exemple #10
0
 def setUp(self):
     self.cache = _SleepycatMetadataCacheForTesting(self.sample_data, 'nt')
     self.cache.populate()
     set_metadata_cache(self.cache)
Exemple #11
0
 def tearDown(self):
     set_metadata_cache(None)
     if self.cache.is_open:
         self.cache.delete()
     self.cache = None
Exemple #12
0
 def tearDown(self):
     set_metadata_cache(None)
     if self.cache.is_open:
         self.cache.delete()
     self.cache = None
Exemple #13
0
 def tearDown(self):
     set_metadata_cache(None)
     self.cache.delete()
Exemple #14
0
 def setUp(self):
     self.cache = _SleepycatMetadataCacheForTesting(self.sample_data, 'nt')
     self.cache.populate()
     set_metadata_cache(self.cache)
Exemple #15
0
def load_cache():
    cache = SqliteMetadataCache('C:/Users/Laszlo/Desktop/Unshrederator2/cache/cache.sqlite')
    cache.populate()
    set_metadata_cache(cache)
Exemple #16
0
        return URIRef(value)


class LanguageExtractor(_SimplePredicateRelationshipExtractor):
    """Extracts book languages.

    """
    @classmethod
    def feature_name(cls):
        return 'language'

    @classmethod
    def predicate(cls):
        return DCTERMS.language / RDF.value

    @classmethod
    def contains(cls, value):
        return Literal(value)


if __name__ == '__main__':
    from gutenberg.acquire.metadata import set_metadata_cache, SleepycatMetadataCache
    cache = SleepycatMetadataCache('/Users/deanjones/gutenberg_data')
    set_metadata_cache(cache)

    from gutenberg.query import get_etexts
    # texts = gutenberg.query.api.get_etexts('language', 'en')
    # print len(texts)

    print get_etexts('language', 'en')