...
A xml file was created that accords with the model:
<GroovedPin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<type
code="5336670848"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Mechanical" />
</type>
<pinType
code="9377156411"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Grooved Pin" />
</pinType>
<partID value = '6787982-A'/>
<hasGeometry>
<code
code="7573194557"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Cylinder"/>
</code>
</hasGeometry>
<spaceType
code="8494431267"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "PositiveSpace"/>
</spaceType>
<btLength xsi:type = "PQ" value = "100" unit = "mm" />
<btRadius xsi:type = "PQ" value = "10" unit = "mm" />
<hasRole>
<roleType code="4514449250"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Fasten"/>
</roleType>
</hasRole>
<usedWith>
<partID value = '89u207-F'/>
<code
code="7715218853"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Bush"/>
</code>
</usedWith>
<component>
<componentID value = 'Groove1'/>
<hasGeometry>
<code
code="7573194557"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "Cylinder"/>
</code>
</hasGeometry>
<spaceType
code="8999051355"
codeSystem="2.16.840.1.113883.6.8"
codeSystemName="OntoEValueDomain">
<displayName value = "NegativeSpace"/>
</spaceType>
<btLength xsi:type = "PQ" value = "75" unit = "mm" />
<btRadius xsi:type = "PQ" value = "4" unit = "mm" />
</component>
<grooveNumber value = '1' />
</GroovedPin>
This data instance is about a grooved pin with one groove. The idea of a grooved pin is that is has two or more grooves usually which compress when the pin is inserted with force into a preformed hole, in this case a 'bush'. They are meant to not move. So there is a risk if the groove number is wrong. Another broader issue at a semantic level is that we want a firm mechanical linkage in spite of the bush. This is what the semantic appeal will attempt to address. So lets move onto the actual GELLO:
GELLO
Imports OntoEngineering, DB.OntoEngineeringParentChildTable
Context GroovedPin
--validation rules:
Let groovedPinConcept:CD = pinType
Let grooveNumberOk: Boolean = grooveNumber >= 2
Let partTypeOk: Boolean = type.displayName.value = 'Mechanical'
Let correctAssocPart: Boolean = usedWith->exists(code.displayName.value='Bush')
--implies
Let mechanicalFirmLinkage_concept: CD = CD{code = '6253914735',
codeSystem ='3.16.840.1.113883.6.8',
codeSystemName = 'OntoE',
displayName = ST{value = 'Mechanical Firm Linkage'}}
Let groovedPin_Concept: CD = CD{code = '9377156411',
codeSystem ='3.16.840.1.113883.6.8',
codeSystemName = 'OntoE',
displayName = ST{value = 'Grooved pin'}}
Let parentConcept: CD = mechanicalFirmLinkage_concept
Let childConcept: CD = groovedPin_Concept
Let ontoETable: Sequence(TBL.csv)= csv
Let selectedRowOrRows: Sequence(TBL.csv) =
ontoETable->select((LeafID = childConcept.code.toReal())
and (
(If Parent1.oclIsDefined() then Parent1 = parentConcept.code.toReal() else False endif) or
(If Parent2.oclIsDefined() then Parent2 = parentConcept.code.toReal() else False endif) or
(If Parent3.oclIsDefined() then Parent3 = parentConcept.code.toReal() else False endif) or
(If Parent4.oclIsDefined() then Parent4 = parentConcept.code.toReal() else False endif) or
(If Parent5.oclIsDefined() then Parent5 = parentConcept.code.toReal() else False endif) or
(If Parent6.oclIsDefined() then Parent6 = parentConcept.code.toReal() else False endif) or
(If Parent7.oclIsDefined() then Parent7 = parentConcept.code.toReal() else False endif) or
(If Parent8.oclIsDefined() then Parent8 = parentConcept.code.toReal() else False endif))
)
Let impliesBoolean: Boolean = selectedRowOrRows.size()>0
-- result
Tuple { checkGrooveNumber = grooveNumberOk ,
checkPartTyping = partTypeOk,
checkUsedWith = correctAssocPart,
checkSemantics = impliesBoolean
}
and here is the result: