Skip to content

Commit eaee03c

Browse files
committed
Update documentation
Signed-off-by: Thomas Günther <[email protected]>
1 parent 895cbdd commit eaee03c

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

cimpy/cimexport.py

+20-8
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ def _create_namespaces_list(namespaces_dict):
166166
# This function sorts the classes and their attributes to the corresponding profiles. Either the classes/attributes are
167167
# imported or they are set afterwards. In the first case the serializationProfile is used to determine from which
168168
# 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.
172173
def _sort_classes_to_profile(class_attributes_list, activeProfileList):
173174
export_dict = {}
174175
export_about_dict = {}
@@ -334,6 +335,16 @@ def _sort_classes_to_profile(class_attributes_list, activeProfileList):
334335

335336

336337
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+
"""
337348
result = []
338349
profile_list = list(map(lambda a: Profile[a], activeProfileList))
339350
for profile in profile_list or [p for p in Profile]:
@@ -356,13 +367,13 @@ def cim_export(import_result, file_name, version, activeProfileList=()):
356367
The meta information can be extracted via import_result['meta_info']. The meta_info dictionary contains a new \
357368
dictionary with the keys: 'author', 'namespaces' and 'urls'. The last two are also dictionaries. \
358369
'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 \
360371
accessible via the name of the attribute, \
361372
e.g. import_result['meta_info']['urls'}[attr_name] = {mapping like example above}. \
362373
'namespaces' is a dictionary containing all RDF namespaces used in the imported xml files.
363374
: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 \
366377
used for serialization, no activeProfileList means output to all profile files with data
367378
"""
368379

@@ -400,9 +411,10 @@ def generate_xml(cim_data, version, model_name, profile, available_profiles):
400411
:param cim_data: a dictionary containing the topology and meta information. It can be created via \
401412
:func:`~cimpy.cimimport.cim_import()`
402413
: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.
404415
: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
406418
"""
407419

408420
# Returns all classes with their attributes and resolved references

cimpy/cimimport.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def cim_import(xml_files, cgmes_version, start_dict=None):
2020
:param start_dict: a list of classes which indicates which classes will be read
2121
e.g. elements=["BaseVoltage", "ACLineSegment"]
2222
* If start_dict=None the complete file will be read
23-
:return: import_result: a dictionary containing the topology and meta information.The topology can be extracted \
23+
:return: import_result: a dictionary containing the topology and meta information. The topology can be extracted \
2424
via import_result['topology']. The topology dictionary contains all objects accessible via their mRID. The meta \
2525
information can be extracted via import_result['meta_info']. The meta_info dictionary contains a new dictionary \
2626
with the keys: 'author', 'namespaces' and 'urls'. The last two are also dictionaries. 'urls' contains a mapping \
2727
between references to URLs and the extracted value of the URL, e.g. 'absoluteValue': \
28-
'http://iec.ch/TC57/2012/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue' These mappings are \
28+
'http://iec.ch/TC57/2012/CIM-schema-cim16#OperationalLimitDirectionKind.absoluteValue'. These mappings are \
2929
accessible via the name of the attribute, \
3030
e.g. import_result['meta_info']['urls'}[attr_name] = {mapping like example above}. \
3131
'namespaces' is a dictionary containing all RDF namespaces used in the imported xml files.

0 commit comments

Comments
 (0)