示例#1
0
def dummy():
    """
    Dummy method
    """
    bpmn_graph = None
    image_format = None
    bpmn_figure = None
    path = None
    bpmn_diagram_to_figure(bpmn_graph, image_format)
    view(bpmn_figure)
    save(bpmn_figure, path)
示例#2
0
def apply(bpmn_graph, parameters=None, bpmn_aggreg_statistics=None):
    """
    Visualize a BPMN graph from a BPMN graph using the given parameters

    Parameters
    -----------
    bpmn_graph
        BPMN graph object
    bpmn_aggreg_statistics
        Element-wise statistics that should be represented on the BPMN graph
    parameters
        Possible parameters, of the algorithm, including:
            format -> Format of the image to render (pdf, png, svg)

    Returns
    ----------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """
    if parameters is None:
        parameters = {}
    del bpmn_aggreg_statistics

    image_format = parameters["format"] if "format" in parameters else "png"

    file_name = bpmn_diagram_to_figure(bpmn_graph,
                                       image_format,
                                       bpmn_aggreg_statistics=None)
    return file_name
示例#3
0
def apply_petri(net,
                initial_marking,
                final_marking,
                log=None,
                aggregated_statistics=None,
                parameters=None):
    """
    Visualize a BPMN graph from a Petri net, decorated with frequency, using the given parameters

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log where the replay technique should be applied
    aggregated_statistics
        (Optional) element-wise statistics calculated on the Petri net
    parameters
        Possible parameters of the algorithm, including:
            format -> Format of the image to render (pdf, png, svg)
            aggregationMeasure -> Measure to use to aggregate statistics
            pmutil.constants.PARAMETER_CONSTANT_ACTIVITY_KEY -> Specification of the activity key
            (if not concept:name)
            pmutil.constants.PARAMETER_CONSTANT_TIMESTAMP_KEY -> Specification of the timestamp key
            (if not time:timestamp)

    Returns
    -----------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """

    if parameters is None:
        parameters = {}

    image_format = parameters["format"] if "format" in parameters else "png"

    bpmn_graph, elements_correspondence, inv_el_corr, el_corr_keys_map = bpmn_converter.apply(
        net, initial_marking, final_marking)

    if aggregated_statistics is None and log is not None:
        aggregated_statistics = alignments_decoration.get_alignments_decoration(
            net, initial_marking, final_marking, log=log)

    bpmn_aggreg_statistics = None
    if aggregated_statistics is not None:
        bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
            aggregated_statistics, inv_el_corr)

    file_name = bpmn_diagram_to_figure(
        bpmn_graph,
        image_format,
        bpmn_aggreg_statistics=bpmn_aggreg_statistics)
    return file_name
示例#4
0
def apply_through_conv_greedy(bpmn_graph,
                              dfg,
                              activities_count,
                              log=None,
                              aggregated_statistics=None,
                              parameters=None):
    """
    Decorate BPMN graph through conversion to Petri net, using shortest paths in the Petri net

    Parameters
    -------------
    bpmn_graph
        BPMN graph
    dfg
        Directly-Follows graph
    activities_count
        Count of occurrences of the activities
    log
        Log object
    aggregated_statistics
        Aggregated statistics object
    parameters
        Possible parameters of the algorithm

    Returns
    -------------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """
    if parameters is None:
        parameters = {}

    del log
    del aggregated_statistics

    image_format = parameters["format"] if "format" in parameters else "png"

    net, initial_marking, final_marking, elements_correspondence, inv_elements_correspondence, el_corr_keys_map = \
        bpmn_to_petri.apply(bpmn_graph)

    spaths = vis_trans_shortest_paths.get_shortest_paths(net,
                                                         enable_extension=True)

    aggregated_statistics = vis_trans_shortest_paths.get_decorations_from_dfg_spaths_acticount(
        net, dfg, spaths, activities_count, variant="performance")

    bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
        aggregated_statistics, inv_elements_correspondence)

    file_name = bpmn_diagram_to_figure(
        bpmn_graph,
        image_format,
        bpmn_aggreg_statistics=bpmn_aggreg_statistics)
    return file_name
