Exemple #1
0
def gen_cql_env(configuration, experiment_conf, output):
    '''
    Generate environment files for StremPref
    '''
    text = get_register_stream(configuration, experiment_conf)
    query_dir = get_query_dir(configuration, experiment_conf)
    # Environment files for equivalent CQL queries
    filename = query_dir + os.sep + 'table_ots.cql'
    text += REG_Q_STR.format(qname='table_ots', qfile=filename)
    filename = query_dir + os.sep + 'stream_ots.cql'
    text += REG_Q_STR.format(qname='stream_ots', qfile=filename)
    filename = query_dir + os.sep + 'z.cql'
    text += REG_Q_STR.format(qname='z', qfile=filename)
    filename = query_dir + os.sep + 'z_prime.cql'
    text += REG_Q_STR.format(qname='z_prime', qfile=filename)
    filename = query_dir + os.sep + 'p_start.cql'
    text += REG_Q_STR.format(qname='p_start', qfile=filename)
    filename = query_dir + os.sep + 'p_end.cql'
    text += REG_Q_STR.format(qname='p_end', qfile=filename)
    filename = query_dir + os.sep + 'p_start_end.cql'
    text += REG_Q_STR.format(qname='p_start_end', qfile=filename)
    # Final equivalent query
    filename = query_dir + os.sep + 'equiv.cql'
    if output:
        # Get output filename
        out_file = get_out_file(configuration, experiment_conf)
        text += REG_Q_OUTPUT_STR.format(qname='equiv', qfile=filename,
                                        ofile=out_file)
    else:
        text += REG_Q_STR.format(qname='equiv', qfile=filename)
    filename = get_env_file(configuration, experiment_conf)
    write_to_txt(filename, text)
Exemple #2
0
def gen_endseq_env(configuration, experiment_conf, output):
    '''
    Generate environment files for ENDSEQ operator
    '''
    text = get_register_stream(configuration, experiment_conf)
    # Get query filename
    query_dir = get_query_dir(configuration, experiment_conf)
    filename = query_dir + os.sep + 'endseq.cql'
    # Register query
    if output:
        # Get output filename
        out_file = get_out_file(configuration, experiment_conf)
        text += REG_Q_OUTPUT_STR.format(qname='endseq', qfile=filename,
                                        ofile=out_file)
    else:
        text += REG_Q_STR.format(qname='endseq', qfile=filename)
    # Get environment filename
    filename = get_env_file(configuration, experiment_conf)
    write_to_txt(filename, text)
Exemple #3
0
def gen_cql_env(configuration, experiment_conf, output):
    '''
    Generate environment files for StremPref
    '''
    text = get_register_stream(configuration, experiment_conf)
    query_dir = get_query_dir(configuration, experiment_conf)
    # Environment files for equivalent CQL queries
    # RPOS
    filename = query_dir + os.sep + 'rpos.cql'
    text += REG_Q_STR.format(qname='rpos', qfile=filename)
    # SPOS
    filename = query_dir + os.sep + 'spos.cql'
    text += REG_Q_STR.format(qname='spos', qfile=filename)
    # W
    filename = query_dir + os.sep + 'w.cql'
    text += REG_Q_STR.format(qname='w', qfile=filename)
    # W1 and P1
    filename = query_dir + os.sep + 'w1.cql'
    text += REG_Q_STR.format(qname='w1', qfile=filename)
    filename = query_dir + os.sep + 'p1.cql'
    text += REG_Q_STR.format(qname='p1', qfile=filename)
    # W_i and P_i
    range_value = experiment_conf[RAN]
    for pos in range(2, range_value + 1):
        filename = query_dir + os.sep + 'w' + str(pos) + '.cql'
        text += REG_Q_STR.format(qname='w' + str(pos), qfile=filename)
        filename = query_dir + os.sep + 'p' + str(pos) + '.cql'
        text += REG_Q_STR.format(qname='p' + str(pos), qfile=filename)
    # Final equivalent query
    filename = query_dir + os.sep + 'equiv.cql'
    if output:
        # Get output filename
        out_file = get_out_file(configuration, experiment_conf)
        text += REG_Q_OUTPUT_STR.format(qname='equiv',
                                        qfile=filename,
                                        ofile=out_file)
    else:
        text += REG_Q_STR.format(qname='equiv', qfile=filename)
    filename = get_env_file(configuration, experiment_conf)
    write_to_txt(filename, text)
Exemple #4
0
def gen_cql_env(configuration, experiment_conf, output):
    '''
    Generate environment files for StremPref
    '''
    # Register stream
    text = get_register_stream(configuration,
                               experiment_conf,
                               include_tup=True)
    query_dir = get_query_dir(configuration, experiment_conf)
    filename = query_dir + os.sep + 'z.cql'
    text += REG_Q_STR.format(qname='z', qfile=filename)
    filename = query_dir + os.sep + 'p_join.cql'
    text += REG_Q_STR.format(qname='p_join', qfile=filename)
    filename = query_dir + os.sep + 'p.cql'
    text += REG_Q_STR.format(qname='p', qfile=filename)
    text += gen_reg_rules_queries(configuration, query_dir, experiment_conf)
    query_name = 't1'
    filename = query_dir + os.sep + query_name + '.cql'
    text += REG_Q_STR.format(qname=query_name, qfile=filename)
    level = experiment_conf[LEV]
    for number in range(2, level + 1):
        query_name = 't' + str(number)
        filename = query_dir + os.sep + query_name + '.cql'
        text += REG_Q_STR.format(qname=query_name, qfile=filename)
    query_name = 'id'
    filename = query_dir + os.sep + query_name + '.cql'
    text += REG_Q_STR.format(qname=query_name, qfile=filename)
    query_name = 'equiv'
    filename = query_dir + os.sep + query_name + '.cql'
    if output:
        # Get output filename
        out_file = get_out_file(configuration, experiment_conf)
        text += REG_Q_OUTPUT_STR.format(qname=query_name,
                                        qfile=filename,
                                        ofile=out_file)
    else:
        text += REG_Q_STR.format(qname=query_name, qfile=filename)
    # Get environment filename
    filename = get_env_file(configuration, experiment_conf)
    write_to_txt(filename, text)