Skip to main content

Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard

Project description

cimrdf.py

Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard.

Installing

$ git clone https://github.com/bressanmarcos/cimrdf.py.git
$ cd cimrdf.py
$ python setup.py install 

Using

  1. Create your RDF artifact with you preferred utils
  2. Convert it into Python data structures with:
cimrdfpy input_filename.xml output.py

Creating CIM RDF instances

3a. Use the generated classes from output.py to create your instances

from output import *

ei = EquivalentInjection()
ei.IdentifiedObject_mRID = 'EquivalentNW243'
t = Terminal()
t.Terminal_sequenceNumber = 1
t.Terminal_ConductingEquipment = ei

s = Switch()
s.Switch_normalOpen = True
s.IdentifiedObject_mRID = 'SW12'
t1 = Terminal()
t1.Terminal_sequenceNumber = 1
t1.Terminal_ConductingEquipment = s
t2 = Terminal()
t2.Terminal_sequenceNumber = 2
t2.Terminal_ConductingEquipment = s

cn = ConnectivityNode()
cn.IdentifiedObject_mRID = 'Node23'
cn.ConnectivityNode_Terminals = [t1, t] 
// This associates reciprocally Terminals t and t1 to ConnectivityNode cn, and vice versa

4a. Create a new document instance with all objects

new = DocumentCIMRDF([ei, t, s, t1, t2, cn])

The available functions are:

  • new.dump(): Pretty-Print the document to stdout
  • new.pack(): Get the document's ElementTree (xml.etree.ElementTree) instance
  • new.tostring(): Get the XML stringified version of the document
  • new.add_elements( ... ): Add new elements (one or a list) to the document

Parsing CIM RDF instances

3b. Use proper functions to parse file or string.

instances = fromstring(xmlstring)
print(instances)
// [list of instances]

The available functions are:

  • fromstring(xmlstring): Get list of instances from CIM RDF string
  • fromfile(filename): Get list of instances from CIM RDF file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cimrdf.py-0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

cimrdf.py-0.2-py3.7.egg (12.6 kB view details)

Uploaded Source

File details

Details for the file cimrdf.py-0.2.tar.gz.

File metadata

  • Download URL: cimrdf.py-0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for cimrdf.py-0.2.tar.gz
Algorithm Hash digest
SHA256 5cbea540593d7fccc8a3a39366b803ebc117a9f7c386ab5e49c08757f94ff368
MD5 a785701744db01e23ee411691e193998
BLAKE2b-256 8e81d807c0b114a2f2f04a0b33acf6cf5cf3162de5a691bbd4cfa30d6e5e349d

See more details on using hashes here.

File details

Details for the file cimrdf.py-0.2-py3.7.egg.

File metadata

  • Download URL: cimrdf.py-0.2-py3.7.egg
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for cimrdf.py-0.2-py3.7.egg
Algorithm Hash digest
SHA256 c5207c9c78ffe93396a4d6b36095de1cc218ab5b3a80d8a928f6a8b22f4f702b
MD5 13fd43f0f5b8da5edb740af24ac17d75
BLAKE2b-256 d0a1e8f7dafc06f88d1e23e182ac0870f18da32b33d1966f5d4e2414378b7f7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page