@@ -166,9 +166,10 @@ def _create_namespaces_list(namespaces_dict):
166
166
# This function sorts the classes and their attributes to the corresponding profiles. Either the classes/attributes are
167
167
# imported or they are set afterwards. In the first case the serializationProfile is used to determine from which
168
168
# profile this class/attribute was read. If an entry exists the class/attribute is added to this profile. In the
169
- # possibleProfileList dictionary the possible origins of the class/attributes is stored. All profiles have a different
170
- # priority which is stored in the enum cgmesProfile. As default the smallest entry in the dictionary is used to
171
- # determine the profile for the class/attributes.
169
+ # possibleProfileList dictionary the possible origins of the class/attributes is stored.
170
+ # If the profile is not found for a class in possibleProfileList the recommended class profile is used.
171
+ # If it is not found for an attribute the class profile is used, but only if this is a possible profile for this
172
+ # attribute. Otherwise, the first entry in the list of possible profiles for this attribute is used.
172
173
def _sort_classes_to_profile (class_attributes_list , activeProfileList ):
173
174
export_dict = {}
174
175
export_about_dict = {}
@@ -334,6 +335,16 @@ def _sort_classes_to_profile(class_attributes_list, activeProfileList):
334
335
335
336
336
337
def cim_export_to_string_array (import_result , model_name , version , activeProfileList = ()):
338
+ """Function for serialization of cgmes classes to a list of strings
339
+
340
+ See :func:`~cimpy.cimexport.cim_export()` for details.
341
+ :param import_result: a dictionary containing the topology and meta information.
342
+ :param model_name: a string with the name of the model.
343
+ :param version: cgmes version, e.g.``version="cgmes_v2_4_15"``
344
+ :param activeProfileList: a list containing the strings of all short names of the profiles \
345
+ used for serialization, no activeProfileList means output to all profile files with data
346
+ :return: a list of strings with the CIM RDF/XML data
347
+ """
337
348
result = []
338
349
profile_list = list (map (lambda a : Profile [a ], activeProfileList ))
339
350
for profile in profile_list or [p for p in Profile ]:
@@ -356,13 +367,13 @@ def cim_export(import_result, file_name, version, activeProfileList=()):
356
367
The meta information can be extracted via import_result['meta_info']. The meta_info dictionary contains a new \
357
368
dictionary with the keys: 'author', 'namespaces' and 'urls'. The last two are also dictionaries. \
358
369
'urls' contains a mapping between references to URLs and the extracted value of the URL, e.g. 'absoluteValue': \
359
- 'http://iec.ch/TC57/2012/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue' These mappings are \
370
+ 'http://iec.ch/TC57/2012/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue'. These mappings are \
360
371
accessible via the name of the attribute, \
361
372
e.g. import_result['meta_info']['urls'}[attr_name] = {mapping like example above}. \
362
373
'namespaces' is a dictionary containing all RDF namespaces used in the imported xml files.
363
374
:param file_name: a string with the name of the xml files which will be created
364
- :param version: cgmes version, e.g. version = "cgmes_v2_4_15"
365
- :param activeProfileList (optional) : a list containing the strings of all short names of the profiles \
375
+ :param version: cgmes version, e.g. `` version= "cgmes_v2_4_15"``
376
+ :param activeProfileList: a list containing the strings of all short names of the profiles \
366
377
used for serialization, no activeProfileList means output to all profile files with data
367
378
"""
368
379
@@ -400,9 +411,10 @@ def generate_xml(cim_data, version, model_name, profile, available_profiles):
400
411
:param cim_data: a dictionary containing the topology and meta information. It can be created via \
401
412
:func:`~cimpy.cimimport.cim_import()`
402
413
:param version: cgmes version, e.g. ``version="cgmes_v2_4_15"``
403
- :param profile: The :class:`~cimpy.cgmes_v2_4_15.Base .Profile` for which the serialization should be generated.
414
+ :param profile: The :class:`~cimpy.cgmes_v2_4_15.CGMESProfile .Profile` for which the serialization should be generated.
404
415
:param model_name: a string with the name of the model.
405
- :param available_profiles: a list of all :class:`~cimpy.cgmes_v2_4_15.Base.Profile`s in `cim_data`
416
+ :param available_profiles: a list of all :class:`~cimpy.cgmes_v2_4_15.CGMESProfile.Profile` in `cim_data`
417
+ :result: a string with the CIM RDF/XML data
406
418
"""
407
419
408
420
# Returns all classes with their attributes and resolved references
0 commit comments