Esempio n. 1
0
class MyApplication(Application):
    def __init__(self, *args, **kargs):
      password = kargs.pop('_mypassword')
      host = kargs.pop('_myhost')
      username = kargs.pop('_username')
      database = kargs.pop('_database')
      xml_path = kargs.pop('_xmlpath')
      Application.__init__(self, *args, **kargs)
      assert not hasattr(self, '_password')
      assert not hasattr(self, '_host')
      assert not hasattr(self, '_username')
      self._db=DBLPDatabaseDriver(host=host,
                                  username=username,
                                  password=password,
                                  database=database,
                                  create_db_on_start=True)
      self._db.create_table()
      parser = DBLPParser(xml_path)
      parser.visit()
      parser.push_to_db(self._db)
Esempio n. 2
0
config = {}
with open('config.yaml', 'r') as stream:
  config=(yaml.load(stream))
  
PASSWORD= config['password']
DATABASE=config['database']
HOST=config['host']
USERNAME=config['username']

from dblp_dbdriver import DBLPDatabaseDriver
from dblp_parser import DBLPParser

import pprint

db = DBLPDatabaseDriver(host=HOST,password=PASSWORD, 
                        database=DATABASE, 
                        username=USERNAME,
                        create_db_on_start=False)
db.create_table()

parser = DBLPParser(config['xmlpath'])
parser.visit()
parser.push_to_db(db)

print('\n\n----------Listing Co-Authors-------------')
pprint.pprint(db.query_coauthor('Eike Best'))

print('\n\n----------Querying by title-------------')
pprint.pprint(db.query_by_name('Extended multi bottom-up tree transducers.'))

print('\n\n----------Querying by author-------------')
pprint.pprint(db.query_by_author('Eike Best'))