Skip to content

Commit

Permalink
implicit schema when looking up csv pset
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghesselink committed May 12, 2024
1 parent 4217e02 commit 54fdec5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,28 @@ The rule verifies that each IfcPropertySet starting with Pset is defined correct
Given An IfcPropertySet
Given its Name attribute starts with Pset

Scenario Outline: IfcPropertySet Name

Given a file with Schema "<schema>"

Then The IfcPropertySet Name attribute value must use predefined values according to the "<csv_table>" table

Examples:
| schema | csv_table |
| IFC2X3 | IFC2x3_definitions.csv |
| IFC4 | IFC4_definitions.csv |
| IFC4X3 | IFC4X3_definitions.csv |


Scenario Outline: Property Name

Given a file with Schema "<schema>"
Scenario: IfcPropertySet Name

Then The IfcPropertySet Name attribute value must use predefined values according to the "pset_definitions" table

Then Each associated IfcProperty must be named according to the property set definitions table "<csv_table>"

Examples:
| schema | csv_table |
| IFC2X3 | IFC2x3_definitions.csv |
| IFC4 | IFC4_definitions.csv |
| IFC4X3 | IFC4X3_definitions.csv |
Scenario: Property Name


Scenario Outline: PropertySet definitions
Then Each associated IfcProperty must be named according to the property set definitions table "pset_definitions"

Given a file with Schema "<schema>"

Then The IfcPropertySet must be assigned according to the property set definitions table "<csv_table>"
Scenario: PropertySet definitions

Examples:
| schema | csv_table |
| IFC2X3 | IFC2x3_definitions.csv |
| IFC4 | IFC4_definitions.csv |
| IFC4X3 | IFC4X3_definitions.csv |
Then The IfcPropertySet must be assigned according to the property set definitions table "pset_definitions"


Scenario Outline: Property Type
Scenario: Property Type

Given a file with Schema "<schema>"
Then Each associated IfcProperty must be of type according to the property set definitions table "pset_definitions"

Then Each associated IfcProperty must be of type according to the property set definitions table "<csv_table>"

Scenario: Property Data Type

Examples:
| schema | csv_table |
| IFC2X3 | IFC2x3_definitions.csv |
| IFC4 | IFC4_definitions.csv |
| IFC4X3 | IFC4X3_definitions.csv |
Then Each associated IfcProperty value must be of data type according to the property set definitions table "pset_definitions"


Scenario Outline: Property Data Type

Given a file with Schema "<schema>"

Then Each associated IfcProperty value must be of data type according to the property set definitions table "<csv_table>"

Examples:
| schema | csv_table |
| IFC2X3 | IFC2x3_definitions.csv |
| IFC4 | IFC4_definitions.csv |
| IFC4X3 | IFC4X3_definitions.csv |
16 changes: 13 additions & 3 deletions features/steps/thens/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import operator
from validation_handling import gherkin_ifc
import json
import os

from utils import ifc, misc, system

Expand Down Expand Up @@ -184,6 +185,17 @@ def upper_case_if_string(v):
return v.upper()
except:
return v

def get_pset_definitions(context, table):
schema_specific_path = system.get_abs_path(f"resources/{context.model.schema.upper()}/{table}.csv")

if os.path.exists(schema_specific_path):
tbl_path = schema_specific_path
else:
tbl_path =system.get_abs_path(f"resources/{table}.csv")

tbl = system.get_csv(tbl_path, return_type='dict')
return {d['property_set_name']: d for d in tbl}


@gherkin_ifc.step('The IfcPropertySet Name attribute value must use predefined values according to the "{table}" table')
Expand All @@ -193,9 +205,7 @@ def upper_case_if_string(v):
@gherkin_ifc.step('Each associated IfcProperty value must be of data type according to the property set definitions table "{table}"')
def step_impl(context, inst, table):

tbl_path = system.get_abs_path(f"resources/property_set_definitions/{table}")
tbl = system.get_csv(tbl_path, return_type='dict')
property_set_definitions = {d['property_set_name']: d for d in tbl}
property_set_definitions = get_pset_definitions(context, table)

def establish_accepted_pset_values(name, property_set_definitions):
def make_obj(s):
Expand Down

0 comments on commit 54fdec5

Please sign in to comment.