From 40e33b31efcb7f8e5c45441830b3ada7192cce2e Mon Sep 17 00:00:00 2001 From: aandersn Date: Sat, 14 Jun 2025 15:38:36 -0700 Subject: [PATCH 1/2] add sterotypes, pint units --- .../cimantic-graphs/cimantic-graphs-init.xsl | 112 ++++- .../cimantic-graphs/cimantic-graphs.xsl | 401 ++++++++++++------ 2 files changed, 387 insertions(+), 126 deletions(-) diff --git a/shipped-builders/cimantic-graphs/cimantic-graphs-init.xsl b/shipped-builders/cimantic-graphs/cimantic-graphs-init.xsl index 0e6c9a2..8401dff 100644 --- a/shipped-builders/cimantic-graphs/cimantic-graphs-init.xsl +++ b/shipped-builders/cimantic-graphs/cimantic-graphs-init.xsl @@ -2,7 +2,7 @@ Annotated CIMantic Graphs data profile init file for - - + + Generated by CIMTool http://cimtool.org @@ -49,13 +49,21 @@ under Contract DE-AC05-76RL01830 + + + + + + + + - + , ) - + __all__ = [ @@ -63,12 +71,102 @@ under Contract DE-AC05-76RL01830 + + + + + + + + - '' + '' , ] - \ No newline at end of file + + + + + + + + + + + + + + + _ + _and + _as + _assert + _break + _class + _continue + _def + _del + _elif + _else + _except + _finally + _for + _from + _global + _if + _import + _in + _is + _lambda + _nonlocal + _not + _or + _pass + _raise + _return + _try + _while + _with + _yield + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shipped-builders/cimantic-graphs/cimantic-graphs.xsl b/shipped-builders/cimantic-graphs/cimantic-graphs.xsl index fdf5f12..6fe9d78 100644 --- a/shipped-builders/cimantic-graphs/cimantic-graphs.xsl +++ b/shipped-builders/cimantic-graphs/cimantic-graphs.xsl @@ -1,21 +1,21 @@ from dataclasses import dataclass, field from typing import Optional from enum import Enum - from cimgraph.data_profile.identity import Identity + from cimgraph.data_profile.identity import Identity, CIMStereotype, stereotype + from cimgraph.data_profile.units import CIMUnit _log = logging.getLogger(__name__) @@ -55,36 +56,57 @@ under Contract DE-AC05-76RL01830 BASE_URI = '' ONTOLOGY_URI = '#' - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + + + + + + @stereotype(CIMStereotype.Description) + + + @stereotype(CIMStereotype.Concrete) + + + @stereotype(CIMStereotype.) + + + + + + + + + + @dataclass(repr=False) - class (Identity): - + class (Identity): + @@ -92,7 +114,7 @@ under Contract DE-AC05-76RL01830 - + @@ -116,17 +138,38 @@ under Contract DE-AC05-76RL01830 - + + + + + @stereotype(CIMStereotype.Description) + + + @stereotype(CIMStereotype.Concrete) + + + @stereotype(CIMStereotype.) + + + @dataclass(repr=False) + + + + + + + + - class (): + class (): @@ -135,7 +178,7 @@ under Contract DE-AC05-76RL01830 - + @@ -161,7 +204,7 @@ under Contract DE-AC05-76RL01830 - + @@ -206,10 +249,10 @@ under Contract DE-AC05-76RL01830 - + - + @@ -251,10 +294,10 @@ under Contract DE-AC05-76RL01830 - + - + @@ -308,13 +351,20 @@ under Contract DE-AC05-76RL01830 - + - + - class (Enum): + + + + + + + @stereotype(CIMStereotype.Enumeration) + class (Enum): @@ -322,7 +372,7 @@ under Contract DE-AC05-76RL01830 - + @@ -330,38 +380,89 @@ under Contract DE-AC05-76RL01830 - - - - - - - - - - @dataclass - class (): - - value: = field(default=None) - - + + + + + @stereotype(CIMStereotype.CIMDatatype) + @dataclass(repr=False) + class (CIMUnit): + + + + + + + + + + + + : = field(default=None) + + + + + + + + none + + + + + : = field(default=.) + + + + + + + + none + + + + + @property #read-only + + + def (self): + + + return . + + + + + + + none + + + + + def __init__(self, value, input_unit:str='', input_multiplier:str=None): + + + self.__pint__(value = value, input_unit=input_unit, input_multiplier=input_multiplier) + + - - - + - + @@ -374,17 +475,17 @@ under Contract DE-AC05-76RL01830 'minOccurs': '', 'maxOccurs': '', 'namespace': '#' - + - - - + + + - + @@ -398,17 +499,40 @@ under Contract DE-AC05-76RL01830 'maxOccurs': '', 'inverse': '', 'namespace': '#' - + - - - + + + - + + + + + + 'type': '', + + + 'type': 'Attribute', + + 'minOccurs': '', + 'maxOccurs': '', + 'namespace': '#' + + + + + + + + + + + @@ -428,9 +552,9 @@ under Contract DE-AC05-76RL01830 - + - + @@ -443,50 +567,89 @@ under Contract DE-AC05-76RL01830 str - + - + + + + + + + - _and - _as - _assert - _break - _class - _continue - _def - _del - _elif - _else - _except - _finally - _for - _from - _global - _if - _import - _in - _is - _lambda - _nonlocal - _not - _or - _pass - _raise - _return - _try - _while - _with - _yield - + _ + _and + _as + _assert + _break + _class + _continue + _def + _del + _elif + _else + _except + _finally + _for + _from + _global + _if + _import + _in + _is + _lambda + _nonlocal + _not + _or + _pass + _raise + _return + _try + _while + _with + _yield + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + From 148a5d47bcd0d5b8bb56cb4807c64ff034bc5885 Mon Sep 17 00:00:00 2001 From: "Dr. Alex A. Anderson" Date: Tue, 1 Jul 2025 14:24:03 -0700 Subject: [PATCH 2/2] update to XSL 3.0 for InverseReference --- .../cimantic-graphs/cimantic-graphs.xsl | 925 +++++++----------- 1 file changed, 379 insertions(+), 546 deletions(-) diff --git a/shipped-builders/cimantic-graphs/cimantic-graphs.xsl b/shipped-builders/cimantic-graphs/cimantic-graphs.xsl index 6fe9d78..b2fc6c8 100644 --- a/shipped-builders/cimantic-graphs/cimantic-graphs.xsl +++ b/shipped-builders/cimantic-graphs/cimantic-graphs.xsl @@ -1,89 +1,158 @@ - + xmlns:fn="http://www.w3.org/2005/xpath-functions" + xmlns:local="urn:local-functions" + xmlns="http://langdale.com.au/2009/Indent" + exclude-result-prefixes="xs fn local"> + + - - - - - Profile - au.com.langdale.cimtool.generated + + + + + + - + + + + + + - - from __future__ import annotations - import logging - from dataclasses import dataclass, field - from typing import Optional - from enum import Enum - from cimgraph.data_profile.identity import Identity, CIMStereotype, stereotype - from cimgraph.data_profile.units import CIMUnit - _log = logging.getLogger(__name__) - - - Annotated CIMantic Graphs data profile for - Generated by CIMTool http://cimtool.org - - - + + + + + + + BASE_URI = '' ONTOLOGY_URI = '#' - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - + + + + from __future__ import annotations + import logging + from dataclasses import dataclass, field + from typing import Optional + from enum import Enum + from cimgraph.data_profile.identity import Identity, CIMStereotype, stereotype + from cimgraph.data_profile.units import CIMUnit, UnitSymbol, UnitMultiplier + _log = logging.getLogger(__name__) + + + + + + Annotated CIMantic Graphs data profile for + Generated by CIMTool http://cimtool.org + + + + - - + + + + + + @dataclass(repr=False) + class (Identity): + + + + + + + + + + + + + + + + + + + + + @dataclass(repr=False) + + + class (): + + + + + + + + + + + + + + + + + + + + @@ -92,564 +161,328 @@ @stereotype(CIMStereotype.Concrete) + + @stereotype(CIMStereotype.ByReference) + @stereotype(CIMStereotype.) - - - - - - - - - @dataclass(repr=False) - class (Identity): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @stereotype(CIMStereotype.Description) - - - @stereotype(CIMStereotype.Concrete) - - - @stereotype(CIMStereotype.) - - - - - @dataclass(repr=False) - - - - - - - - - - class (): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + + - - - - - - - - - - - - + + + + + + + + - + - : Optional[ - ] = field( + : Optional[] = field( + + default=None, + - : Optional[ - | - ] = field( + : list[] = field( + + default_factory=list, + + - default = None, + metadata={ + + }) - + + + + + + + + + + + + + + + + + + + + - metadata = { + + : Optional[ + + + + + + | + + + ] = field( + + - + default=None, + metadata={ + + }) - }) - - - - - - + + + + + + + + + + + - - - + - - - - - - - - - - - - - - - - - - - - : Optional[ - ] = field( - - - default = None, - - + + + + + - metadata = { + + : Optional[] = field( + + - + default=None, + metadata={ + + }) - }) - - - - - - + + + + + + + + + + + - - - + - - - - - - - - - - - - - - : Optional[] = field( - - - default = None, - - - - - - - - - - - - - - - : list[] = field( - - - default_factory = list, - - - + + + - metadata = { + + + + : Optional[] = field( + + + default=None, + + + + + : list[] = field( + + + default_factory=list, + + + + - + metadata={ + + }) - }) - - - - - - + + + + + + + + + + + - - - + - - - - - - - - + + + @stereotype(CIMStereotype.Enumeration) - class (Enum): - - - - - - - + class (Enum): + + - + - + = '' + + + + + + + + + + - + - - + @stereotype(CIMStereotype.CIMDatatype) @dataclass(repr=False) class (CIMUnit): - - - - - - + - + - - - - - + - : = field(default=None) + : = field(default=None) - + - - - none - - - + - : = field(default=.) + : = field(default=.) - + - - - none - - - + - @property #read-only - - - def (self): - - - return . + @property # read-only + def (self): + + return . + - - - - none - - - + + - def __init__(self, value, input_unit:str='', input_multiplier:str=None): - - - self.__pint__(value = value, input_unit=input_unit, input_multiplier=input_multiplier) + def __init__(self, value, input_unit: str='', input_multiplier: str=None): + + self.__pint__(value=value, input_unit=input_unit, input_multiplier=input_multiplier) + - - - - - - - - - - - - - - - 'type': '', - - - 'type': 'Attribute', - - 'minOccurs': '', - 'maxOccurs': '', - 'namespace': '#' - - - - - - - - - + - - - - - - 'type': '', - - - 'type': 'Association', - - 'minOccurs': '', - 'maxOccurs': '', - 'inverse': '', - 'namespace': '#' - - - - - - - - - + + + + 'type': '', + 'minOccurs': '', + 'maxOccurs': '', + 'namespace': '#' - - - - - - 'type': '', - - - 'type': 'Attribute', - - 'minOccurs': '', - 'maxOccurs': '', - 'namespace': '#' - - - - - - - - - + + + + 'type': '', + 'minOccurs': '', + 'maxOccurs': '', + 'inverse': '', + 'namespace': '#' - - - - - - - - - - - - = '' - - - - - - - - - + + + + 'type': '', + 'minOccurs': '', + 'maxOccurs': '', + 'inverse': '', + 'namespace': '#' - - - - + + + + - str - int - float - float - bool + str + str + int + float + float + bool str - - - - - - + + + + + + - - - - - + + - - - _ - _and - _as - _assert - _break - _class - _continue - _def - _del - _elif - _else - _except - _finally - _for - _from - _global - _if - _import - _in - _is - _lambda - _nonlocal - _not - _or - _pass - _raise - _return - _try - _while - _with - _yield - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + \ No newline at end of file