Skip to content

Generate a LinkML schema from a CIM RDF schema (conforming IEC 61970-501).

License

Notifications You must be signed in to change notification settings

Netbeheer-Nederland/cgmes-to-linkml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cimrdfs2linkml

Generates a LinkML schema from a CIM RDF Schema (as per IEC 61970-501).

Note

Currently only RDFS 2020 serializations of the CGMES 3.0.0 profiles are supported. This is because of assumptions about the profile metadata baked into the code.

Installation and Running

Install the dependencies, preferably using poetry, and make sure the (virtual) environment you're can find the cimrdfs2linkml package (e.g. by extending $PYTHONPATH).

Then, to run the script, simply run:

$ cimrdfs2linkml /path/to/input_schema.rdf -o /path/to/output_schema.yaml

If you omit the -o option, the target schema will be written to ./out.yaml. For further usage help you can provide the --help flag.

Mapping

The CIM RDF Schema distinguishes between several stereotypes of classes. The following are handled by cimrdfs2linkml:

  • Primitive: mapped to LinkML primitive data types.
  • CIMDatatype: mapped to LinkML classes.
  • Enumeration: mapped to LinkML enums.
  • remaining classes are mapped to LinkML classes.

Note

CIM data types each consist of a unit symbol, unit mulitplier and value. For each such data type the symbol and multiplier are fixed (cims:isFixed) to some enum value. This fixed value is currently ignored.

Furthermore, each RDF property pertaining to some class is mapped to a LinkML attribute of that class.

Note

As is made clear by the class name prefix in all property URIs, all properties are tightly coupled to classes. For that reason all properties are mapped to class attributes rather than top-level slots, i.e. no top-level slots are generated.

Implementation Notes

For the quick development of this script the library xmltodict is used. This works since the IEC 61970-501 spec demands the use of an XML serialization of the schema, but proper RDF parsing (and querying) using something like rdflib has benefits and probably needs to be done in the future.

About

Generate a LinkML schema from a CIM RDF schema (conforming IEC 61970-501).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages