:py:mod:`json2graph.decoder.decode_obj_property` ================================================ .. py:module:: json2graph.decoder.decode_obj_property .. autoapi-nested-parse:: Functions to decode specificities of the object Property. Function's nomenclatures: - Functions that set one property are named: set___. - Functions that set multiple object properties are named: set__relations. - Functions that set multiple data properties are named: set__attributes. - Functions that set both object and data properties are named: set__properties. - Functions that set default values: set__defaults. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: json2graph.decoder.decode_obj_property.validate_property_stereotype json2graph.decoder.decode_obj_property.set_property_defaults json2graph.decoder.decode_obj_property.set_property_relations json2graph.decoder.decode_obj_property.determine_cardinality_bounds json2graph.decoder.decode_obj_property.set_cardinality_relations json2graph.decoder.decode_obj_property.create_property_properties Attributes ~~~~~~~~~~ .. autoapisummary:: json2graph.decoder.decode_obj_property.LOGGER .. py:data:: LOGGER .. py:function:: validate_property_stereotype(ontouml_graph) Perform syntactical and semantic validations on an ontouml:Property's stereotype. Differently from what is used in the validation of other JSON objects, this function manipulates the graph itself, not the JSON object. This is because it is much straightforward to access all the necessary property elements. Validations performed: VPS1) Reports invalid property stereotypes (i.e., stereotypes different from ontouml:begin or ontouml:end). VPS2) Reports if a property stereotype is used in association with an invalid class stereotype. I.e., a class stereotype that is known and different from 'event'. VPS3) Sets class stereotype as 'event' when it is associated to a property that has an assigned valid stereotype. :param ontouml_graph: Knowledge graph that complies with the OntoUML Vocabulary. :type ontouml_graph: Graph .. py:function:: set_property_defaults(property_dict, ontouml_graph) Set default values for ontouml:Property elements that do not present them. The defaults are: DPA1) ontouml:isDerived default value = False DPA2) ontouml:isOrdered default value = False DPA3) ontouml:isReadOnly default value = False :param property_dict: Property object loaded as a dictionary. :type property_dict: dict :param ontouml_graph: Knowledge graph that complies with the OntoUML Vocabulary. :type ontouml_graph: Graph .. py:function:: set_property_relations(property_dict, ontouml_graph) Set the ontouml:aggregationKind and ontouml:propertyType object properties between an ontouml:Property and its related elements. :param property_dict: Property object loaded as a dictionary. :type property_dict: dict :param ontouml_graph: Knowledge graph that complies with the OntoUML Vocabulary. :type ontouml_graph: Graph .. py:function:: determine_cardinality_bounds(cardinalities, property_id) Receive a string with an ontouml:Cardinality's ontouml:cardinalityValue, fix its format and decouple it into its ontouml:lowerBound and ontouml:upperBound. Checks and displays warning if the obtained values are not valid. :param cardinalities: String containing the value of the cardinality to be decoupled into lower and upper bounds. :type cardinalities: str :param property_id: ID of the Property that owns the cardinality being treated. Used in case of invalid cardinality. :type property_id: str :return: Tuple of three elements: full cardinality, cardinality's lower bound, and cardinality's upper bound. :rtype: (str, str, str) .. py:function:: set_cardinality_relations(property_dict, ontouml_graph) Create the ontouml:Cardinality instance and sets its properties. :param property_dict: Property object loaded as a dictionary. :type property_dict: dict :param ontouml_graph: Knowledge graph that complies with the OntoUML Vocabulary. :type ontouml_graph: Graph .. py:function:: create_property_properties(json_data, ontouml_graph) Decode object of type Property. 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 instances of class: - ontouml:Cardinality Created properties: - ontouml:aggregationKind (domain ontouml:Property, range ontouml:AggregationKind) - ontouml:propertyType (domain ontouml:Property, range ontouml:Classifier) - ontouml:stereotype (domain ontouml:Property, range ontouml:PropertyStereotype) - ontouml:cardinality (domain ontouml:Property, range ontouml:Cardinality) - ontouml:cardinalityValue (domain ontouml:Cardinality, range xsd:string) - ontouml:lowerBound (domain ontouml:Cardinality, range xsd:nonNegativeInteger) - ontouml:upperBound (domain ontouml:Cardinality) - ontouml:subsetsProperty (range ontouml:Property) - ontouml:redefinesProperty (range ontouml:Property) - ontouml:isDerived (range xsd:boolean) - ontouml:isOrdered (range xsd:boolean) - ontouml:isReadOnly (range xsd:boolean) Performs validation for ontouml:stereotype. :param json_data: JSON's data to have its fields decoded loaded into a dictionary. :type json_data: dict :param ontouml_graph: Knowledge graph that complies with the OntoUML Vocabulary. :type ontouml_graph: Graph