From 0aa65f1b8b99ff04c4e2d27109b62fa9b7576d14 Mon Sep 17 00:00:00 2001 From: Claudio Benghi Date: Mon, 16 Oct 2023 23:57:42 +0200 Subject: [PATCH] Improved partOf facet audit. --- .../PartOfRelationInformation.md | 23 ++++++ .../PartOfRelationInformation/OwnerIfcType.md | 14 ++++ .../PartOfRelationInformation/PartIfcType.md | 14 ++++ .../PartOfRelationInformation.md | 14 ++++ .../RelationIfcName.md | 14 ++++ .../IdsLib.IfcSchema/SchemaInfo.md | 2 +- .../SchemaInfo/AllPartOfRelations.md | 4 +- ids-lib-documentation/ids-lib.md | 2 +- .../IfcSchema_PartOfRelationGenerator.cs | 82 +++++++++---------- .../IfcSchema_PropertiesGenerator.cs | 10 +-- .../IdsSchema/IdsNodes/Facets/IdsPartOf.cs | 44 +++++----- .../IfcOneToManyRelationInformation.cs | 38 --------- .../IfcSchema/PartOfRelationInformation.cs | 33 ++++++++ .../IfcSchema/SchemaInfo.PartOfRelations.g.cs | 34 ++++++-- ids-lib/IfcSchema/SchemaInfo.cs | 16 ---- ids-lib/LibraryInformation.cs | 2 +- ids-lib/Resources/XsdSchemas/ids.xsd | 6 +- ids-lib/ids-lib.csproj | 2 +- ids-tool.tests/bsFiles/ids.xsd | 6 +- ids-tool/ids-tool.csproj | 2 +- 20 files changed, 216 insertions(+), 146 deletions(-) create mode 100644 ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation.md create mode 100644 ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/OwnerIfcType.md create mode 100644 ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartIfcType.md create mode 100644 ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartOfRelationInformation.md create mode 100644 ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/RelationIfcName.md delete mode 100644 ids-lib/IfcSchema/IfcOneToManyRelationInformation.cs create mode 100644 ids-lib/IfcSchema/PartOfRelationInformation.cs diff --git a/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation.md b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation.md new file mode 100644 index 0000000..3a92b85 --- /dev/null +++ b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation.md @@ -0,0 +1,23 @@ +# PartOfRelationInformation class + +Metadata container for relations that are primarily one-to-many between IFC entities + +```csharp +public class PartOfRelationInformation +``` + +## Public Members + +| name | description | +| --- | --- | +| [PartOfRelationInformation](PartOfRelationInformation/PartOfRelationInformation.md)(…) | Default constructor, ensures static nullable analysis | +| [OwnerIfcType](PartOfRelationInformation/OwnerIfcType.md) { get; set; } | Name of the IFC entity on the owner-side of the one-to-many relation | +| [PartIfcType](PartOfRelationInformation/PartIfcType.md) { get; set; } | Name of the IFC entity on the part-side of the one-to-many relation | +| [RelationIfcName](PartOfRelationInformation/RelationIfcName.md) { get; set; } | Name of the IFC entity for the relation | + +## See Also + +* namespace [IdsLib.IfcSchema](../ids-lib.md) +* [PartOfRelationInformation.cs](https://github.com/buildingSMART/IDS-Audit-tool/tree/main/ids-lib/IfcSchema/PartOfRelationInformation.cs) + + diff --git a/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/OwnerIfcType.md b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/OwnerIfcType.md new file mode 100644 index 0000000..c50651c --- /dev/null +++ b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/OwnerIfcType.md @@ -0,0 +1,14 @@ +# PartOfRelationInformation.OwnerIfcType property + +Name of the IFC entity on the owner-side of the one-to-many relation + +```csharp +public string OwnerIfcType { get; set; } +``` + +## See Also + +* class [PartOfRelationInformation](../PartOfRelationInformation.md) +* namespace [IdsLib.IfcSchema](../../ids-lib.md) + + diff --git a/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartIfcType.md b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartIfcType.md new file mode 100644 index 0000000..d8f0d44 --- /dev/null +++ b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartIfcType.md @@ -0,0 +1,14 @@ +# PartOfRelationInformation.PartIfcType property + +Name of the IFC entity on the part-side of the one-to-many relation + +```csharp +public string PartIfcType { get; set; } +``` + +## See Also + +* class [PartOfRelationInformation](../PartOfRelationInformation.md) +* namespace [IdsLib.IfcSchema](../../ids-lib.md) + + diff --git a/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartOfRelationInformation.md b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartOfRelationInformation.md new file mode 100644 index 0000000..c2a155f --- /dev/null +++ b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/PartOfRelationInformation.md @@ -0,0 +1,14 @@ +# PartOfRelationInformation constructor + +Default constructor, ensures static nullable analysis + +```csharp +public PartOfRelationInformation(string relationName, string oneSideType, string manySideType = "") +``` + +## See Also + +* class [PartOfRelationInformation](../PartOfRelationInformation.md) +* namespace [IdsLib.IfcSchema](../../ids-lib.md) + + diff --git a/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/RelationIfcName.md b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/RelationIfcName.md new file mode 100644 index 0000000..10b4807 --- /dev/null +++ b/ids-lib-documentation/IdsLib.IfcSchema/PartOfRelationInformation/RelationIfcName.md @@ -0,0 +1,14 @@ +# PartOfRelationInformation.RelationIfcName property + +Name of the IFC entity for the relation + +```csharp +public string RelationIfcName { get; set; } +``` + +## See Also + +* class [PartOfRelationInformation](../PartOfRelationInformation.md) +* namespace [IdsLib.IfcSchema](../../ids-lib.md) + + diff --git a/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo.md b/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo.md index 7d1ae90..1743ba1 100644 --- a/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo.md +++ b/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo.md @@ -14,6 +14,7 @@ public class SchemaInfo : IEnumerable | static [SchemaIfc2x3](SchemaInfo/SchemaIfc2x3.md) { get; } | Static property for the Ifc2x3 schema | | static [SchemaIfc4](SchemaInfo/SchemaIfc4.md) { get; } | Static property for the Ifc4 schema | | static [SchemaIfc4x3](SchemaInfo/SchemaIfc4x3.md) { get; } | Static property for the Ifc4 schema | +| [AllPartOfRelations](SchemaInfo/AllPartOfRelations.md) { get; } | The names of classes across all schemas. | | [Item](SchemaInfo/Item.md) { get; } | Get the classinfo by name string. | | [PropertySets](SchemaInfo/PropertySets.md) { get; } | Provides access to the property sets of the schema | | [Version](SchemaInfo/Version.md) { get; } | The version of the schema represented in the info | @@ -25,7 +26,6 @@ public class SchemaInfo : IEnumerable | static [AllAttributes](SchemaInfo/AllAttributes.md) { get; } | The names of all attributes across all schemas. | | static [AllClasses](SchemaInfo/AllClasses.md) { get; } | The names of classes across all schemas. | | static [AllMeasures](SchemaInfo/AllMeasures.md) { get; } | The names of classes across all schemas. | -| static [AllPartOfRelations](SchemaInfo/AllPartOfRelations.md) { get; } | The names of classes across all schemas. | | static [GetSchemas](SchemaInfo/GetSchemas.md)(…) | Returns the schema metadata information for the required versions. | | static [TryParseIfcMeasure](SchemaInfo/TryParseIfcMeasure.md)(…) | Attempts to convert a string value to an instance of the IfcMeasureInformation | | enum [ClassAttributeMode](SchemaInfo.ClassAttributeMode.md) | Relation that allows to connect an available attribute to an entity | diff --git a/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo/AllPartOfRelations.md b/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo/AllPartOfRelations.md index 11a933d..242b2e5 100644 --- a/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo/AllPartOfRelations.md +++ b/ids-lib-documentation/IdsLib.IfcSchema/SchemaInfo/AllPartOfRelations.md @@ -3,12 +3,12 @@ The names of classes across all schemas. ```csharp -public static IEnumerable AllPartOfRelations { get; } +public IEnumerable AllPartOfRelations { get; } ``` ## See Also -* class [IfcOneToManyRelationInformation](../IfcOneToManyRelationInformation.md) +* class [PartOfRelationInformation](../PartOfRelationInformation.md) * class [SchemaInfo](../SchemaInfo.md) * namespace [IdsLib.IfcSchema](../../ids-lib.md) diff --git a/ids-lib-documentation/ids-lib.md b/ids-lib-documentation/ids-lib.md index 69c40ac..f1dbf9d 100644 --- a/ids-lib-documentation/ids-lib.md +++ b/ids-lib-documentation/ids-lib.md @@ -31,12 +31,12 @@ | class [IfcAttributeInformation](./IdsLib.IfcSchema/IfcAttributeInformation.md) | Metadata container for attributes of entities in IfcSchema | | class [IfcClassInformation](./IdsLib.IfcSchema/IfcClassInformation.md) | Metadata container for entities of an IfcSchema | | class [IfcMeasureInformation](./IdsLib.IfcSchema/IfcMeasureInformation.md) | Metadata container for entities containing measures of an IfcSchema | -| class [IfcOneToManyRelationInformation](./IdsLib.IfcSchema/IfcOneToManyRelationInformation.md) | Metadata container for relations that are primarily one-to-many between IFC entities | | class [IfcSchemaAttribute](./IdsLib.IfcSchema/IfcSchemaAttribute.md) | Metadata attribute to define if a value of [`IfcSchemaVersions`](./IdsLib.IfcSchema/IfcSchemaVersions.md) identifies a single version of the schema | | [Flags] enum [IfcSchemaVersions](./IdsLib.IfcSchema/IfcSchemaVersions.md) | Enumerations for the identification of multiple schema versions. | | interface [IPropertyTypeInfo](./IdsLib.IfcSchema/IPropertyTypeInfo.md) | Generalised metadata on IFC properties | | static class [IPropertyTypeInfoExtensions](./IdsLib.IfcSchema/IPropertyTypeInfoExtensions.md) | Static class to contain extension method helpers for [`IPropertyTypeInfo`](./IdsLib.IfcSchema/IPropertyTypeInfo.md). | | class [NamedPropertyType](./IdsLib.IfcSchema/NamedPropertyType.md) | Schema metadata for properties with name | +| class [PartOfRelationInformation](./IdsLib.IfcSchema/PartOfRelationInformation.md) | Metadata container for relations that are primarily one-to-many between IFC entities | | class [PropertySetInfo](./IdsLib.IfcSchema/PropertySetInfo.md) | Information about standard property sets defined from bS | | class [SchemaInfo](./IdsLib.IfcSchema/SchemaInfo.md) | Provides static methods to get the collection of classes in the published schemas. | | class [SingleValuePropertyType](./IdsLib.IfcSchema/SingleValuePropertyType.md) | Schema metadata for single value properties | diff --git a/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs b/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs index 0ffa4bc..a99ff50 100644 --- a/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs +++ b/ids-lib.codegen/IfcSchema_PartOfRelationGenerator.cs @@ -1,42 +1,19 @@ using System.Text; using Xbim.Common.Metadata; +using static NSubstitute.Arg; namespace IdsLib.codegen; public class IfcSchema_PartOfRelationGenerator { - private class GenOneToManyRelationInfo - { - public void AddSchema(string schema, string oneType, string manyType) - { - Schemas.Add(schema); - if (manyType != ManyType) - throw new ArgumentException($"Inconsistent type across schemas on enumerable side of the {RelationName} relation ({manyType} vs. {ManyType}), we need to rethink auditing logic."); - if (oneType != OneType) - throw new ArgumentException($"Inconsistent type across schemas on one-side of the {RelationName} relation ({oneType} vs. {OneType}), we need to rethink auditing logic."); - } - - public GenOneToManyRelationInfo(string relationName, string schema, string oneType, string enumerableType) - { - RelationName = relationName; - OneType = oneType; - ManyType = enumerableType; - Schemas = new List() { schema }; - } - - internal List Schemas { get; set; } - internal string ManyType { get; set; } - internal string OneType { get; set; } - internal string RelationName { get; set; } - } - internal static string Execute() { var relationNames = GetRelationNames(); - var measureInfos = new Dictionary(); + var schemaInfos = new Dictionary(); foreach (var schema in Program.schemas) { + var sb = new StringBuilder(); System.Reflection.Module module = SchemaHelper.GetModule(schema); var metaD = ExpressMetaData.GetMetadata(module); foreach (var daRelation in relationNames) @@ -46,34 +23,39 @@ internal static string Execute() var t = metaD.ExpressType(daRelation.ToUpperInvariant()); if (t is null) continue; - - var propOnManySide = t.Properties.Single(x => x.Value.EnumerableType is not null).Value; - var manyType = propOnManySide.EnumerableType; - var manyExpressType = metaD.ExpressType(manyType.Name.ToUpperInvariant()); - var propOnOneSide = t.Properties.Single(x => x.Value.EnumerableType is null && x.Value.Name.StartsWith("Relating")).Value; - var oneType = propOnOneSide.PropertyInfo.PropertyType; - var oneExpressType = metaD.ExpressType(oneType.Name.ToUpperInvariant()); + var propOnPartSide = t.Properties.SingleOrDefault(x => x.Value.EnumerableType is not null).Value; + Type? partType = null; + if (propOnPartSide is not null) + { + partType = propOnPartSide.EnumerableType; + } + else + { + propOnPartSide = t.Properties.Single(x => x.Value.EnumerableType is null && x.Value.Name.StartsWith("Related")).Value; + partType = propOnPartSide.PropertyInfo.PropertyType; + } + var partExpressType = metaD.ExpressType(partType.Name.ToUpperInvariant()); - if (measureInfos.TryGetValue(daRelation, out var lst)) - lst.AddSchema(schema, oneExpressType.Name, manyType.Name); - else - measureInfos.Add(daRelation, new GenOneToManyRelationInfo(daRelation, schema, oneExpressType.Name, manyType.Name)); + var propOnOwnerSide = t.Properties.Single(x => x.Value.EnumerableType is null && x.Value.Name.StartsWith("Relating")).Value; + var ownerType = propOnOwnerSide.PropertyInfo.PropertyType; + var ownerExpressType = metaD.ExpressType(ownerType.Name.ToUpperInvariant()); + + sb.AppendLine($""" yield return new PartOfRelationInformation("{daRelation}", "{ownerExpressType.Name.ToUpperInvariant()}", "{partExpressType.Name.ToUpperInvariant()}");"""); } catch { continue; } } + schemaInfos.Add(schema.ToString(), sb); } var source = stub; - var sbMeasures = new StringBuilder(); - foreach (var clNm in measureInfos.Keys.OrderBy(x => x)) + foreach (var schema in schemaInfos.Keys.OrderBy(x => x)) { - var relInfo = measureInfos[clNm]; - sbMeasures.AppendLine($""" yield return new IfcOneToManyRelationInformation("{clNm}", {CodeHelpers.NewStringArray(relInfo.Schemas)}, "{relInfo.OneType}", "{relInfo.ManyType}");"""); + source = source.Replace($"\r\n", schemaInfos[schema].ToString()); } - source = source.Replace($"\r\n", sbMeasures.ToString()); + source = source.Replace($"", VersionHelper.GetFileVersion(typeof(ExpressMetaData))); return source; } @@ -102,16 +84,26 @@ public partial class SchemaInfo /// /// The names of classes across all schemas. /// - public static IEnumerable AllPartOfRelations + public IEnumerable AllPartOfRelations { get { - + if (Version == IfcSchemaVersions.Ifc2x3) + { + + } + if (Version == IfcSchemaVersions.Ifc4) + { + + } + if (Version == IfcSchemaVersions.Ifc4x3) + { + + } } } } } - "; } diff --git a/ids-lib.codegen/IfcSchema_PropertiesGenerator.cs b/ids-lib.codegen/IfcSchema_PropertiesGenerator.cs index 691d0c2..044625e 100644 --- a/ids-lib.codegen/IfcSchema_PropertiesGenerator.cs +++ b/ids-lib.codegen/IfcSchema_PropertiesGenerator.cs @@ -5,11 +5,11 @@ namespace IdsLib.codegen; public class IfcSchema_PropertiesGenerator { - /// - /// Computes the GetPropertiesIFC2x3 and GetPropertiesIFC4 of the PropertySetInfo.Generated.cs file - /// Depends on the Xbim.Properties assembly. - /// - public static string Execute() + /// + /// Computes the GetPropertiesIFC2x3, GetPropertiesIFC4 and GetPropertiesIFC4x3 of the PropertySetInfo.Generated.cs file + /// Depends on the Xbim.Properties assembly. + /// + public static string Execute() { var source = stub; var schemas = new[] { Xbim.Properties.Version.IFC2x3, Xbim.Properties.Version.IFC4, Xbim.Properties.Version.IFC4x3 }; diff --git a/ids-lib/IdsSchema/IdsNodes/Facets/IdsPartOf.cs b/ids-lib/IdsSchema/IdsNodes/Facets/IdsPartOf.cs index 63179cb..18329cf 100644 --- a/ids-lib/IdsSchema/IdsNodes/Facets/IdsPartOf.cs +++ b/ids-lib/IdsSchema/IdsNodes/Facets/IdsPartOf.cs @@ -52,11 +52,7 @@ internal protected override Audit.Status PerformAudit(ILogger? logger) // relation child is always a valid string matcher var relMatcher = new StringListMatcher(relationValue, this); - var possibleRelationNames = SchemaInfo.AllPartOfRelations - .Where(x => (x.ValidSchemaVersions & requiredSchemaVersions) == requiredSchemaVersions) - .Select(y => y.IfcName); - // this triggers a log error if there's anything but a single match - ret |= relMatcher.HasSingleMatch(possibleRelationNames, false, logger, out var matchedRelationName, "relation names", requiredSchemaVersions); + // if the facet is not required we don't check if it makes sense semantically if (!IsRequired) @@ -66,28 +62,31 @@ internal protected override Audit.Status PerformAudit(ILogger? logger) return ret; } - // if we have a match then there are other constraints we can evaluate on the - // types of both sides of the relation - // - if (matchedRelationName is null) - return SetInvalid(); - var relationInfo = SchemaInfo.AllPartOfRelations.FirstOrDefault(x => x.IfcName == matchedRelationName); - if (relationInfo is null) - { - ret |= IdsErrorMessages.Report501UnexpectedScenario(logger, $"no valid relation found for {matchedRelationName}", this); - return SetInvalid(ret); - } - - requiredSchemaVersions.TryGetSchemaInformation(out var schemas); foreach (var schema in schemas) { + var possibleRelationNames = schema.AllPartOfRelations.Select(y => y.RelationIfcName); + // this triggers a log error if there's anything but a single match + ret |= relMatcher.HasSingleMatch(possibleRelationNames, false, logger, out var matchedRelationName, "relation names", requiredSchemaVersions); + + // if we have a match then there are other constraints we can evaluate on the + // types of both sides of the relation + // + if (matchedRelationName is null) + return SetInvalid(); + var relationInfo = schema.AllPartOfRelations.FirstOrDefault(x => x.RelationIfcName == matchedRelationName); + if (relationInfo is null) + { + ret |= IdsErrorMessages.Report501UnexpectedScenario(logger, $"no valid relation found for {matchedRelationName}", this); + return SetInvalid(ret); + } + // Entities of the partOf need to be of type of relationInfo.ManySideIfcType - // - var filter = new IfcInheritanceTypeConstraint(relationInfo.ManySideIfcType, schema.Version); + // + var filter = new IfcInheritanceTypeConstraint(relationInfo.PartIfcType, schema.Version); if (IfcTypeConstraint.IsNotNullAndEmpty(filter)) { - ret |= IdsErrorMessages.Report501UnexpectedScenario(logger, $"no valid types found for {relationInfo.ManySideIfcType}", this); + ret |= IdsErrorMessages.Report501UnexpectedScenario(logger, $"no valid types found for {relationInfo.PartIfcType}", this); return SetInvalid(ret); } typeFilters.Add(schema, filter); @@ -100,14 +99,13 @@ internal protected override Audit.Status PerformAudit(ILogger? logger) return SetInvalid(ret); } - var validChildEntityType = new IfcInheritanceTypeConstraint(relationInfo.OneSideIfcType, schema.Version); + var validChildEntityType = new IfcInheritanceTypeConstraint(relationInfo.OwnerIfcType, schema.Version); var possible = validChildEntityType.Intersect(childEntity.GetTypesFilter(schema)); if (possible.IsEmpty) { ret |= IdsErrorMessages.Report201IncompatibleClauses(logger, this, schema, "relation not compatible with provided child entity"); return SetInvalid(ret); } - } IsValid = true; return ret; diff --git a/ids-lib/IfcSchema/IfcOneToManyRelationInformation.cs b/ids-lib/IfcSchema/IfcOneToManyRelationInformation.cs deleted file mode 100644 index 36aa2e4..0000000 --- a/ids-lib/IfcSchema/IfcOneToManyRelationInformation.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; - -namespace IdsLib.IfcSchema; - -/// -/// Metadata container for relations that are primarily one-to-many between IFC entities -/// -[DebuggerDisplay("{IfcName} ({ValidSchemaVersions})")] -public class IfcOneToManyRelationInformation -{ - /// - /// relationXmlAttributeName of the IFC entity for the relation - /// - public string IfcName { get; set; } - /// - /// relationXmlAttributeName of the IFC entity on the one-side of the one-to-many relation - /// - public string OneSideIfcType { get; set; } - /// - /// relationXmlAttributeName of the IFC entity on the many-side of the one-to-many relation - /// - public string ManySideIfcType { get; set; } - /// - /// Schema version in which the relation exists - /// - public IfcSchemaVersions ValidSchemaVersions { get; set; } - /// - /// Default constructor, ensures static nullable analysis - /// - public IfcOneToManyRelationInformation(string name, IEnumerable schemas, string oneSideType, string manySideType = "") - { - IfcName = name; - ValidSchemaVersions = IfcSchema.GetSchema(schemas); - OneSideIfcType = oneSideType; - ManySideIfcType = manySideType; - } -} diff --git a/ids-lib/IfcSchema/PartOfRelationInformation.cs b/ids-lib/IfcSchema/PartOfRelationInformation.cs new file mode 100644 index 0000000..e4f74ab --- /dev/null +++ b/ids-lib/IfcSchema/PartOfRelationInformation.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Diagnostics; + +namespace IdsLib.IfcSchema; + +/// +/// Metadata container for relations that are primarily one-to-many between IFC entities +/// +[DebuggerDisplay("{IfcName} ({ValidSchemaVersions})")] +public class PartOfRelationInformation +{ + /// + /// Name of the IFC entity for the relation + /// + public string RelationIfcName { get; set; } + /// + /// Name of the IFC entity on the owner-side of the one-to-many relation + /// + public string OwnerIfcType { get; set; } + /// + /// Name of the IFC entity on the part-side of the one-to-many relation + /// + public string PartIfcType { get; set; } + /// + /// Default constructor, ensures static nullable analysis + /// + public PartOfRelationInformation(string relationName, string oneSideType, string manySideType = "") + { + RelationIfcName = relationName; + OwnerIfcType = oneSideType; + PartIfcType = manySideType; + } +} diff --git a/ids-lib/IfcSchema/SchemaInfo.PartOfRelations.g.cs b/ids-lib/IfcSchema/SchemaInfo.PartOfRelations.g.cs index b22de56..2e44711 100644 --- a/ids-lib/IfcSchema/SchemaInfo.PartOfRelations.g.cs +++ b/ids-lib/IfcSchema/SchemaInfo.PartOfRelations.g.cs @@ -12,16 +12,38 @@ public partial class SchemaInfo /// /// The names of classes across all schemas. /// - public static IEnumerable AllPartOfRelations + public IEnumerable AllPartOfRelations { get { - yield return new IfcOneToManyRelationInformation("IFCRELAGGREGATES", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, "IfcObjectDefinition", "IfcObjectDefinition"); - yield return new IfcOneToManyRelationInformation("IFCRELASSIGNSTOGROUP", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, "IfcGroup", "IfcObjectDefinition"); - yield return new IfcOneToManyRelationInformation("IFCRELCONTAINEDINSPATIALSTRUCTURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, "IfcSpatialStructureElement", "IfcProduct"); - yield return new IfcOneToManyRelationInformation("IFCRELNESTS", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, "IfcObjectDefinition", "IfcObjectDefinition"); + if (Version == IfcSchemaVersions.Ifc2x3) + { + yield return new PartOfRelationInformation("IFCRELAGGREGATES", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELASSIGNSTOGROUP", "IFCGROUP", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELCONTAINEDINSPATIALSTRUCTURE", "IFCSPATIALSTRUCTUREELEMENT", "IFCPRODUCT"); + yield return new PartOfRelationInformation("IFCRELNESTS", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELVOIDSELEMENT", "IFCELEMENT", "IFCFEATUREELEMENTSUBTRACTION"); + yield return new PartOfRelationInformation("IFCRELFILLSELEMENT", "IFCOPENINGELEMENT", "IFCELEMENT"); + } + if (Version == IfcSchemaVersions.Ifc4) + { + yield return new PartOfRelationInformation("IFCRELAGGREGATES", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELASSIGNSTOGROUP", "IFCGROUP", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELCONTAINEDINSPATIALSTRUCTURE", "IFCSPATIALELEMENT", "IFCPRODUCT"); + yield return new PartOfRelationInformation("IFCRELNESTS", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELVOIDSELEMENT", "IFCELEMENT", "IFCFEATUREELEMENTSUBTRACTION"); + yield return new PartOfRelationInformation("IFCRELFILLSELEMENT", "IFCOPENINGELEMENT", "IFCELEMENT"); + } + if (Version == IfcSchemaVersions.Ifc4x3) + { + yield return new PartOfRelationInformation("IFCRELAGGREGATES", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELASSIGNSTOGROUP", "IFCGROUP", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELCONTAINEDINSPATIALSTRUCTURE", "IFCSPATIALELEMENT", "IFCPRODUCT"); + yield return new PartOfRelationInformation("IFCRELNESTS", "IFCOBJECTDEFINITION", "IFCOBJECTDEFINITION"); + yield return new PartOfRelationInformation("IFCRELVOIDSELEMENT", "IFCELEMENT", "IFCFEATUREELEMENTSUBTRACTION"); + yield return new PartOfRelationInformation("IFCRELFILLSELEMENT", "IFCOPENINGELEMENT", "IFCELEMENT"); + } } } } } - diff --git a/ids-lib/IfcSchema/SchemaInfo.cs b/ids-lib/IfcSchema/SchemaInfo.cs index 6549776..f7a668a 100644 --- a/ids-lib/IfcSchema/SchemaInfo.cs +++ b/ids-lib/IfcSchema/SchemaInfo.cs @@ -357,22 +357,6 @@ internal static IEnumerable SharedPropertySetNames(IfcSchemaVersions ver return ret; } - - - //private static List? allSchemaAttributes = null; - - ///// - ///// The names of all attributes across all schemas. - ///// - //public static IEnumerable AllSchemasAttributes - //{ - // get - // { - // allSchemaAttributes ??= SchemaIfc2x3.GetAttributeNames().Union(SchemaIfc4.GetAttributeNames()).Distinct().ToList(); - // return allSchemaAttributes; - // } - //} - private static SchemaInfo? schemaIfc2x3; /// /// Static property for the Ifc2x3 schema diff --git a/ids-lib/LibraryInformation.cs b/ids-lib/LibraryInformation.cs index ea51ae6..4a1164a 100644 --- a/ids-lib/LibraryInformation.cs +++ b/ids-lib/LibraryInformation.cs @@ -32,6 +32,6 @@ public static class LibraryInformation /// /// Static field with hardcoded DLL version number. /// - public static string AssemblyVersion => "1.0.45"; + public static string AssemblyVersion => "1.0.46"; } } diff --git a/ids-lib/Resources/XsdSchemas/ids.xsd b/ids-lib/Resources/XsdSchemas/ids.xsd index 5ac58da..0d2a595 100644 --- a/ids-lib/Resources/XsdSchemas/ids.xsd +++ b/ids-lib/Resources/XsdSchemas/ids.xsd @@ -51,9 +51,9 @@ - + - + @@ -212,7 +212,7 @@ - Author of the IDS can provide an identifier to the specification. This is intended to be a machine readable identifier. Beware: because of the possibility to combine different 'requirement' elements from several ids files this cannot be enforced/assumed as (global) unique. + Author of the IDS can provide an identifier to the specification. This is intended to be a machine readable identifier. Beware: because of the possibility to combine different 'specification' elements from several ids files this cannot be enforced/assumed as (global) unique. diff --git a/ids-lib/ids-lib.csproj b/ids-lib/ids-lib.csproj index 3b8e773..8872854 100644 --- a/ids-lib/ids-lib.csproj +++ b/ids-lib/ids-lib.csproj @@ -20,7 +20,7 @@ First implementation. README.md - 1.0.45 + 1.0.46 $(AssemblyVersion) $(AssemblyVersion) true diff --git a/ids-tool.tests/bsFiles/ids.xsd b/ids-tool.tests/bsFiles/ids.xsd index 5ac58da..0d2a595 100644 --- a/ids-tool.tests/bsFiles/ids.xsd +++ b/ids-tool.tests/bsFiles/ids.xsd @@ -51,9 +51,9 @@ - + - + @@ -212,7 +212,7 @@ - Author of the IDS can provide an identifier to the specification. This is intended to be a machine readable identifier. Beware: because of the possibility to combine different 'requirement' elements from several ids files this cannot be enforced/assumed as (global) unique. + Author of the IDS can provide an identifier to the specification. This is intended to be a machine readable identifier. Beware: because of the possibility to combine different 'specification' elements from several ids files this cannot be enforced/assumed as (global) unique. diff --git a/ids-tool/ids-tool.csproj b/ids-tool/ids-tool.csproj index 3ad501c..823a69d 100644 --- a/ids-tool/ids-tool.csproj +++ b/ids-tool/ids-tool.csproj @@ -16,7 +16,7 @@ icon.png IDS, buildingSmart - 1.0.45 + 1.0.46 $(AssemblyVersion) $(AssemblyVersion) https://github.com/buildingSMART/IDS-Audit-tool.git