示例#5
0
def apply_through_conv(bpmn_graph,
                       log=None,
                       aggregated_statistics=None,
                       parameters=None):
    """
    Visualize a BPMN graph decorating it through conversion to a Petri net

    Parameters
    -----------
    bpmn_graph
        BPMN graph object
    log
        (Optional) log where the replay technique should be applied
    aggregated_statistics
        (Optional) element-wise statistics calculated on the Petri net
    parameters
        Possible parameters, of the algorithm, including:
            format -> Format of the image to render (pdf, png, svg)

    Returns
    -----------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """

    if parameters is None:
        parameters = {}

    image_format = parameters["format"] if "format" in parameters else "png"

    net, initial_marking, final_marking, elements_correspondence, inv_elements_correspondence, el_corr_keys_map = \
        bpmn_to_petri.apply(bpmn_graph)

    if aggregated_statistics is None and log is not None:
        aggregated_statistics = token_decoration.get_decorations(
            log,
            net,
            initial_marking,
            final_marking,
            parameters=parameters,
            measure="performance",
            ht_perf_method="first")

    bpmn_aggreg_statistics = None
    if aggregated_statistics is not None:
        bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
            aggregated_statistics, inv_elements_correspondence)

    file_name = bpmn_diagram_to_figure(
        bpmn_graph,
        image_format,
        bpmn_aggreg_statistics=bpmn_aggreg_statistics)
    return file_name
示例#6
0
def apply_petri(net,
                initial_marking,
                final_marking,
                log=None,
                aggregated_statistics=None,
                parameters=None):
    """
    Visualize a BPMN graph from a Petri net using the given parameters

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log where the replay technique should be applied
    aggregated_statistics
        (Optional) element-wise statistics calculated on the Petri net
    parameters
        Possible parameters of the algorithm, including:
            format -> Format of the image to render (pdf, png, svg)

    Returns
    -----------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """

    if parameters is None:
        parameters = {}

    del log
    del aggregated_statistics

    image_format = parameters["format"] if "format" in parameters else "png"

    bpmn_graph, el_corr, inv_el_corr, el_corr_keys_map = bpmn_converter.apply(
        net, initial_marking, final_marking)

    file_name = bpmn_diagram_to_figure(bpmn_graph,
                                       image_format,
                                       bpmn_aggreg_statistics=None)
    return file_name
示例#7
0
def apply_petri_greedy(net,
                       initial_marking,
                       final_marking,
                       log=None,
                       aggr_stat=None,
                       parameters=None):
    """
    Visualize a BPMN graph from a Petri net, decorated with performance, using the given parameters (greedy algorithm)

    Parameters
    -----------
    net
        Petri net
    initial_marking
        Initial marking
    final_marking
        Final marking
    log
        (Optional) log where the replay technique should be applied
    aggr_stat
        (Optional) element-wise statistics calculated on the Petri net
    parameters
        Possible parameters of the algorithm, including:
            format -> Format of the image to render (pdf, png, svg)
            aggregationMeasure -> Measure to use to aggregate statistics
            pm4py.util.constants.PARAMETER_CONSTANT_ACTIVITY_KEY -> Specification of the activity key
            (if not concept:name)
            pm4py.util.constants.PARAMETER_CONSTANT_TIMESTAMP_KEY -> Specification of the timestamp key
            (if not time:timestamp)

    Returns
    -----------
    file_name
        Path of the figure in which the rendered BPMN has been saved
    """

    if parameters is None:
        parameters = {}

    image_format = parameters["format"] if "format" in parameters else "png"

    bpmn_graph, el_corr, inv_el_corr, el_corr_keys_map = bpmn_converter.apply(
        net, initial_marking, final_marking)

    activity_key = parameters[
        PARAMETER_CONSTANT_ACTIVITY_KEY] if PARAMETER_CONSTANT_ACTIVITY_KEY in parameters else DEFAULT_NAME_KEY

    if aggr_stat is None and log is not None:
        dfg = dfg_factory.apply(log, variant="performance")
        activities_count = attributes_filter.get_attribute_values(
            log, activity_key)
        spaths = vis_trans_shortest_paths.get_shortest_paths(net)
        aggr_stat = vis_trans_shortest_paths.get_decorations_from_dfg_spaths_acticount(
            net, dfg, spaths, activities_count, variant="performance")

    bpmn_aggreg_statistics = None
    if aggr_stat is not None:
        bpmn_aggreg_statistics = convert_performance_map.convert_performance_map_to_bpmn(
            aggr_stat, inv_el_corr)

    file_name = bpmn_diagram_to_figure(
        bpmn_graph,
        image_format,
        bpmn_aggreg_statistics=bpmn_aggreg_statistics)
    return file_name