json2graph.modules.arguments

Argument Treatments Module.

This module provides functions for parsing and validating user-provided arguments when starting the software execution as a script.

It also makes the ARGUMENTS variable globally accessible with the user’s arguments (when executed as a script) or with default values (when executed as test or as a library).

Module Contents

Functions

initialize_args_script()

Parse the command-line arguments provided by the user and performs necessary validations.

initialize_args_import([input_path, output_path, ...])

Initialize the global variable ARGUMENTS of type dictionary, which contains user-provided (when executed in script mode) or default arguments (when executed as a library or for testing).

initialize_args_test([input_path, language])

Initialize the global variable ARGUMENTS of type dictionary, which contains user-provided (when executed in script mode) or default arguments (when executed as a library or for testing).

Attributes

ARGUMENTS

LOGGER

json2graph.modules.arguments.ARGUMENTS
json2graph.modules.arguments.LOGGER
json2graph.modules.arguments.initialize_args_script()

Parse the command-line arguments provided by the user and performs necessary validations.

The ARGUMENTS variable must be initialized in every possible execution mode.

Return type:

None

json2graph.modules.arguments.initialize_args_import(input_path='not_initialized', output_path=os.getcwd(), base_uri='https://example.org#', graph_format='ttl', language='', model_only=False, silent=True, correct=False)

Initialize the global variable ARGUMENTS of type dictionary, which contains user-provided (when executed in script mode) or default arguments (when executed as a library or for testing).

The ARGUMENTS variable must be initialized in every possible execution mode.

Parameters:
  • input_path (str) – Path to the directory or JSON file to be decoded. (Optional)

  • output_path (str) – Path to the directory in which the result file(s) will be saved. (Optional)

  • base_uri (str) – Base URI to be used for generating URIs for ontology concepts. (Optional) Default is “https://example.org#”.

  • graph_format (str) – Format for saving the resulting knowledge graph. (Optional) Default value is ‘ttl’ (Turtle syntax).

  • language (str) – Language tag to be added to the ontology’s concepts. (Optional)

  • model_only (bool) – If True, only the OntoUML model will be extracted without diagrammatic information. (Optional)

  • silent (bool) – If True, suppresses intermediate communications and log messages during execution. (Optional)

  • correct (bool) – If True, attempts to correct potential errors during the conversion process. (Optional)

json2graph.modules.arguments.initialize_args_test(input_path='not_initialized', language='')

Initialize the global variable ARGUMENTS of type dictionary, which contains user-provided (when executed in script mode) or default arguments (when executed as a library or for testing).

The ARGUMENTS variable must be initialized in every possible execution mode.

Parameters:
  • input_path (str) – Path to the directory or JSON file to be decoded. (Optional)

  • language (str) – Language tag to be added to the ontology’s concepts. (Optional)