コード例 #1
0
ファイル: jobs.py プロジェクト: ec-geolink/glharvest
def export():
    """Export the repository as Turtle."""
    JOB_NAME = "EXPORT"
    logging.info("[%s] Job started.", JOB_NAME)

    s = Store(SESAME_HOST, SESAME_PORT)
    r = Repository(s, SESAME_REPOSITORY)

    # Establish the location of the export file
    # The else case will run when not running in a container
    if os.path.isdir('/www/'):
        export_filepath = '/www/exprort.ttl'
    else:
        export_filepath = 'exprort.ttl'

    with open(export_filepath, 'wb') as f:
        exported_text = r.export()
        f.write(exported_text.encode('utf-8'))