Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code structure and parsing of 'entity to value' and 'entity -> relationship -> entity' #90

Open
Ghesselink opened this issue Sep 24, 2023 · 1 comment

Comments

@Ghesselink
Copy link
Contributor

Shifting all discussions related to this topic here, as it spans across multiple pull requests.

Earlier discussion with Jakub #62

In response to Stefan's comment #80 (comment), it might be beneficial to consider reorganizing the structure. Broadly speaking, when parsing Gherkin statements related to values and attributes, it seems we encounter two distinct scenarios:

Direct value-to-attribute linkage, as observed here, such as "The type of the attribute 'Items' must be IfcCurveSegment."
Through relationships: mapping from one entity to another, like "An IfcAlignmentSegment nests an IfcAlignmentHorizontalSegment". This can further have a conditional statement: "value -> relationship -> entity -> condition".

Intuitively, I think this approach would simplify the process by parsing the information into more manageable chunks, leading to more consistent and replicable code. This would consolidate relationship terms (like nesting, containing, associating) into one location alongside the entities (e.g., IfcRelAssigns, IfcRelAssociates, etc.). The conditions can be categorized separately, encompassing clauses like "if X is present", "a list of only", or "num instances of".

Regarding the condition to a 'given' statement. Currently it's kind of mixed, perhaps adding to the horror and inconsistency. For instance

  Given A file with Model View Definition "CoordinationView"
    And A file with Schema Identifier "IFC2X3"

   Then There must be at least 1 instance(s) of IfcBuilding
    And The IfcBuilding must be assigned to the IfcSite if IfcSite is present
    And The IfcBuilding must be assigned to the IfcProject if IfcSite is not present

Change to

 Background: 
  Given A file with Model View Definition "CoordinationView"
    And A file with Schema Identifier "IFC2X3"

  Scenario 1 : The IfcBuilding must be assigned to the IfcSite if IfcSite is present
   Given IfcSite is present # condition 
   Then A relationship from IfcBuilding to IfcSite  # entity -> rel -> entity
   And The relationship is must be 'assigned'

   Scenario 2: # The IfcBuilding must be assigned to the IfcProject if IfcSite is not present
  Given IfcSite is not present
  Then  A relationship from IfcBuilding to IfcSite # or to/from, as @aothms implemented before
   And The relationship is must be 'assigned' # entity -> rel -> entity

  Scenario 3: 
   Then There must be a least 1 instance(s) of IfcBuilding

Or

  And An IfcAlignment
  Then Each IfcAlignment must be directly contained in IfcSite

To

Given An IfcAlignment
And A relationship from IfcAlignment to IfcSite
Then The relationship is 'directly contained'

A potential addition could involve adding an extra table to the database that stores previously identified relationships between two entities. This could optimize the search process; if we already know that the relationship between IfcEntity1 and IfcEntity2 is defined as ["X"], the system can begin its search based on this established connection.

@Ghesselink Ghesselink mentioned this issue Sep 24, 2023
@evandroAlfieri
Copy link
Collaborator

@aothms @Ghesselink is this still valid or obsolete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants