...
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 = 'OntoEValueDomain',
displayName = ST{value = 'Mechanical Firm Linkage'}}
Let groovedPin_Concept: CD = CD{code = '9377156411',
codeSystem ='3.16.840.1.113883.6.8',
codeSystemName = 'OntoEValueDomain',
displayName = ST{value = 'Grooved Pin'}}
Let test: Boolean = groovedPinConcept = groovedPin_Concept
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:
Astronomy example
(to come)