@ifc-lite/ids 1.15.47 → 1.15.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit/coherence/index.js +8 -8
- package/dist/audit/coherence/index.js.map +1 -1
- package/dist/bridge/data-accessor.d.ts +3 -2
- package/dist/bridge/data-accessor.d.ts.map +1 -1
- package/dist/bridge/data-accessor.js +15 -2
- package/dist/bridge/data-accessor.js.map +1 -1
- package/dist/bridge/index.d.ts +3 -3
- package/dist/bridge/index.js +3 -3
- package/dist/bridge/properties.d.ts.map +1 -1
- package/dist/bridge/properties.js +47 -1
- package/dist/bridge/properties.js.map +1 -1
- package/dist/constraints/comparators.d.ts +18 -4
- package/dist/constraints/comparators.d.ts.map +1 -1
- package/dist/constraints/comparators.js +22 -13
- package/dist/constraints/comparators.js.map +1 -1
- package/dist/constraints/xsd-cast.d.ts.map +1 -1
- package/dist/constraints/xsd-cast.js +7 -2
- package/dist/constraints/xsd-cast.js.map +1 -1
- package/dist/facets/entity-facet.d.ts.map +1 -1
- package/dist/facets/entity-facet.js +68 -60
- package/dist/facets/entity-facet.js.map +1 -1
- package/dist/facets/ifc2x3-type-mapping.d.ts +45 -0
- package/dist/facets/ifc2x3-type-mapping.d.ts.map +1 -0
- package/dist/facets/ifc2x3-type-mapping.js +88 -0
- package/dist/facets/ifc2x3-type-mapping.js.map +1 -0
- package/dist/facets/partof-facet.d.ts.map +1 -1
- package/dist/facets/partof-facet.js +14 -32
- package/dist/facets/partof-facet.js.map +1 -1
- package/dist/facets/predefined-type-match.d.ts +65 -0
- package/dist/facets/predefined-type-match.d.ts.map +1 -0
- package/dist/facets/predefined-type-match.js +26 -0
- package/dist/facets/predefined-type-match.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/validator.d.ts.map +1 -1
- package/dist/validation/validator.js +9 -0
- package/dist/validation/validator.js.map +1 -1
- package/package.json +8 -6
|
@@ -2,8 +2,45 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
import { matchConstraint, formatConstraint } from '../constraints/index.js';
|
|
5
|
-
|
|
5
|
+
import { IFC2X3_MAPPED_ALIASES, rowsForOccurrence } from './ifc2x3-type-mapping.js';
|
|
6
|
+
import { matchPredefinedType } from './predefined-type-match.js';
|
|
7
|
+
/** IFC entity NAME comparisons are case-insensitive per IDS spec. Predefined
|
|
8
|
+
* types are NOT — see `predefined-type-match.ts`. */
|
|
6
9
|
const IFC_CASE_INSENSITIVE = { caseInsensitive: true };
|
|
10
|
+
/**
|
|
11
|
+
* Does `facet.name` match this entity through buildingSMART's IFC2X3
|
|
12
|
+
* occurrence/type mapping table, when a direct type-name comparison
|
|
13
|
+
* already failed?
|
|
14
|
+
*
|
|
15
|
+
* "The following table lists all special cases for checking IFC2X3
|
|
16
|
+
* models['] identification of model subsets is further restricted by
|
|
17
|
+
* the type object." — an IDS facet naming an IFC4-only class
|
|
18
|
+
* (`IfcAirTerminal`) must still match the IFC2X3 (occurrence, type)
|
|
19
|
+
* pair that represents it (`IfcFlowTerminal` typed by
|
|
20
|
+
* `IfcAirTerminalType`).
|
|
21
|
+
* https://github.com/buildingSMART/IDS/blob/master/Documentation/ImplementersDocumentation/ifc2x3-occurrence-type-mapping-table.md
|
|
22
|
+
*
|
|
23
|
+
* Scoped to IFC2X3: IFC4+ already has a dedicated class for every alias
|
|
24
|
+
* in the table, so this must not also fire there.
|
|
25
|
+
*/
|
|
26
|
+
function matchesIfc2x3Mapping(facet, entityType, expressId, accessor) {
|
|
27
|
+
if ((accessor.getSchemaVersion?.() || '').toUpperCase() !== 'IFC2X3')
|
|
28
|
+
return false;
|
|
29
|
+
const rows = rowsForOccurrence(entityType.toUpperCase());
|
|
30
|
+
if (rows.length === 0)
|
|
31
|
+
return false;
|
|
32
|
+
const typeEntityType = accessor.getTypeEntityType?.(expressId);
|
|
33
|
+
if (!typeEntityType)
|
|
34
|
+
return false;
|
|
35
|
+
const typeEntityUpper = typeEntityType.toUpperCase();
|
|
36
|
+
for (const row of rows) {
|
|
37
|
+
if (row.typeEntity !== typeEntityUpper)
|
|
38
|
+
continue;
|
|
39
|
+
if (matchConstraint(facet.name, row.alias, IFC_CASE_INSENSITIVE))
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
7
44
|
/**
|
|
8
45
|
* Check if an entity matches an entity facet
|
|
9
46
|
*/
|
|
@@ -41,7 +78,8 @@ export function checkEntityFacet(facet, expressId, accessor) {
|
|
|
41
78
|
};
|
|
42
79
|
}
|
|
43
80
|
// Check entity type (case-insensitive per IDS spec — IFC entity names are case-agnostic)
|
|
44
|
-
if (!matchConstraint(facet.name, entityType, IFC_CASE_INSENSITIVE)
|
|
81
|
+
if (!matchConstraint(facet.name, entityType, IFC_CASE_INSENSITIVE) &&
|
|
82
|
+
!matchesIfc2x3Mapping(facet, entityType, expressId, accessor)) {
|
|
45
83
|
return {
|
|
46
84
|
passed: false,
|
|
47
85
|
actualValue: entityType,
|
|
@@ -54,20 +92,13 @@ export function checkEntityFacet(facet, expressId, accessor) {
|
|
|
54
92
|
},
|
|
55
93
|
};
|
|
56
94
|
}
|
|
57
|
-
// Check predefined type if specified
|
|
95
|
+
// Check predefined type if specified. The matching rule itself lives
|
|
96
|
+
// in `predefined-type-match.ts` — shared verbatim with the partOf
|
|
97
|
+
// facet, whose nested `<entity>` is the same IDS construct. Only the
|
|
98
|
+
// failure wording below is entity-facet-specific.
|
|
58
99
|
if (facet.predefinedType) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// (BEAM, USERDEFINED, NOTDEFINED, …) — case-insensitive.
|
|
62
|
-
// 2. When the raw token is `USERDEFINED`, fall back to the
|
|
63
|
-
// user-defined name (`ObjectType`/`ElementType`/`ProcessType`)
|
|
64
|
-
// — case-sensitive.
|
|
65
|
-
// The order matters: a fixture asking for `USERDEFINED` literally
|
|
66
|
-
// must match an entity whose enum is `USERDEFINED` regardless of
|
|
67
|
-
// its accompanying user-defined name.
|
|
68
|
-
const rawType = accessor.getPredefinedTypeRaw?.(expressId);
|
|
69
|
-
const userDefinedType = accessor.getObjectType(expressId);
|
|
70
|
-
if (!rawType && !userDefinedType) {
|
|
100
|
+
const outcome = matchPredefinedType(facet.predefinedType, accessor.getPredefinedTypeRaw?.(expressId), accessor.getObjectType(expressId));
|
|
101
|
+
if (outcome.kind === 'absent') {
|
|
71
102
|
return {
|
|
72
103
|
passed: false,
|
|
73
104
|
actualValue: entityType,
|
|
@@ -79,37 +110,15 @@ export function checkEntityFacet(facet, expressId, accessor) {
|
|
|
79
110
|
},
|
|
80
111
|
};
|
|
81
112
|
}
|
|
82
|
-
|
|
83
|
-
// Predefined-type enum tokens (BEAM, USERDEFINED, …) MUST be
|
|
84
|
-
// uppercase per the IFC schema, and the IDS literal MUST match
|
|
85
|
-
// exactly. Case-sensitive comparison is the spec.
|
|
86
|
-
if (rawType && matchConstraint(facet.predefinedType, rawType)) {
|
|
87
|
-
matched = true;
|
|
88
|
-
}
|
|
89
|
-
else if (rawType === 'USERDEFINED' &&
|
|
90
|
-
userDefinedType &&
|
|
91
|
-
userDefinedType !== rawType &&
|
|
92
|
-
matchConstraint(facet.predefinedType, userDefinedType)) {
|
|
93
|
-
// Case-sensitive comparison for user-defined names.
|
|
94
|
-
matched = true;
|
|
95
|
-
}
|
|
96
|
-
else if (!rawType &&
|
|
97
|
-
userDefinedType &&
|
|
98
|
-
matchConstraint(facet.predefinedType, userDefinedType)) {
|
|
99
|
-
// No raw enum reported (legacy accessor) — case-sensitive match
|
|
100
|
-
// against the substituted form.
|
|
101
|
-
matched = true;
|
|
102
|
-
}
|
|
103
|
-
if (!matched) {
|
|
104
|
-
const display = userDefinedType || rawType || '(none)';
|
|
113
|
+
if (outcome.kind === 'mismatch') {
|
|
105
114
|
return {
|
|
106
115
|
passed: false,
|
|
107
|
-
actualValue: `${entityType}[${
|
|
116
|
+
actualValue: `${entityType}[${outcome.actual}]`,
|
|
108
117
|
expectedValue: `${formatConstraint(facet.name)} with predefinedType ${formatConstraint(facet.predefinedType)}`,
|
|
109
118
|
failure: {
|
|
110
119
|
type: 'PREDEFINED_TYPE_MISMATCH',
|
|
111
120
|
field: 'predefinedType',
|
|
112
|
-
actual:
|
|
121
|
+
actual: outcome.actual,
|
|
113
122
|
expected: formatConstraint(facet.predefinedType),
|
|
114
123
|
},
|
|
115
124
|
};
|
|
@@ -144,29 +153,12 @@ export function entityFacetPasses(facet, expressId, accessor) {
|
|
|
144
153
|
facet.name.value !== facet.name.value.toUpperCase()) {
|
|
145
154
|
return false;
|
|
146
155
|
}
|
|
147
|
-
if (!matchConstraint(facet.name, entityType, IFC_CASE_INSENSITIVE)
|
|
156
|
+
if (!matchConstraint(facet.name, entityType, IFC_CASE_INSENSITIVE) &&
|
|
157
|
+
!matchesIfc2x3Mapping(facet, entityType, expressId, accessor)) {
|
|
148
158
|
return false;
|
|
149
159
|
}
|
|
150
160
|
if (facet.predefinedType) {
|
|
151
|
-
|
|
152
|
-
const userDefinedType = accessor.getObjectType(expressId);
|
|
153
|
-
if (!rawType && !userDefinedType)
|
|
154
|
-
return false;
|
|
155
|
-
if (rawType && matchConstraint(facet.predefinedType, rawType)) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
if (rawType === 'USERDEFINED' &&
|
|
159
|
-
userDefinedType &&
|
|
160
|
-
userDefinedType !== rawType &&
|
|
161
|
-
matchConstraint(facet.predefinedType, userDefinedType)) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
if (!rawType &&
|
|
165
|
-
userDefinedType &&
|
|
166
|
-
matchConstraint(facet.predefinedType, userDefinedType)) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
return false;
|
|
161
|
+
return (matchPredefinedType(facet.predefinedType, accessor.getPredefinedTypeRaw?.(expressId), accessor.getObjectType(expressId)).kind === 'match');
|
|
170
162
|
}
|
|
171
163
|
return true;
|
|
172
164
|
}
|
|
@@ -175,12 +167,28 @@ export function entityFacetPasses(facet, expressId, accessor) {
|
|
|
175
167
|
*/
|
|
176
168
|
export function filterByEntityFacet(facet, accessor) {
|
|
177
169
|
const constraint = facet.name;
|
|
170
|
+
// IFC2X3: a literal naming a mapping-table alias (`IFCAIRTERMINAL`)
|
|
171
|
+
// never appears as an actual entity type in the model — only its
|
|
172
|
+
// mapped occurrence class does (`IFCFLOWTERMINAL`). A type-indexed
|
|
173
|
+
// broadphase filter keyed on the alias itself would come back empty
|
|
174
|
+
// and wrongly prune every candidate before the per-entity check (and
|
|
175
|
+
// its type-object lookup) ever runs. Falling back to a full scan
|
|
176
|
+
// keeps `matchesIfc2x3Mapping` as the single source of truth instead
|
|
177
|
+
// of duplicating its (occurrence, type) resolution here.
|
|
178
|
+
const isIfc2x3 = (accessor.getSchemaVersion?.() || '').toUpperCase() === 'IFC2X3';
|
|
178
179
|
// For simple values, we can efficiently filter by type
|
|
179
180
|
if (constraint.type === 'simpleValue') {
|
|
181
|
+
if (isIfc2x3 && IFC2X3_MAPPED_ALIASES.has(constraint.value.toUpperCase())) {
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
180
184
|
return accessor.getEntitiesByType(constraint.value);
|
|
181
185
|
}
|
|
182
186
|
// For enumerations, collect entities of all specified types
|
|
183
187
|
if (constraint.type === 'enumeration') {
|
|
188
|
+
if (isIfc2x3 &&
|
|
189
|
+
constraint.values.some((v) => IFC2X3_MAPPED_ALIASES.has(v.toUpperCase()))) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
184
192
|
const ids = [];
|
|
185
193
|
for (const value of constraint.values) {
|
|
186
194
|
ids.push(...accessor.getEntitiesByType(value));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-facet.js","sourceRoot":"","sources":["../../src/facets/entity-facet.ts"],"names":[],"mappings":"AAAA;;+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ACb,CAAC;IAED,kDAAkD;IAClD,gDAAgD;IAChD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyB,EACzB,QAAkB;IAElB,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,CAC1D,CAAC;QACJ,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3B,UAAU,CAAC,MAAM,CAAC,IAAI,CACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAC3C,CACF,CAAC;QACJ,KAAK,SAAS;YACZ,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC;gBACzD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC;gBACP,uEAAuE;gBACvE,yDAAyD;gBACzD,qEAAqE;gBACrE,gDAAgD;gBAChD,OAAO,EAAE,CAAC;YACZ,CAAC;QACH;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildingSMART's IFC2X3 occurrence/type mapping table.
|
|
3
|
+
*
|
|
4
|
+
* IFC2X3 predates several IFC4 entity classes (`IfcAirTerminal`,
|
|
5
|
+
* `IfcFilter`, `IfcValve`, …). An IFC2X3 model represents those concepts
|
|
6
|
+
* with a generic occurrence class (`IfcFlowTerminal`, `IfcFlowController`,
|
|
7
|
+
* …) related to a specific type object (`IfcAirTerminalType`,
|
|
8
|
+
* `IfcFilterType`, …) via `IfcRelDefinesByType`. The IDS spec defines this
|
|
9
|
+
* table so an entity facet can name the IFC4-only class and still match
|
|
10
|
+
* the equivalent IFC2X3 (occurrence, type) pair:
|
|
11
|
+
*
|
|
12
|
+
* "The following table lists all special cases for checking IFC2X3
|
|
13
|
+
* models[.] ... [F]or example, the definition of an IDS applicability
|
|
14
|
+
* facet with entity `IfcFilter`, should result in the identification of
|
|
15
|
+
* all `IfcFlowTreatmentDevice` that are associated with a type
|
|
16
|
+
* `IfcFilterType`."
|
|
17
|
+
*
|
|
18
|
+
* Source (CC BY-ND 4.0, (c) buildingSMART International Ltd):
|
|
19
|
+
* https://github.com/buildingSMART/IDS/blob/master/Documentation/ImplementersDocumentation/ifc2x3-occurrence-type-mapping-table.md
|
|
20
|
+
*
|
|
21
|
+
* Scoped to IFC2X3 only — callers must gate on schema version before
|
|
22
|
+
* consulting this table. IFC4+ already has real classes for every alias
|
|
23
|
+
* below, so applying the same fallback there would let a facet match an
|
|
24
|
+
* entity typed by the *old* IFC2X3-style pairing when the model should
|
|
25
|
+
* have used the dedicated class instead.
|
|
26
|
+
*/
|
|
27
|
+
/** One row of the table: an IDS-facet-visible alias mapped to its IFC2X3 (occurrence, type) pair. */
|
|
28
|
+
export interface Ifc2x3TypeMappingRow {
|
|
29
|
+
/** The entity name an IDS facet may specify (e.g. `IFCAIRTERMINAL`). Uppercase. */
|
|
30
|
+
alias: string;
|
|
31
|
+
/** The actual IFC2X3 occurrence class (e.g. `IFCFLOWTERMINAL`). Uppercase. */
|
|
32
|
+
occurrence: string;
|
|
33
|
+
/** The IFC2X3 type class the occurrence must be related to (e.g. `IFCAIRTERMINALTYPE`). Uppercase. */
|
|
34
|
+
typeEntity: string;
|
|
35
|
+
}
|
|
36
|
+
/** Every alias name any row maps to — used for the applicability broadphase. */
|
|
37
|
+
export declare const IFC2X3_MAPPED_ALIASES: ReadonlySet<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Rows whose occurrence class is `occurrenceType` (already uppercase),
|
|
40
|
+
* or an empty array when nothing in the table maps to it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rowsForOccurrence(occurrenceType: string): readonly Ifc2x3TypeMappingRow[];
|
|
43
|
+
/** The row whose alias is `alias` (already uppercase), if any. */
|
|
44
|
+
export declare function rowForAlias(alias: string): Ifc2x3TypeMappingRow | undefined;
|
|
45
|
+
//# sourceMappingURL=ifc2x3-type-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc2x3-type-mapping.d.ts","sourceRoot":"","sources":["../../src/facets/ifc2x3-type-mapping.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,qGAAqG;AACrG,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,sGAAsG;IACtG,UAAU,EAAE,MAAM,CAAC;CACpB;AAyED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAqC,CAAC;AAE5F;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,oBAAoB,EAAE,CAEzF;AAED,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE3E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
const ROWS = [
|
|
5
|
+
{ alias: 'IFCFURNITURE', occurrence: 'IFCFURNISHINGELEMENT', typeEntity: 'IFCFURNITURETYPE' },
|
|
6
|
+
{ alias: 'IFCSYSTEMFURNITUREELEMENT', occurrence: 'IFCFURNISHINGELEMENT', typeEntity: 'IFCSYSTEMFURNITUREELEMENTTYPE' },
|
|
7
|
+
{ alias: 'IFCACTUATOR', occurrence: 'IFCDISTRIBUTIONCONTROLELEMENT', typeEntity: 'IFCACTUATORTYPE' },
|
|
8
|
+
{ alias: 'IFCALARM', occurrence: 'IFCDISTRIBUTIONCONTROLELEMENT', typeEntity: 'IFCALARMTYPE' },
|
|
9
|
+
{ alias: 'IFCCONTROLLER', occurrence: 'IFCDISTRIBUTIONCONTROLELEMENT', typeEntity: 'IFCCONTROLLERTYPE' },
|
|
10
|
+
{ alias: 'IFCFLOWINSTRUMENT', occurrence: 'IFCDISTRIBUTIONCONTROLELEMENT', typeEntity: 'IFCFLOWINSTRUMENTTYPE' },
|
|
11
|
+
{ alias: 'IFCSENSOR', occurrence: 'IFCDISTRIBUTIONCONTROLELEMENT', typeEntity: 'IFCSENSORTYPE' },
|
|
12
|
+
{ alias: 'IFCAIRTOAIRHEATRECOVERY', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCAIRTOAIRHEATRECOVERYTYPE' },
|
|
13
|
+
{ alias: 'IFCBOILER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCBOILERTYPE' },
|
|
14
|
+
{ alias: 'IFCCHILLER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCCHILLERTYPE' },
|
|
15
|
+
{ alias: 'IFCCOIL', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCCOILTYPE' },
|
|
16
|
+
{ alias: 'IFCCONDENSER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCCONDENSERTYPE' },
|
|
17
|
+
{ alias: 'IFCCOOLEDBEAM', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCCOOLEDBEAMTYPE' },
|
|
18
|
+
{ alias: 'IFCCOOLINGTOWER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCCOOLINGTOWERTYPE' },
|
|
19
|
+
{ alias: 'IFCELECTRICGENERATOR', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCELECTRICGENERATORTYPE' },
|
|
20
|
+
{ alias: 'IFCELECTRICMOTOR', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCELECTRICMOTORTYPE' },
|
|
21
|
+
{ alias: 'IFCEVAPORATIVECOOLER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCEVAPORATIVECOOLERTYPE' },
|
|
22
|
+
{ alias: 'IFCEVAPORATOR', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCEVAPORATORTYPE' },
|
|
23
|
+
{ alias: 'IFCHEATEXCHANGER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCHEATEXCHANGERTYPE' },
|
|
24
|
+
{ alias: 'IFCHUMIDIFIER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCHUMIDIFIERTYPE' },
|
|
25
|
+
{ alias: 'IFCMOTORCONNECTION', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCMOTORCONNECTIONTYPE' },
|
|
26
|
+
{ alias: 'IFCSPACEHEATER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCSPACEHEATERTYPE' },
|
|
27
|
+
{ alias: 'IFCTRANSFORMER', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCTRANSFORMERTYPE' },
|
|
28
|
+
{ alias: 'IFCTUBEBUNDLE', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCTUBEBUNDLETYPE' },
|
|
29
|
+
{ alias: 'IFCUNITARYEQUIPMENT', occurrence: 'IFCENERGYCONVERSIONDEVICE', typeEntity: 'IFCUNITARYEQUIPMENTTYPE' },
|
|
30
|
+
{ alias: 'IFCAIRTERMINALBOX', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCAIRTERMINALBOXTYPE' },
|
|
31
|
+
{ alias: 'IFCDAMPER', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCDAMPERTYPE' },
|
|
32
|
+
{ alias: 'IFCELECTRICTIMECONTROL', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCELECTRICTIMECONTROLTYPE' },
|
|
33
|
+
{ alias: 'IFCFLOWMETER', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCFLOWMETERTYPE' },
|
|
34
|
+
{ alias: 'IFCPROTECTIVEDEVICE', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCPROTECTIVEDEVICETYPE' },
|
|
35
|
+
{ alias: 'IFCSWITCHINGDEVICE', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCSWITCHINGDEVICETYPE' },
|
|
36
|
+
{ alias: 'IFCVALVE', occurrence: 'IFCFLOWCONTROLLER', typeEntity: 'IFCVALVETYPE' },
|
|
37
|
+
{ alias: 'IFCCABLECARRIERFITTING', occurrence: 'IFCFLOWFITTING', typeEntity: 'IFCCABLECARRIERFITTINGTYPE' },
|
|
38
|
+
{ alias: 'IFCDUCTFITTING', occurrence: 'IFCFLOWFITTING', typeEntity: 'IFCDUCTFITTINGTYPE' },
|
|
39
|
+
{ alias: 'IFCJUNCTIONBOX', occurrence: 'IFCFLOWFITTING', typeEntity: 'IFCJUNCTIONBOXTYPE' },
|
|
40
|
+
{ alias: 'IFCPIPEFITTING', occurrence: 'IFCFLOWFITTING', typeEntity: 'IFCPIPEFITTINGTYPE' },
|
|
41
|
+
{ alias: 'IFCCOMPRESSOR', occurrence: 'IFCFLOWMOVINGDEVICE', typeEntity: 'IFCCOMPRESSORTYPE' },
|
|
42
|
+
{ alias: 'IFCFAN', occurrence: 'IFCFLOWMOVINGDEVICE', typeEntity: 'IFCFANTYPE' },
|
|
43
|
+
{ alias: 'IFCPUMP', occurrence: 'IFCFLOWMOVINGDEVICE', typeEntity: 'IFCPUMPTYPE' },
|
|
44
|
+
{ alias: 'IFCCABLECARRIERSEGMENT', occurrence: 'IFCFLOWSEGMENT', typeEntity: 'IFCCABLECARRIERSEGMENTTYPE' },
|
|
45
|
+
{ alias: 'IFCCABLESEGMENT', occurrence: 'IFCFLOWSEGMENT', typeEntity: 'IFCCABLESEGMENTTYPE' },
|
|
46
|
+
{ alias: 'IFCDUCTSEGMENT', occurrence: 'IFCFLOWSEGMENT', typeEntity: 'IFCDUCTSEGMENTTYPE' },
|
|
47
|
+
{ alias: 'IFCPIPESEGMENT', occurrence: 'IFCFLOWSEGMENT', typeEntity: 'IFCPIPESEGMENTTYPE' },
|
|
48
|
+
{ alias: 'IFCELECTRICFLOWSTORAGEDEVICE', occurrence: 'IFCFLOWSTORAGEDEVICE', typeEntity: 'IFCELECTRICFLOWSTORAGEDEVICETYPE' },
|
|
49
|
+
{ alias: 'IFCTANK', occurrence: 'IFCFLOWSTORAGEDEVICE', typeEntity: 'IFCTANKTYPE' },
|
|
50
|
+
{ alias: 'IFCAIRTERMINAL', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCAIRTERMINALTYPE' },
|
|
51
|
+
{ alias: 'IFCELECTRICAPPLIANCE', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCELECTRICAPPLIANCETYPE' },
|
|
52
|
+
{ alias: 'IFCFIRESUPPRESSIONTERMINAL', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCFIRESUPPRESSIONTERMINALTYPE' },
|
|
53
|
+
{ alias: 'IFCLAMP', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCLAMPTYPE' },
|
|
54
|
+
{ alias: 'IFCLIGHTFIXTURE', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCLIGHTFIXTURETYPE' },
|
|
55
|
+
{ alias: 'IFCOUTLET', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCOUTLETTYPE' },
|
|
56
|
+
{ alias: 'IFCSANITARYTERMINAL', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCSANITARYTERMINALTYPE' },
|
|
57
|
+
{ alias: 'IFCSTACKTERMINAL', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCSTACKTERMINALTYPE' },
|
|
58
|
+
{ alias: 'IFCWASTETERMINAL', occurrence: 'IFCFLOWTERMINAL', typeEntity: 'IFCWASTETERMINALTYPE' },
|
|
59
|
+
{ alias: 'IFCDUCTSILENCER', occurrence: 'IFCFLOWTREATMENTDEVICE', typeEntity: 'IFCDUCTSILENCERTYPE' },
|
|
60
|
+
{ alias: 'IFCFILTER', occurrence: 'IFCFLOWTREATMENTDEVICE', typeEntity: 'IFCFILTERTYPE' },
|
|
61
|
+
{ alias: 'IFCVIBRATIONISOLATOR', occurrence: 'IFCEQUIPMENTELEMENT', typeEntity: 'IFCVIBRATIONISOLATORTYPE' },
|
|
62
|
+
];
|
|
63
|
+
/** Rows indexed by occurrence class, for the (entityType, typeEntityType) → alias direction. */
|
|
64
|
+
const BY_OCCURRENCE = (() => {
|
|
65
|
+
const map = new Map();
|
|
66
|
+
for (const row of ROWS) {
|
|
67
|
+
const list = map.get(row.occurrence);
|
|
68
|
+
if (list)
|
|
69
|
+
list.push(row);
|
|
70
|
+
else
|
|
71
|
+
map.set(row.occurrence, [row]);
|
|
72
|
+
}
|
|
73
|
+
return map;
|
|
74
|
+
})();
|
|
75
|
+
/** Every alias name any row maps to — used for the applicability broadphase. */
|
|
76
|
+
export const IFC2X3_MAPPED_ALIASES = new Set(ROWS.map((r) => r.alias));
|
|
77
|
+
/**
|
|
78
|
+
* Rows whose occurrence class is `occurrenceType` (already uppercase),
|
|
79
|
+
* or an empty array when nothing in the table maps to it.
|
|
80
|
+
*/
|
|
81
|
+
export function rowsForOccurrence(occurrenceType) {
|
|
82
|
+
return BY_OCCURRENCE.get(occurrenceType) ?? [];
|
|
83
|
+
}
|
|
84
|
+
/** The row whose alias is `alias` (already uppercase), if any. */
|
|
85
|
+
export function rowForAlias(alias) {
|
|
86
|
+
return ROWS.find((r) => r.alias === alias);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=ifc2x3-type-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc2x3-type-mapping.js","sourceRoot":"","sources":["../../src/facets/ifc2x3-type-mapping.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAuC/D,MAAM,IAAI,GAAoC;IAC5C,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB,EAAE;IAC7F,EAAE,KAAK,EAAE,2BAA2B,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,EAAE,+BAA+B,EAAE;IACvH,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,+BAA+B,EAAE,UAAU,EAAE,iBAAiB,EAAE;IACpG,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,+BAA+B,EAAE,UAAU,EAAE,cAAc,EAAE;IAC9F,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,+BAA+B,EAAE,UAAU,EAAE,mBAAmB,EAAE;IACxG,EAAE,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,+BAA+B,EAAE,UAAU,EAAE,uBAAuB,EAAE;IAChH,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,+BAA+B,EAAE,UAAU,EAAE,eAAe,EAAE;IAChG,EAAE,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,2BAA2B,EAAE,UAAU,EAAE,6BAA6B,EAAE;IACxH,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,2BAA2B,EAAE,UAAU,EAAE,eAAe,EAAE;IAC5F,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,2BAA2B,EAAE,UAAU,EAAE,gBAAgB,EAAE;IAC9F,EAAE,K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tD,OAAO,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;AACjD,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partof-facet.d.ts","sourceRoot":"","sources":["../../src/facets/partof-facet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"partof-facet.d.ts","sourceRoot":"","sources":["../../src/facets/partof-facet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAmBnD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,eAAe,GACxB,gBAAgB,CAoDlB"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
import { matchConstraint, formatConstraint } from '../constraints/index.js';
|
|
5
|
-
|
|
5
|
+
import { matchPredefinedType } from './predefined-type-match.js';
|
|
6
|
+
/** IFC entity NAME comparisons are case-insensitive per IDS spec. Predefined
|
|
7
|
+
* types are NOT — see `predefined-type-match.ts`. */
|
|
6
8
|
const IFC_CASE_INSENSITIVE = { caseInsensitive: true };
|
|
7
9
|
/** Human-readable relation names */
|
|
8
10
|
const RELATION_NAMES = {
|
|
@@ -96,19 +98,15 @@ function checkAncestorAgainstFacet(facet, parent) {
|
|
|
96
98
|
},
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
// Check parent predefined type if specified.
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
// token first
|
|
103
|
-
// USERDEFINED
|
|
104
|
-
//
|
|
105
|
-
// PredefinedType is literally USERDEFINED but that also carries a
|
|
106
|
-
// custom name (ObjectType) must still match a facet asking for the
|
|
107
|
-
// literal "USERDEFINED" token, not just the custom name.
|
|
101
|
+
// Check parent predefined type if specified. The IDS XSD gives this
|
|
102
|
+
// nested `<entity>` the same complex type an entity facet uses, so the
|
|
103
|
+
// matching rule is the shared one in `predefined-type-match.ts` — the
|
|
104
|
+
// raw enum token first, the parent's user-defined name only as the
|
|
105
|
+
// USERDEFINED fallback, both compared case-sensitively. Only the
|
|
106
|
+
// PARTOF_-prefixed failure wording below is specific to this facet.
|
|
108
107
|
if (facet.entity.predefinedType) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (!rawType && !userDefinedType) {
|
|
108
|
+
const outcome = matchPredefinedType(facet.entity.predefinedType, parent.predefinedType, parent.objectType);
|
|
109
|
+
if (outcome.kind === 'absent') {
|
|
112
110
|
return {
|
|
113
111
|
passed: false,
|
|
114
112
|
actualValue: `${parent.entityType} (no predefinedType)`,
|
|
@@ -124,31 +122,15 @@ function checkAncestorAgainstFacet(facet, parent) {
|
|
|
124
122
|
},
|
|
125
123
|
};
|
|
126
124
|
}
|
|
127
|
-
|
|
128
|
-
if (rawType && matchConstraint(facet.entity.predefinedType, rawType, IFC_CASE_INSENSITIVE)) {
|
|
129
|
-
matched = true;
|
|
130
|
-
}
|
|
131
|
-
else if (rawType === 'USERDEFINED' &&
|
|
132
|
-
userDefinedType &&
|
|
133
|
-
userDefinedType !== rawType &&
|
|
134
|
-
matchConstraint(facet.entity.predefinedType, userDefinedType, IFC_CASE_INSENSITIVE)) {
|
|
135
|
-
matched = true;
|
|
136
|
-
}
|
|
137
|
-
else if (!rawType &&
|
|
138
|
-
userDefinedType &&
|
|
139
|
-
matchConstraint(facet.entity.predefinedType, userDefinedType, IFC_CASE_INSENSITIVE)) {
|
|
140
|
-
matched = true;
|
|
141
|
-
}
|
|
142
|
-
if (!matched) {
|
|
143
|
-
const display = userDefinedType || rawType || '(none)';
|
|
125
|
+
if (outcome.kind === 'mismatch') {
|
|
144
126
|
return {
|
|
145
127
|
passed: false,
|
|
146
|
-
actualValue: `${parent.entityType}[${
|
|
128
|
+
actualValue: `${parent.entityType}[${outcome.actual}]`,
|
|
147
129
|
expectedValue: `${formatConstraint(facet.entity.name)}[${formatConstraint(facet.entity.predefinedType)}]`,
|
|
148
130
|
failure: {
|
|
149
131
|
type: 'PARTOF_PREDEFINED_TYPE_MISMATCH',
|
|
150
132
|
field: 'predefinedType',
|
|
151
|
-
actual:
|
|
133
|
+
actual: outcome.actual,
|
|
152
134
|
expected: formatConstraint(facet.entity.predefinedType),
|
|
153
135
|
context: {
|
|
154
136
|
relation: facet.relation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partof-facet.js","sourceRoot":"","sources":["../../src/facets/partof-facet.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAqB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"partof-facet.js","sourceRoot":"","sources":["../../src/facets/partof-facet.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAqB,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;sDACsD;AACtD,MAAM,oBAAoB,GAAiB,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAErE,oCAAoC;AACpC,MAAM,cAAc,GAAmC;IACrD,gBAAgB,EAAE,eAA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
*
|
|
4
|
+
* The IDS XSD gives the entity facet and the `partOf` facet's nested
|
|
5
|
+
* `<entity>` element the SAME complex type, so both must resolve a
|
|
6
|
+
* `<predefinedType>` literal against the same two-branch rule. That rule
|
|
7
|
+
* used to be written out three times — twice in `entity-facet.ts`
|
|
8
|
+
* (`checkEntityFacet` and its diagnostics-free twin `entityFacetPasses`)
|
|
9
|
+
* and once in `partof-facet.ts` — and the copies drifted: the partOf one
|
|
10
|
+
* compared case-INSENSITIVELY where the entity ones compared
|
|
11
|
+
* case-sensitively, so one and the same (raw enum, user-defined name,
|
|
12
|
+
* literal) triple got opposite verdicts depending on which facet asked.
|
|
13
|
+
*
|
|
14
|
+
* The rule, per IDS spec and the buildingSMART test corpus:
|
|
15
|
+
*
|
|
16
|
+
* 1. Compare against the raw IFC `PredefinedType` enum token (`BEAM`,
|
|
17
|
+
* `USERDEFINED`, `NOTDEFINED`, …).
|
|
18
|
+
* 2. Only when that raw token is `USERDEFINED`, fall back to the
|
|
19
|
+
* user-defined name (`ObjectType`/`ElementType`/`ProcessType`).
|
|
20
|
+
* 3. When no raw token is reported at all (legacy accessors that do not
|
|
21
|
+
* implement `getPredefinedTypeRaw`), compare against the
|
|
22
|
+
* user-defined name directly.
|
|
23
|
+
*
|
|
24
|
+
* Both comparisons are CASE-SENSITIVE: enum tokens are uppercase by the
|
|
25
|
+
* IFC schema and the IDS literal must match them exactly, and the corpus
|
|
26
|
+
* pins the user-defined name the same way — `entity/`
|
|
27
|
+
* `fail-user_defined_types_are_checked_case_sensitively.ids` requires an
|
|
28
|
+
* `IfcWall` carrying `ObjectType = 'waldo'` to FAIL a facet asking for
|
|
29
|
+
* `WALDO`.
|
|
30
|
+
*
|
|
31
|
+
* Branch order matters: a facet asking for the literal `USERDEFINED`
|
|
32
|
+
* must match an entity whose enum IS `USERDEFINED`, whatever custom name
|
|
33
|
+
* accompanies it.
|
|
34
|
+
*
|
|
35
|
+
* Callers get a verdict, never the intermediate booleans — the failure
|
|
36
|
+
* wording (`PREDEFINED_TYPE_MISMATCH` vs `PARTOF_PREDEFINED_TYPE_MISMATCH`,
|
|
37
|
+
* and the surrounding `actualValue` phrasing) is the only part that
|
|
38
|
+
* legitimately differs between the two facets, so that is all each caller
|
|
39
|
+
* still owns.
|
|
40
|
+
*/
|
|
41
|
+
import type { IDSConstraint } from '../types.js';
|
|
42
|
+
export type PredefinedTypeMatch =
|
|
43
|
+
/** The constraint is satisfied. */
|
|
44
|
+
{
|
|
45
|
+
readonly kind: 'match';
|
|
46
|
+
}
|
|
47
|
+
/** Neither a raw enum token nor a user-defined name is available. */
|
|
48
|
+
| {
|
|
49
|
+
readonly kind: 'absent';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Something was available and it did not satisfy the constraint.
|
|
53
|
+
* `actual` is the display form both facets report — the user-defined
|
|
54
|
+
* name when there is one, else the raw token.
|
|
55
|
+
*/
|
|
56
|
+
| {
|
|
57
|
+
readonly kind: 'mismatch';
|
|
58
|
+
readonly actual: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Resolve an IDS `<predefinedType>` constraint against an entity's raw
|
|
62
|
+
* `PredefinedType` enum token and its user-defined name.
|
|
63
|
+
*/
|
|
64
|
+
export declare function matchPredefinedType(constraint: IDSConstraint, rawType: string | undefined, userDefinedType: string | undefined): PredefinedTypeMatch;
|
|
65
|
+
//# sourceMappingURL=predefined-type-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-type-match.d.ts","sourceRoot":"","sources":["../../src/facets/predefined-type-match.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,MAAM,mBAAmB;AAC7B,mCAAmC;AACjC;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE;AAC5B,qEAAqE;GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE;AAC7B;;;;GAIG;GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,mBAAmB,CAmBrB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { matchConstraint } from '../constraints/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve an IDS `<predefinedType>` constraint against an entity's raw
|
|
7
|
+
* `PredefinedType` enum token and its user-defined name.
|
|
8
|
+
*/
|
|
9
|
+
export function matchPredefinedType(constraint, rawType, userDefinedType) {
|
|
10
|
+
if (!rawType && !userDefinedType)
|
|
11
|
+
return { kind: 'absent' };
|
|
12
|
+
if (rawType && matchConstraint(constraint, rawType)) {
|
|
13
|
+
return { kind: 'match' };
|
|
14
|
+
}
|
|
15
|
+
if (rawType === 'USERDEFINED' &&
|
|
16
|
+
userDefinedType &&
|
|
17
|
+
userDefinedType !== rawType &&
|
|
18
|
+
matchConstraint(constraint, userDefinedType)) {
|
|
19
|
+
return { kind: 'match' };
|
|
20
|
+
}
|
|
21
|
+
if (!rawType && userDefinedType && matchConstraint(constraint, userDefinedType)) {
|
|
22
|
+
return { kind: 'match' };
|
|
23
|
+
}
|
|
24
|
+
return { kind: 'mismatch', actual: userDefinedType || rawType || '(none)' };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=predefined-type-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefined-type-match.js","sourceRoot":"","sources":["../../src/facets/predefined-type-match.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA4C/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAc1D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAyB,EACzB,OAA2B,EAC3B,eAAmC;IAEnC,IAAI,CAAC,OAAO,IAAI,CAAC,eAAe;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAE5D,IAAI,OAAO,IAAI,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,IACE,OAAO,KAAK,aAAa;QACzB,eAAe;QACf,eAAe,KAAK,OAAO;QAC3B,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,EAC5C,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,CAAC,OAAO,IAAI,eAAe,IAAI,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC;QAChF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;AAC9E,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -386,6 +386,22 @@ export interface IFCDataAccessor {
|
|
|
386
386
|
* type is unknown so callers fall back to permissive comparison.
|
|
387
387
|
*/
|
|
388
388
|
getAttributeXsdTypes?(expressId: number, attrName: string): readonly string[] | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* The model's raw IFC schema version string (e.g. `IFC2X3`, `IFC4`),
|
|
391
|
+
* when the accessor's backing store carries one. Used only for
|
|
392
|
+
* schema-scoped facet semantics — currently the IFC2X3
|
|
393
|
+
* occurrence/type mapping table (`facets/ifc2x3-type-mapping.ts`).
|
|
394
|
+
*/
|
|
395
|
+
getSchemaVersion?(): string | undefined;
|
|
396
|
+
/**
|
|
397
|
+
* The IFC entity class of the type object (`IfcXxxType`) this
|
|
398
|
+
* instance is related to via `IfcRelDefinesByType`, if any. Distinct
|
|
399
|
+
* from `getPredefinedTypeRaw`, which reads the type's
|
|
400
|
+
* `PredefinedType` *value*, not the type object's own entity class
|
|
401
|
+
* name — needed to resolve the IFC2X3 occurrence/type mapping table,
|
|
402
|
+
* where the alias is picked out by the TYPE's class, not its value.
|
|
403
|
+
*/
|
|
404
|
+
getTypeEntityType?(expressId: number): string | undefined;
|
|
389
405
|
/** Get all entity IDs of a specific type */
|
|
390
406
|
getEntitiesByType(typeName: string): number[];
|
|
391
407
|
/** Get all entity IDs */
|