Expand description
Edits across a model set, as text edits for whoever holds the files to apply: renaming an mRID, deleting objects and adding a field a finding says is missing; and the objects a reference can name, the likeliest first; adding an object in a container. They change the files as written, keeping everything else of them, and reach every file of the set: an object’s EQ, SSH and SV elements and every reference to it.
The caller gives the files as they are now, each named as it likes (a
URL, a file name), with its Index; the edits come back by that name.
Structs§
- Addable
- A class that can be added in an object, and the field naming it there.
- Added
- An object added: the edits, and where its name (else its start tag) is.
- Addition
- A field to add: where, and where its value is once added.
- Candidate
- An object a reference can name.
- Copied
- Objects copied: the edits, and each object’s new mRID.
- Deletion
- What deleting objects changes: the elements writing them, in every file, and the fields referring to them from what stays. Whole lines go, so a client should show it before applying it.
- File
- One file of the set, as it is now.
- Reference
Fix - A fix for a reference to nothing (
rdf:resource="#") or to an object the set lacks: name one of the likeliest objects instead.
Functions§
- add
- Add an object of
classinparent, namednameif given: anrdf:ID, its mRID, name and the field namingparent, in the file whose profile carries the class (the parent’s own first), after the last of the parent’s objects there, else after the parent, else at the end; and where the set has an SSH file and the class SSH attributes, an emptyrdf:aboutthere for them. What else it needs, validation asks for. Its mRID is_and a UUID fromrandom(uuid), drawn again while the set has it. - add_
missing - Add field
keyto objectid, which writes it nowhere: in the file (preferfirst) whose profile carries it and that writes the object, after its last field, with a value to type over — the object’s mRID forIdentifiedObject.mRID,false,0, an enumeration’s first value, or none.Noneif a file writes it already, its class does not declare it, or no file fits. - addable
- The concrete classes of
parent’s family whose objects the containment puts in it: the first ofCONTAINEDthey declare that ranges over its class. Only classes of the profiles the set’s files declare (all, if none declares one). - candidates
- The objects field
keyof objectidcan name — of the class it ranges over, or below — at mostlimit, the likeliest first: those linked to the object, naming what it names with its other fields or named by it (a terminal’s connectivity node, of its topological node; equipment’s base voltage, its voltage level’s); then those that share the most containers with it, by where they are or by where the objects are that name them with the same field (a line’s base voltage is the one the equipment of its voltage level names); then the most named. Empty ifkeyis not a reference of the object’s class. - companion
- The text of a new file of profile
code(DL) besidelike: its prolog and root, with their namespaces, and a FullModel header under the model idurn:uuid:{id}dependent onlike’s model, with its times, version and modelling authority set. - copy
- Copy objects
idswith new mRIDs (_and a UUID fromrandom): every element writing each of them, in every file or only infrom, itsrdf:IDorrdf:about, its mRID field, and its references to the objects copied, rewritten to the copies; references to anything else stay. Each copy goes after its original, or withinto, at the end of that file, which must bind the prefixes the copies use as their files do.frommatters where two files define the same objects (a proposal and what was agreed of it): their copies would be one object written twice. - create
- A new object of
class, withvalues(field, value asset_fieldtakes it) and its mRID as text where the class has a field for it (IdentifiedObject.mRID, or its own), written at the end of the fileinto, with anrdf:IDwhose UUID is drawn fromrandom. For objects in no container, whichaddcannot place: a response, a dependency. - delete
- Delete objects
ids. - describe
- How an object is named in a title: its class and name, else mRID.
- diagram
- A DL diagram written into
into: a newDiagramnamedname(y downwards), or inexisting(in the file defining it, whateverintosays), its drawing of whatobjectsshow replaced and the rest kept. Each ofobjects(the mRID it shows, its name, its points) aDiagramObjectwith itsDiagramObjectPoints, numbered from 1. UUIDs fromrandom. The diagram’s mRID is the result’sid. - prepare_
rename - The mRID at
posin the filename— an element’srdf:ID/rdf:about, or anrdf:resource— and the range of it as written; anywhere else in an element’s start tag, that element’s. - reference_
fixes - The fixes for object
id’s references to nothing or to objects the set lacks, in every file that writes it, or only the field atat: each the five likeliest objects (candidates);atnames a file and a place in it. An enumeration value is not a reference to an object, so it has none. - referrers
- The objects that refer to object
id, and by which field, as the files write them: (referrer, field), each once. - remove_
field - Remove field
keyfrom objectidin every file writing it, its lines with it. - rename
- Rename mRID
oldtonewin every file: each element’srdf:IDorrdf:about, eachrdf:resourceto it, and anIdentifiedObject.mRID(or a class’s own….mRID) that writes it (without its leading_, as CGMES 3 does, if so). - set_
field - Set field
keyof objectidtovalue: a literal’s text (escaped here), a reference’s object (its mRID, or an IRI), or an enumeration’s value (D, orWindingConnection.D). Wherever a file writes the field, its value is replaced; where none does, it is added asadd_missingadds it,preferfirst. An error if the object’s class does not declare it. - uuid
- A version 4 UUID from 16 random bytes, which the caller draws: the standard library has no randomness on every target this runs on.