json2graph.decoder.decode_obj_package

Functions to decode specificities of the object Package.

Function’s nomenclatures:
  • Functions that set one property are named: set_<subject>_<predicate>_<object>.

  • Functions that set multiple object properties are named: set_<subject>_relations.

  • Functions that set multiple data properties are named: set_<subject>_attributes.

  • Functions that set both object and data properties are named: set_<subject>_properties.

  • Functions that set default values: set_<subject>_defaults.

Module Contents

Functions

get_package_contents(package_dict, package_id[, ...])

Receive the dictionary with all loaded JSON data and returns the value of the 'contents' field for a given object (defined by the received value of its ID).

set_package_containsmodelelement_modelelement(...)

Set object property ontouml:containsModelElement between an ontouml:Package and an ontouml:ModelElement it contains.

create_package_properties(json_data, ontouml_graph)

Decode an object of type Package.

json2graph.decoder.decode_obj_package.get_package_contents(package_dict, package_id, list_contents=[])

Receive the dictionary with all loaded JSON data and returns the value of the ‘contents’ field for a given object (defined by the received value of its ID).

Parameters:
  • package_dict (dict) – Package’s data to have its fields decoded.

  • package_id (str) – ID of the Package to have its list of contents returned.

  • list_contents (list) – Optional. Used to identify if the desired value was already found and exit recursion.

Returns:

List of contents for a given Package.

Return type:

list[dict]

json2graph.decoder.decode_obj_package.set_package_containsmodelelement_modelelement(package_dict, ontouml_graph)

Set object property ontouml:containsModelElement between an ontouml:Package and an ontouml:ModelElement it contains.

Parameters:
  • package_dict (dict) – Package’s data to have its fields decoded.

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

Return type:

None

json2graph.decoder.decode_obj_package.create_package_properties(json_data, ontouml_graph)

Decode an object of type Package.

Receives the whole JSON loaded data as a dictionary and manipulates it to create all properties in which the object’s type is domain of.

Created object properties:
  • ontouml:containsModelElement (range:ModelElement)

Parameters:
  • json_data (dict) – JSON’s data to have its fields decoded loaded into a dictionary.

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

Return type:

None