json2graph.decode
Main function used as script to convert OntoUML JSON files into knowledge graphs, with the flexibility to customize the output and control the execution mode for different use cases.
Module Contents
Functions
|
Main function for converting OntoUML JSON data to a Knowledge Graph. |
|
Saves the ontology graph into a file with syntax defined by the user. |
Attributes
- json2graph.decode.decode_ontouml_json2graph(json_path, base_uri='https://example.org#', graph_format='ttl', language='', model_only=False, silent=True, correct=False, execution_mode='import')
Main function for converting OntoUML JSON data to a Knowledge Graph.
This function takes the path to a JSON file representing OntoUML model data provided by the user and converts it into a knowledge graph following the specified options.
- Parameters:
json_path (str) – Path to the JSON file to be decoded provided by the user.
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) –
- Return type:
rdflib.Graph
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
- Returns:
JSON data decoded into a RDFLib’s Graph that is compliant with the OntoUML Vocabulary.
- Return type:
Graph
- Parameters:
json_path (str) –
base_uri (str) –
graph_format (str) –
language (str) –
model_only (bool) –
silent (bool) –
correct (bool) –
execution_mode (str) –
- json2graph.decode.write_graph_file(ontouml_graph, json_path, graph_format)
Saves the ontology graph into a file with syntax defined by the user. The file is saved inside the ‘results’ directory also created by this function.
- Parameters:
ontouml_graph (Graph) – Graph compliant with the OntoUML Vocabulary.
json_path (str) – Path to the input json file.
graph_format (str) – Syntax selected by the user to save the graph.
- Returns:
Saved output file path.
- Return type:
str
- json2graph.decode.decoded_graph