예제 #1
0
파일: service.py 프로젝트: kstain/SOC15F
 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)
예제 #2
0
파일: example.py 프로젝트: kstain/SOC15F
@author:  Weiyi Wang
@contact: [email protected]
@date:    11/8/2015
"""
from dblp_parser import DBLPParser
from rdf_driver import RDFDriver


"""
Level 1: Load DBLP data to RDFLib and do simple query
given a publication name, list its detailed information
"""
print("=========LEVEL 1========")
parser = DBLPParser("data/dblp_t100.xml")
parser.visit()  # Parse the data and store in python

print("Converting to rdf data..\n")
driver = RDFDriver()
driver.add_documents(parser.publications)  # Store the data to RDF format

print("Querying the detail of publication 'On Parallel Integer Sorting'")
res = driver.query_by_title('On Parallel Integer Sorting')
for row in res:
    print row

"""
Level 2:  turn the DBLP (XML) into RDF format, add query like
given author A, provide all of her co-authors together with the corresponding publication information
"""
print("\n\n=========LEVEL 2========")
예제 #3
0
파일: example.py 프로젝트: kstain/SOC15F
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'))

print('\n\n----------Querying by keywords-------------')
pprint.pprint(db.query_keywords(['multi', 'space']))

print('\n\n----------Querying by two authors-------------')