json2graph.decoder.decode_obj_relation

Functions to decode specificities of the object Relation.

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

set_relation_defaults(relation_dict, ontouml_graph)

Set attribute's default values for ontouml:Relation.

set_relation_stereotype(relation_dict, ontouml_graph)

Set ontouml:stereotype property between an instance of ontouml:Relation and an instance representing an ontouml:RelationStereotype.

set_relation_relations(relation_dict, ontouml_graph)

Set the following object properties to instances of ontouml:Relation.

create_relation_properties(json_data, ontouml_graph)

Decode an object of type Relation.

json2graph.decoder.decode_obj_relation.set_relation_defaults(relation_dict, ontouml_graph)

Set attribute’s default values for ontouml:Relation.

The attribute’s default values are the following:

DRA1) ontouml:isDerived default value = False DRA2) ontouml:isAbstract default value = False

Parameters:
  • relation_dict (dict) – Relation object loaded as a dictionary.

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

Return type:

None

json2graph.decoder.decode_obj_relation.set_relation_stereotype(relation_dict, ontouml_graph)

Set ontouml:stereotype property between an instance of ontouml:Relation and an instance representing an ontouml:RelationStereotype.

Warning messages:
  • VRS1: Relation has invalid stereotype associated to it. Result is invalid.

Parameters:
  • relation_dict (dict) – Relation object loaded as a dictionary.

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

Return type:

None

json2graph.decoder.decode_obj_relation.set_relation_relations(relation_dict, ontouml_graph)

Set the following object properties to instances of ontouml:Relation.

The object properties are the following:
  • ontouml:relationEnd (range ontouml:Property)

  • ontouml:sourceEnd (range ontouml:Property)

  • ontouml:targetEnd (range ontouml:Property)

Parameters:
  • relation_dict (dict) – Relation object loaded as a dictionary.

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

Return type:

None

json2graph.decoder.decode_obj_relation.create_relation_properties(json_data, ontouml_graph)

Decode an object of type Relation.

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 properties:
  • ontouml:relationEnd (range ontouml:Property)

  • ontouml:sourceEnd (range ontouml:Property)

  • ontouml:targetEnd (range ontouml:Property)

  • ontouml:stereotype (range ontouml:RelationStereotype)

  • ontouml:isDerived (range xsd:boolean)

  • ontouml:isAbstract (range xsd:boolean)

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