Exemplo n.º 1
0
def batch_import(filename):
    graph = get_graph()

    # Make sure the DB has the appropriate global functions loaded.
    with open(get_project_filename('gremlin/setup.gremlin')) as setup_file:
        graph.gremlin_query(setup_file.read())

    with open(filename) as data_file:
        queue = []
        for line in data_file:
            queue.append(line.decode('utf-8'))
            if len(queue) >= 50:
                run_in_db(graph, u''.join(queue))
                queue = []
        run_in_db(graph, u''.join(queue))
Exemplo n.º 2
0
def batch_import(filename):
    graph = get_graph()
    
    # Make sure the DB has the appropriate global functions loaded.
    with open(get_project_filename('gremlin/setup.gremlin')) as setup_file:
        graph.gremlin_query(setup_file.read())

    with open(filename) as data_file:
        queue = []
        for line in data_file:
            queue.append(line.decode('utf-8'))
            if len(queue) >= 50:
                run_in_db(graph, u''.join(queue))
                queue = []
        run_in_db(graph, u''.join(queue))
Exemplo n.º 3
0
from flask import request
from flask import send_from_directory
from flask import url_for
from conceptnet5.graph import get_graph
from conceptnet5.web_interface.utils import data_url
from conceptnet5.web_interface.utils import uri2name

########################
# Set this flag to True when developing, False otherwise! -JVen
#
DEVELOPMENT = True
#
########################

app = Flask(__name__)
conceptnet = get_graph()

if DEVELOPMENT:
  web_route = '/web/'
else:
  web_route = '/'

@app.route('/favicon.ico')
def favicon():
    return send_from_directory(
        os.path.join(app.root_path, 'static', 'img'), 'favicon.ico',
        mimetype='image/vnd.microsoft.icon')

@app.route('/')
def home():
    return render_template('home.html')