json2graph.decoder.decode_main

JSON decode functions.

Module Contents

Functions

add_metadata(ontouml_graph)

Add basic metadata to the generated graph when not in test mode.

decode_dictionary(dictionary_data, ontouml_graph, language)

Receive the full dictionary with the loaded JSON data and decode known allowed values to the OntoUML Graph.

decode_json_to_graph(json_data, language, execution_mode)

Receive the loaded JSON data and decodes it into a graph that complies to the OntoUML Vocabulary.

Attributes

LOGGER

json2graph.decoder.decode_main.LOGGER
json2graph.decoder.decode_main.add_metadata(ontouml_graph)

Add basic metadata to the generated graph when not in test mode.

The metadata added are:
  • dct:conformsTo METADATA[“conformsToBase”]

  • dct:created (creation date)

  • dct:language (when user argument available)

  • type owl:Ontology

  • Decoder information as rdfs:comment and rdfs:seeAlso

Parameters:

ontouml_graph (Graph) – Knowledge graph that complies with the OntoUML Vocabulary.

Return type:

None

json2graph.decoder.decode_main.decode_dictionary(dictionary_data, ontouml_graph, language)

Receive the full dictionary with the loaded JSON data and decode known allowed values to the OntoUML Graph.

Recursively evaluates the dictionary to create all possible instances, setting their types and attributes.

OntoUML-Vocabulary properties that are directly decoded in the general decoder:
  • description, height, isAbstract, isComplete, isDerived, isDisjoint, isOrdered, isReadOnly, name, text, width

Restricted properties (the ones in the restricted_fields list) are not treated in this function.

Parameters:
  • dictionary_data (dict) – Dictionary to have its fields decoded.

  • ontouml_graph (Graph) – Knowledge graph that complies with the OntoUML Vocabulary.

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

Return type:

None

json2graph.decoder.decode_main.decode_json_to_graph(json_data, language, execution_mode)

Receive the loaded JSON data and decodes it into a graph that complies to the OntoUML Vocabulary.

Parameters:
  • json_data (dict) – Input JSON data loaded as a dictionary.

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

  • execution_mode (str) – Information about execution mode. Valid values are ‘script’, ‘import’, and ‘test’.

Returns:

Knowledge graph that complies with the OntoUML Vocabulary

Return type:

Graph