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
This function parses the command-line arguments provided by the user and performs necessary validations. |
|
|
This function initializes the global variable ARGUMENTS of type dictionary, which contains user-provided |
Attributes
- json2graph.modules.arguments.ARGUMENTS
- json2graph.modules.arguments.LOGGER
- json2graph.modules.arguments.treat_user_arguments()
This function parses the command-line arguments provided by the user and performs necessary validations.
- Returns:
Dictionary with json path (key ‘json_path’) and final file format (key ‘format’).
- Return type:
dict
- json2graph.modules.arguments.initialize_arguments(json_path='not_initialized', base_uri='https://example.org#', graph_format='ttl', language='', model_only=False, silent=True, correct=False, execution_mode='import')
This function initializes 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.
The valid execution modes are: - ‘script’: If used as a script, use user’s arguments parsed from the command line. - ‘package’: When imported into external code, working as a library package. - ‘test’: Used for testing.
- Parameters:
json_path (str) – Path to the JSON file to be decoded provided by the user. (Optional)
base_uri (str) – Base URI to be used for generating URIs for ontology concepts.
graph_format (str) –
language (str) –
model_only (bool) –
silent (bool) –
correct (bool) –
execution_mode (str) –
Default is “https://example.org#”. (Optional) :type base_uri: str :param graph_format: Format for saving the resulting knowledge graph. Default value is ‘ttl’ (Turtle syntax). (Optional) :type graph_format: str :param language: Language tag to be added to the ontology’s concepts. (Optional) :type language: str :param model_only: If True, only the OntoUML model will be extracted without diagrammatic information. (Optional) :type model_only: bool :param silent: If True, suppresses intermediate communications and log messages during execution. (Optional) :type silent: bool :param correct: If True, attempts to correct potential errors during the conversion process. (Optional) :type correct: bool :param execution_mode: Information about the execution mode. Valid values are ‘import’ (default), ‘script’, and ‘test’. (Optional) :type execution_mode: str