Usted está aquí:
Ejemplos de restricción para AutoSilver
Revise las restricciones de ejemplo diseñadas para el modelo de producto AutoSilver para admitir lógica de seguros de automóviles compleja.
Utilice estos ejemplos de restricción para comprender cómo aplicar lógica condicional entre características de vehículos, selecciones de cobertura e interacciones entre productos.
Para obtener una referencia completa, puede revisar el archivo AutoSilver CML completo.
Requerir cobertura médica para vehículos antiguos de alto valor
Si el auto más caro tiene más de $50,000 y el auto más antiguo es anterior a 2020, se requiere Cobertura de pago médico con un límite de $2000.
Qué cubre
- Restricción de múltiples instancias
- Requerir restricción de cobertura
- Restricción entre productos
Ejemplo de CML
type AutoSilver {
@(closeRelation = true, propagateUp = true, sequence = 1)
relation auto : Vehicle {
maxAutoValue = max(Auto_Value);
minAutoYear = min(Year);
}
boolean constraint1 = auto.maxAutoValue >= 50000 && auto.minAutoYear < 2020;
require(constraint1, medicalpayments[MedicalPayments], "Auto add Medical Payments");
constraint(constraint1 && medicalpayments[MedicalPayments] > 0 -> medicalpayments[MedicalPayments].Limit == 2000, "Medical coverage set to $2000 for older high-value vehicles");
}
type Auto {
@(configurable = false)
decimal(2) Auto_Value;
int Year = [1980..2026];
}
type MedicalPayments {
@(defaultValue = "1000", domainComputation = false)
int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
}
Requerir cobertura de colisión para vehículos más nuevos
Agrega cobertura de colisión con un límite de 5.000 $ para vehículos más recientes que 2023.
Qué son las cubiertas
- Requerir restricción de cobertura
- Restricción entre productos
Ejemplo de CML
type Auto {
int Year = [1980..2026];
}
type Vehicle : Auto {
relation collision : Collision[0..1];
boolean constraint2 = Year > 2023;
constraint(constraint2 -> collision[Collision], "auto add collision coverage");
constraint(constraint2 && collision[Collision] > 0 -> collision[Collision].Limit == 5000, "set collision limit to 5000");
}
@(split = false)
type Collision {
@(defaultValue = "1000", domainComputation = false)
int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
} Excluir cobertura de motorista sin seguro para vehículos más antiguos
Evita la selección de cobertura de conductor no asegurado cuando un vehículo tiene más de 2020 y se selecciona la cobertura de colisión con un deducible de 200 $.
Qué cubre
- Excluir restricción de cobertura
- Restricción entre productos
Ejemplo de CML
type Auto {
int Year = [1980..2026];
}
type Vehicle : Auto {
@(sequence = 4)
relation comprehensive : Comprehensive[0..1];
@(sequence = 3)
relation uninsuredMotorist : UninsuredMotorist[0..1];
boolean constraint3 = collision[Collision] > 0 && collision[Collision].Deductible == 200 && Year < 2020;
exclude(constraint3, uninsuredMotorist[UninsuredMotorist]);
}
@(split = false)
type Collision {
@(defaultValue = "1000", domainComputation = false)
int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
@(domainComputation = false)
int Deductible = [0, 50, 100, 200, 500];
}
@(split = false)
type UninsuredMotorist;
Validación de edad de licencia de conducir
Garantiza que la edad de un conductor y la edad en el primer carnet sean superiores a 16.
Lo que cubre
- Restricción base
Ejemplo de CML
type Driver {
@(configurable = false)
int Age = [0..100];
int Age_First_Licensed = [0..100];
message(Age_First_Licensed < 16, "Don’t know who gave you license to driver before 16, legally!", "Warning");
message(Age < 16, "Error”: Driver is underaged to be added to the quote", "Error");
}
Requerir BIPD cuando se cumplen ciertas condiciones
Esta restricción requiere cobertura de BIPD cuando se cumplen ciertas condiciones de vehículo, conductor y precio, y no se seleccionan Pagos médicos. También oculta atributos y valores en la cobertura de BIPD.
Qué cubre
- Restricción de múltiples instancias
- Requerir restricción de cobertura
- Restricción de cardinalidad
- Restricción de cardinalidad principal
- Restricción entre productos
- Restricción de productos nietos
- Restricción de productos hermanos
Ejemplo de CML
type AutoSilver {
@(closeRelation = true, propagateUp = true, sequence = 1)
relation auto : Vehicle {
maxDriverAccPoint1 = max(maxDriverAccPoint);
autoHasAntiTheft = count(Has_Anti_Theft > 0);
}
@(sequence = 2)
relation bodilyinjurypropertydamage : BodilyInjuryPropertyDamage[0..1];
@(sequence = 3)
relation medicalpayments : MedicalPayments[0..1] {
medicalLimit = Limit;
medicalDeductible = Deductible;
}
@(tagName = "ItemTotalPrice")
decimal(2) totalPrice;
boolean autoCondition = auto[Vehicle] > 0 && !auto.autoHasAntiTheft;
boolean driverCondition = auto.maxDriverAccPoint1 > 5;
boolean totalPriceCondition = totalPrice > 10;
boolean constraint5 = autoCondition && driverCondition && totalPriceCondition && medicalpayments[MedicalPayments] == 0;
@(abort = true)
require(constraint5, bodilyinjurypropertydamage[BodilyInjuryPropertyDamage], "BIPD is required when Auto IsElectricVehicle and Antitheft is false and Driver accident points > 5 and Collision is selected and MedicalPayments is NOT selected");
}
type Auto {
boolean Has_Anti_Theft;
}
type Vehicle : Auto {
int maxDriverAccPoint = driver.maxDriverAccPoint;
@(closeRelation = true, propagateUp = true, sequence = 1)
relation driver : AutoDriver[0..5] {
maxDriverAccPoint = max(Driver_Accident_Points);
}
type Driver {
int Driver_Accident_Points = [0..10];
}
type MedicalPayments {
@(defaultValue = "1000", domainComputation = false)
int Limit = [1000, 2000, 5000, 10000, 25000, 50000];
}
@(split = false)
type BodilyInjuryPropertyDamage {
@(defaultValue = "1000", domainComputation = false)
int Property_Damage_Per_Accident_Limit = [500, 1000, 1500, 2000];
@(defaultValue = "1000", domainComputation = false)
int Bodily_Injury_Per_Accident_Limit = [500, 1000, 1500, 2000];
boolean rootconstraint5 = parent(constraint5);
rule(rootconstraint5, "hide", "attribute", "Property_Damage_Per_Accident_Limit");
rule(rootconstraint5, "hide", "attribute", "Bodily_Injury_Per_Accident_Limit","value", 2000);
}Requerir BIPD para usuarios estándar con pagos médicos
Agrega cobertura de BIPD con un límite de lesiones corporales por persona de 1.000 $ cuando un usuario estándar selecciona cobertura de Pago médico con un límite de 1.000 $ y un precio unitario alto.
Qué cubre
- Requerir restricción de cobertura
- Restricción de cardinalidad
- Restricción entre productos
- Restricción de productos hermanos
Ejemplo de CML
@(contextPath = "SalesTransaction.UserProfile", attributeSource = "ST")
extern string UserProfile;
type AutoSilver {
@(sequence = 3)
relation medicalpayments : MedicalPayments[0..1] {
medicalLimit = Limit;
medicalDeductible = Deductible;
medicalInputUnitPrice = inputUnitPrice;
}
@(sequence = 2)
relation bodilyinjurypropertydamage : BodilyInjuryPropertyDamage[0..1];
boolean constraint6 = medicalpayments[MedicalPayments] == 1 && medicalpayments.medicalDeductible == 500 && UserProfile == "Standard User" && medicalpayments.medicalInputUnitPrice > 220;
require(constraint6, bodilyinjurypropertydamage[BodilyInjuryPropertyDamage], "BIPD is required when MedicalPayments is selected at 1k limit");
constraint(constraint6 && bodilyinjurypropertydamage[BodilyInjuryPropertyDamage] -> bodilyinjurypropertydamage[BodilyInjuryPropertyDamage].Bodily_Injury_Per_Person_Limit == 1000);
}
@(split = false)
type BodilyInjuryPropertyDamage {
@(defaultValue = "1000", domainComputation = false)
int Bodily_Injury_Per_Person_Limit = [500, 1000, 1500, 2000];
}
@(split = false)
type MedicalPayments {
@(defaultValue = "100", domainComputation = false)
int Deductible = [0, 50, 100, 200, 500];
@(tagName = "InputUnitPrice")
decimal(2) inputUnitPrice;
}
