Skip to content

Object identification

URIs as identifiers

UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier) can be used to identify resources in such a way that the - Identifiers can be independently and uniquely allocated by different authorities. This is a big advantage with the UUID - Identifiers are stable over time and across documents.

If, in addition, the UUID is embedded in a Uniform Resource Name (URN) then the document can be simplified by the elimination of XML base namespace declarations (xml:baseattributes). The URN is a concise, fixed-length, absolute URI.

The stability of identifiers over time also requires the following - An identifier shall be created for any object when its existence become know. Note that objects in a model may or may not represent real physical equipment. - An identifier for an object, e.g. a deleted object, is not allowed to be reused.

The standard for an URN containing a UUID is defined by the Internet Engineering Task Force RFC 4122,

RFC 4122 specifies the syntax of the URN and how the UUID portion following the last colon is allocated. The algorithm is aligned with, and technically compatible with, ISO/IEC 9834-8:2005 Information Technology, "Procedures for the operation of OSI Registration Authorities: Generation and registration of Universally Unique Identifiers (UUIDs) and their use as ASN.1 Object Identifier components" ITU-T Rec. X.667, 2004.

CIMXML elements are identified by a URI. Also other forms than the URI is allowed but not recommended.

A URI can have two forms: - URL - URN

The URL and URN forms have fundamentally different structures, i.e.: - URL form; protocol://authority/path?query#fragment where the protocol in CIMXML is http - URN form: urn:namespace:specification where the namespace in CIMXML is uuid.

The URN specification format is summarized below: - 8 character hex number - a dash "-" - 4 character hex number - a dash "-" - 4 character hex number - a dash "-" - 4 character hex number - a dash "-" - 12 character hex number

where characters are lower case conforming to W3C (ISO 8859/1 8-bit single-byte coded graphic character set known as Latin Alphabet No. 1.

An example of the URN form is shown below:

"urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846"

About rdf:ID and rdf:about

A CIMXML element can be identified by two different RDF constructs: - rdf:ID - rdf:about

In RDF the rdf:ID identification has the specific meaning that the identifier is unique within a document while the rdf:about identification means the identifier is unique within a namespace. If the UUID name space urn:uuid is used for the rdf:about identification the identifiers are globally unique. Hence CIMXML promote using rdf:about identification in the UUID namespace for all identifiers.

In the past an rdf:ID meant the introduction of a new resource or object while rdf:about meant a reference to an elsewhere introduced resource or object. This distinction is no longer used. As both are UUIDs they have the same meaning. For backwards compatibility both are allowed but the rdf:about form is the preferred.

Identifiers in the FullModel and DifferenceModel elements shall always use the rdf:about identification in the UUID name space, i.e. starting with "urn:uuid:"

CIMXML element identification

Resource identification is so central in RDF that all elements representing objects are identified with a rdf:ID or rdf:about XML attribute. All classes in CIM that inherit IdentifiedObject have the UML object identification attribute IdentifiedObject.mRID. The attribute is implicitly mapped to the rdf:ID/rdf:about XML attribute

A CIMXML document may only use the URN form (see URIs as identifiers) as further described below.

CIMXML files contain XML elements describing CIM objects (ACLineSegments, Substationsetc.). The CIM has lots of association roles that show up as references in the XML elements (typically as rdf:resource or rdf:about attributes). CIM data is exchanged in different CIMXML documents that depend on each other. Some references then cross CIMXML document boundaries. A consequence of this is that the identification of a CIM object must be stable during its life time. Otherwise referencing objects across document boundaries will break.

A common practice in object oriented systems is to assume all objects have an identifier that is unique in space and time which means: - Different objects are assigned different identifiers. - Identifiers once assigned are never reused even if the original object having it is gone.

The URN form as described in URIs as identifiers is used as CIMXML element identification with the following differences - The prefix "urn:uuid:" is replaced by an underscore "_" The underscore avoids a numeric starting character for the non-base part of the identifier. Starting the non-base part of the identifier with a numeric character is invalid RDF. The underscore is added in all cases to simplify parsers, even if the UUID starts with a non-numeric character. - The prefix is defined as an xml:base="urn:uuid:"

Some examples: - rdf:ID="_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846" the rdf:ID form. - rdf:about="#_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846" the hash form. - rdf:about="urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846" the urn:uuid: form.

A receiver compatible with Edition 2 is supposed to be able to process all three forms.

A receiver compatible with Edition 1 is supposed to process the rdf:ID and rdf:about forms.

A producer compatible with Edition 2 should preferably only use the urn:uuid: form but is allowed to continue produce the rdf:ID and rdf:about forms.

A producer compatible with Edition 1 will produce the the rdf:ID and rdf:about forms.

CIM Identifier Parser

This namespace contains parsers specifically designed for handling CIM (Common Information Model) data according to IEC 61970-552 standards.

The ICimIdentifierParser interface and its implementation CimIdentifierParser provide comprehensive CIM identifier handling, combining all functionality from: - Parsing and normalization of CIM resource identifiers - Validation of CIM URIs (replaces CimUriValidator functionality) - Format detection and conversion

Core Features

Parsing & Conversion

  • ParseId() - Extracts Uuid identifier from CIM uri
  • ParseGuid() - Extracts Guid identifier from CIM uri
  • TryParseId() - Attempts to parse CIM uri as Uuid
  • TryParseGuid() - Attempts to parse CIM uri as GUID

Validation

  • IsValidCimUri() - Validates CIM URI according to IEC 61970-552
  • IsValidId() - Validates CIM URI for RDF ID.
  • IsValidAbout() - Validates CIM URI in either URN UUID or hash format
  • IsValidReference() - Validates CIM URI in either URN UUID or hash format
  • IsValidForModel() - Validates CIM URI for FullModel/DifferenceModel Xml documents
  • IsValidModelAuthoritySet() - Validates CIM URI for Modeling Authority Set (MAS)
  • IsValidProfile() - Validates CIM URI for CGMES Profiles

Format Detection

  • IsUrnUuidFormat() - Detects URN UUID format
  • IsHashFormat() - Detects hash/fragment format
  • IsRdfIdFormat() - Detects rdf:ID format

Normalization & Generation

  • ExtractUuid() - Extracts UUID from any valid format
  • TryExtractUuid() - Attempts to extract UUID from any valid format
  • Normalize() - Converts to preferred URN UUID format
  • GenerateNewId() - Creates new compliant CIM URI

Usage Examples

// Inject the parser
private readonly ICimIdentifierParser _cimParser;

// Parse various formats
var guid1 = _cimParser.TryParseGuid("urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846", out var result1);
var guid2 = _cimParser.TryParseGuid("#_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846", out var result2);
var guid3 = _cimParser.TryParseGuid("_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846", out var result3);

// Validate CIM URIs
var isValid = _cimParser.IsValidCimUri("urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846");

// Normalize to preferred format
var normalized = _cimParser.Normalize("#_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846");
// Result: "urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846"

// Generate new CIM ID
var newId = _cimParser.GenerateNewId();
// Result: "urn:uuid:..." (new UUID in preferred format)

// Validate for FullModel/DifferenceModel (must be URN UUID format)
var validForModel = _cimParser.IsValidForModel("urn:uuid:26cc8d71-3b7e-4cf8-8c93-8d9d557a4846"); // true
var invalidForModel = _cimParser.IsValidForModel("#_26cc8d71-3b7e-4cf8-8c93-8d9d557a4846"); // false

Dependency Injection

Register the parser in your service collection:

services.AddCimParserServices();

or

services.AddSingleton<ICimIdentifierParser, CimIdentifierParser>();