Skip to content

Commit c07fb08

Browse files
committed
Improved semantics for ListValuePropertyType
Closes #54, and adds a test case for it.
1 parent ff1d157 commit c07fb08

8 files changed

Lines changed: 178 additions & 100 deletions

File tree

‎ids-lib.codegen/IfcSchema_PropertiesGenerator.cs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private static string GetProp(XmlElement t, string? nm, string def)
168168
{
169169
// todo: this case would have an enum of valid values, that we are ignoring.
170170
var tp = GetChildNodes(tList, "ListValue", "DataType").First().GetAttribute("type");
171-
return $"""new SingleValuePropertyType("{nm}", "{tp}"){def}""";
171+
return $"""new ListValuePropertyType("{nm}", "{tp}"){def}""";
172172
}
173173

174174
var tTable = t.ChildNodes.OfType<XmlElement>().FirstOrDefault(x => x.Name == "TypePropertyTableValue");
@@ -263,8 +263,10 @@ private static IEnumerable<propSetTempInfo> GetPsets(FileInfo f)
263263
case IfcSimplePropertyTemplateTypeEnum.P_BOUNDEDVALUE:
264264
props.Add($"""new SingleValuePropertyType("{singleV.Name}", "{singleV.PrimaryMeasureType}"){def}""");
265265
break;
266-
case IfcSimplePropertyTemplateTypeEnum.P_TABLEVALUE:
267266
case IfcSimplePropertyTemplateTypeEnum.P_LISTVALUE:
267+
props.Add($"""new ListValuePropertyType("{singleV.Name}", "{singleV.PrimaryMeasureType}"){def}""");
268+
break;
269+
case IfcSimplePropertyTemplateTypeEnum.P_TABLEVALUE:
268270
continue;
269271
default:
270272
break;
@@ -348,7 +350,7 @@ private static IEnumerable<propSetTempInfo> GetPsets(Xbim.Properties.Version sch
348350
else if (prop.PropertyType.PropertyValueType is TypePropertyListValue lst)
349351
{
350352
// todo: this case would have an enum of valid values, that we are ignoring.
351-
var t = $"new SingleValuePropertyType(\"{prop.Name}\", \"{lst.ListValue.DataType.Type}\"){def}";
353+
var t = $"new ListValuePropertyType(\"{prop.Name}\", \"{lst.ListValue.DataType.Type}\"){def}";
352354
richProp.Add(t);
353355
}
354356
else if (prop.PropertyType.PropertyValueType is TypeSimpleProperty simple)

‎ids-lib.tests/IssueTests.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public void Issue_46_SchemaMatch()
102102
[InlineData("IssueFiles/Issue 53 - Userdefined - Fail.ids", IdsLib.Audit.Status.IdsContentError)]
103103
[InlineData("IssueFiles/Issue 53 - IfcDistributionBoards Feeder is ok.ids", IdsLib.Audit.Status.Ok)]
104104
[InlineData("IssueFiles/Issue 53 - IfcDistributionBoards Feeder or Incomer (enumeration) is not ok.ids", IdsLib.Audit.Status.Ok)]
105+
[InlineData("IssueFiles/Issue 54 - Pset List Properties.ids", IdsLib.Audit.Status.IdsContentError, 1)] // the error is there to ensure that a test is actually performed
105106
[InlineData("IssueFiles/Issue 55 - RelationConstraintFail.ids", IdsLib.Audit.Status.IdsStructureError | IdsLib.Audit.Status.IdsContentError)]
106107
[InlineData("IssueFiles/Issue 55 - RelationConstraintOk.ids", IdsLib.Audit.Status.Ok)]
107108
[InlineData("IssueFiles/Issue 56 - Ifc2x3 mapping.ids", IdsLib.Audit.Status.Ok)]

‎ids-lib/IfcSchema/PropertyInfo.cs‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public static bool HasDataTypes(this IPropertyTypeInfo property, out IEnumerable
3535
switch (property)
3636
{
3737
case SingleValuePropertyType svp:
38-
dataType = [svp.DataType.ToUpperInvariant()];
38+
dataType = [svp.DataType.ToUpperInvariant()];
39+
return true;
40+
case ListValuePropertyType lvp:
41+
dataType = [lvp.DataType.ToUpperInvariant()];
3942
return true;
4043
case EnumerationPropertyType ep:
4144
// We assume that enumerations are stored as labels, having had a look at a few example on bSmart
@@ -131,3 +134,24 @@ public SingleValuePropertyType(string name, string dataType) : base(name)
131134
/// </summary>
132135
public string DataType { get; }
133136
}
137+
138+
/// <summary>
139+
/// Schema metadata for list value properties.
140+
/// For the purpose of IDS, these are functionally equivalent to single value properties but we want to be able to distinguish
141+
/// them in the schema to support any procedural code generation that may be needed for their IFC verification.
142+
/// </summary>
143+
public class ListValuePropertyType : NamedPropertyType
144+
{
145+
/// <summary>
146+
/// minimal constructor
147+
/// </summary>
148+
public ListValuePropertyType(string name, string dataType) : base(name)
149+
{
150+
DataType = dataType;
151+
}
152+
153+
/// <summary>
154+
/// The base IFC datatype of the property in the schema
155+
/// </summary>
156+
public string DataType { get; }
157+
}

‎ids-lib/IfcSchema/SchemaInfo.Properties.g.cs‎

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

‎ids-lib/LibraryInformation.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ public static class LibraryInformation
2626
/// <summary>
2727
/// Static field with hardcoded DLL version number.
2828
/// </summary>
29-
public static string AssemblyVersion => "1.0.103";
29+
public static string AssemblyVersion => "1.0.104";
3030
}

‎ids-lib/ids-lib.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageReleaseNotes>First implementation.</PackageReleaseNotes>
2121
<PackageReadmeFile>README.md</PackageReadmeFile>
2222
<!-- Github actions are setup so that when this version is bumped the nuget package is uploaded -->
23-
<AssemblyVersion>1.0.103</AssemblyVersion>
23+
<AssemblyVersion>1.0.104</AssemblyVersion>
2424
<FileVersion>$(AssemblyVersion)</FileVersion>
2525
<Version>$(AssemblyVersion)</Version>
2626
<GenerateDocumentationFile>true</GenerateDocumentationFile>

‎ids-tool/ids-tool.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PackageIcon>icon.png</PackageIcon>
1818
<PackageTags>IDS, buildingSmart</PackageTags>
1919
<!-- Github actions are setup so that when this version is bumped the nuget package is uploaded -->
20-
<AssemblyVersion>1.0.103</AssemblyVersion>
20+
<AssemblyVersion>1.0.104</AssemblyVersion>
2121
<FileVersion>$(AssemblyVersion)</FileVersion>
2222
<Version>$(AssemblyVersion)</Version>
2323
<RepositoryUrl>https://github.com/buildingSMART/IDS-Audit-tool.git</RepositoryUrl>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">
3+
<ids:info>
4+
<ids:title />
5+
</ids:info>
6+
<ids:specifications>
7+
<ids:specification ifcVersion="IFC4X3_ADD2" name="Specification #1" identifier="cd3e9bcc-bf9e-431e-bfac-00db9ef72fb0">
8+
<ids:applicability minOccurs="0" maxOccurs="unbounded">
9+
<ids:entity>
10+
<ids:name>
11+
<xs:restriction base="xs:string">
12+
<xs:enumeration value="IFCACTOR" />
13+
<xs:enumeration value="IFCOCCUPANT" />
14+
</xs:restriction>
15+
</ids:name>
16+
</ids:entity>
17+
</ids:applicability>
18+
<ids:requirements>
19+
<ids:property cardinality="required">
20+
<ids:propertySet>
21+
<ids:simpleValue>Pset_Address</ids:simpleValue>
22+
</ids:propertySet>
23+
<ids:baseName>
24+
<ids:simpleValue>AddressLines</ids:simpleValue>
25+
</ids:baseName>
26+
</ids:property>
27+
<ids:property cardinality="required" dataType="IFCLABEL">
28+
<ids:propertySet>
29+
<ids:simpleValue>Pset_Address</ids:simpleValue>
30+
</ids:propertySet>
31+
<ids:baseName>
32+
<ids:simpleValue>TelephoneNumbers</ids:simpleValue>
33+
</ids:baseName>
34+
<ids:value>
35+
<xs:restriction base="xs:string">
36+
<xs:pattern value="\+\d+-\d+" />
37+
</xs:restriction>
38+
</ids:value>
39+
</ids:property>
40+
<ids:property cardinality="required">
41+
<ids:propertySet>
42+
<ids:simpleValue>Pset_Address</ids:simpleValue>
43+
</ids:propertySet>
44+
<ids:baseName>
45+
<ids:simpleValue>DoesNotExist</ids:simpleValue>
46+
</ids:baseName>
47+
</ids:property>
48+
</ids:requirements>
49+
</ids:specification>
50+
</ids:specifications>
51+
</ids:ids>

0 commit comments

Comments
 (0)