RED-10200: Spike performant rules update logic
This commit is contained in:
parent
27b5a1afcd
commit
ca9dcc8550
@ -119,23 +119,19 @@ public class EntityDroolsExecutionService {
|
||||
sectionsToAnalyze.stream()
|
||||
.flatMap(SemanticNode::streamAllSubNodes)
|
||||
.forEach(kieSession::insert);
|
||||
System.out.println("after document insert : " + kieSession.getFactCount());
|
||||
|
||||
document.getEntities()
|
||||
.forEach(kieSession::insert);
|
||||
document.getEntities()
|
||||
.forEach(textEntity -> textEntity.getRelations().values()
|
||||
.forEach(kieSession::insert));
|
||||
System.out.println("after getEntities insert : " + kieSession.getFactCount());
|
||||
|
||||
document.getPages()
|
||||
.forEach(kieSession::insert);
|
||||
System.out.println("after getPages insert : " + kieSession.getFactCount());
|
||||
|
||||
fileAttributes.stream()
|
||||
.filter(f -> f.getValue() != null)
|
||||
.forEach(kieSession::insert);
|
||||
System.out.println("after fileAttributes insert : " + kieSession.getFactCount());
|
||||
|
||||
if (manualRedactions != null) {
|
||||
manualRedactions.buildAll()
|
||||
@ -143,10 +139,8 @@ public class EntityDroolsExecutionService {
|
||||
.filter(BaseAnnotation::isLocal)
|
||||
.forEach(kieSession::insert);
|
||||
}
|
||||
System.out.println("after manualRedactions insert : " + kieSession.getFactCount());
|
||||
|
||||
kieSession.insert(nerEntities);
|
||||
System.out.println("after nerEntities insert : " + kieSession.getFactCount());
|
||||
|
||||
kieSession.getAgenda().getAgendaGroup("LOCAL_DICTIONARY_ADDS").setFocus();
|
||||
|
||||
|
||||
@ -1321,8 +1321,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1344,9 +1342,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1368,8 +1364,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1405,8 +1399,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1427,7 +1419,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -1445,99 +1436,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -1575,21 +1566,21 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
|
||||
@ -1122,8 +1122,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1145,9 +1143,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1169,8 +1165,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1206,8 +1200,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1228,7 +1220,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -1246,99 +1237,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -1376,55 +1367,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -1886,8 +1886,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1909,9 +1907,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1933,8 +1929,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1970,8 +1964,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1992,7 +1984,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -2010,99 +2001,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -2140,55 +2131,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -1258,8 +1258,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1281,9 +1279,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1305,8 +1301,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1342,8 +1336,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1364,7 +1356,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -1382,99 +1373,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -1512,21 +1503,21 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
|
||||
@ -849,8 +849,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -872,9 +870,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -896,8 +892,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -933,8 +927,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -955,7 +947,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -973,99 +964,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -1103,55 +1094,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -170,8 +170,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -193,9 +191,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -217,8 +213,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -254,8 +248,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -276,7 +268,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -294,99 +285,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -424,55 +415,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -1145,8 +1145,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1168,9 +1166,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1192,8 +1188,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1229,8 +1223,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1251,7 +1243,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -1268,98 +1259,98 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
// Rule unit: X.3
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
// Rule unit: X.4
|
||||
rule "X.4.0: Remove Entity of type RECOMMENDATION when text range equals ENTITY with same type"
|
||||
@ -1395,54 +1386,54 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
// Rule unit: X.8
|
||||
rule "X.8.0: Remove Entity when text range and type equals to imported Entity"
|
||||
|
||||
@ -241,8 +241,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -264,9 +262,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -288,8 +284,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -334,7 +328,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -352,99 +345,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -482,55 +475,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -320,8 +320,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -343,9 +341,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -367,8 +363,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -404,8 +398,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -426,7 +418,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -444,99 +435,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -574,55 +565,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
|
||||
@ -220,8 +220,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -243,9 +241,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -267,8 +263,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -304,8 +298,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -326,7 +318,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -344,131 +335,131 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -506,55 +497,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 57e6e0dd3c08a3a65ec59b5dfb70f0f77ebcc7c7
|
||||
Subproject commit b3ebaf42aaadbf584c2ffbd7534c7bb7d15c3e07
|
||||
@ -733,8 +733,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -756,9 +754,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -780,8 +776,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -817,8 +811,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -839,7 +831,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -857,99 +848,99 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -987,55 +978,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -1904,8 +1904,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1927,9 +1925,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1951,8 +1947,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1988,8 +1982,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -2011,7 +2003,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -2029,109 +2020,119 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
rule "X.0.4: Remove Entity contained by Entity of same type"
|
||||
salience 65
|
||||
when
|
||||
$larger: TextEntity($type: type(), $entityType: entityType, !removed(), !hasManualChanges())
|
||||
$contained: TextEntity(containedBy($larger), type() == $type, entityType == $entityType, this != $larger, !hasManualChanges(), !removed())
|
||||
$containment: Containment(
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$contained.remove("X.0.4", "remove Entity contained by Entity of same type");
|
||||
update($contained);
|
||||
end
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -2169,55 +2170,55 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
$b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY");
|
||||
end
|
||||
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.6
|
||||
rule "X.6.0: Remove Entity of lower rank when contained by entity of type ENTITY or HINT"
|
||||
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval(dictionary.getDictionaryRank($b.type()) < dictionary.getDictionaryRank($a.type())),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval(dictionary.getDictionaryRank($contained.type()) < dictionary.getDictionaryRank($container.type())),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
$contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT");
|
||||
end
|
||||
|
||||
rule "X.6.1: Remove Entity when contained in another entity of type ENTITY or HINT with larger text range"
|
||||
rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT"
|
||||
salience 32
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
($a.entityType == EntityType.ENTITY || $a.entityType == EntityType.HINT),
|
||||
$a.active(),
|
||||
$b.type() != $a.type(),
|
||||
eval($a.getTextRange().length() > $b.getTextRange().length()),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
|
||||
$container.active(),
|
||||
$contained.type() != $container.type(),
|
||||
eval($container.getTextRange().length() > $contained.getTextRange().length()),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
$contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.8
|
||||
|
||||
@ -1325,8 +1325,6 @@ rule "MAN.0.1: Apply manual resize redaction"
|
||||
then
|
||||
manualChangesApplicationService.resizeImage($imageToBeResized, $resizeRedaction);
|
||||
retract($resizeRedaction);
|
||||
update($imageToBeResized);
|
||||
update($imageToBeResized.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1348,9 +1346,7 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
||||
$imageEntityToBeRemoved: Image($id == id)
|
||||
then
|
||||
$imageEntityToBeRemoved.getManualOverwrite().addChange($idRemoval);
|
||||
update($imageEntityToBeRemoved);
|
||||
retract($idRemoval);
|
||||
update($imageEntityToBeRemoved.getParent());
|
||||
end
|
||||
|
||||
|
||||
@ -1372,8 +1368,6 @@ rule "MAN.2.1: Apply force redaction to images"
|
||||
$imageToForce: Image(id == $id)
|
||||
then
|
||||
$imageToForce.getManualOverwrite().addChange($force);
|
||||
update($imageToForce);
|
||||
update($imageToForce.getParent());
|
||||
retract($force);
|
||||
end
|
||||
|
||||
@ -1409,8 +1403,6 @@ rule "MAN.3.2: Apply image recategorization"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
manualChangesApplicationService.recategorize($imageToBeRecategorized, $recategorization);
|
||||
update($imageToBeRecategorized);
|
||||
update($imageToBeRecategorized.getParent());
|
||||
retract($recategorization);
|
||||
end
|
||||
|
||||
@ -1430,7 +1422,6 @@ rule "MAN.4.0: Apply legal basis change"
|
||||
$imageToBeRecategorized: Image($id == id)
|
||||
then
|
||||
$imageToBeRecategorized.getManualOverwrite().addChange($legalBasisChange);
|
||||
update($imageToBeRecategorized)
|
||||
retract($legalBasisChange)
|
||||
end
|
||||
|
||||
@ -1448,100 +1439,100 @@ rule "MAN.4.1: Apply legal basis change"
|
||||
//------------------------------------ Entity merging rules ------------------------------------
|
||||
|
||||
// Rule unit: X.0
|
||||
rule "X.0.0: Remove Entity contained by Entity of same type"
|
||||
rule "X.0.0: Remove Container Entity Contained by Container of Same Type"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
!$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
!$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
not TextEntity(
|
||||
getTextRange().equals($a.getTextRange()),
|
||||
type() == $a.type(),
|
||||
getTextRange().equals($container.getTextRange()),
|
||||
type() == $container.type(),
|
||||
entityType == EntityType.DICTIONARY_REMOVAL,
|
||||
engines contains Engine.DOSSIER_DICTIONARY,
|
||||
!hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
$contained.remove("X.0.0", "remove Entity contained by Entity of same type");
|
||||
end
|
||||
|
||||
rule "X.0.1: Remove Entity contained by Entity of same type with manual changes"
|
||||
rule "X.0.1: Remove Container and Contained Entities with Manual Changes"
|
||||
salience 65
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.type() == $b.type(),
|
||||
$a.entityType == $b.entityType,
|
||||
$a != $b,
|
||||
!$a.removed(),
|
||||
$a.hasManualChanges(),
|
||||
!$b.hasManualChanges(),
|
||||
!$b.removed()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.type() == $contained.type(),
|
||||
$container.entityType == $contained.entityType,
|
||||
$container != $contained,
|
||||
!$container.removed(),
|
||||
$container.hasManualChanges(),
|
||||
!$contained.hasManualChanges(),
|
||||
!$contained.removed()
|
||||
)
|
||||
then
|
||||
$b.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
$contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.2
|
||||
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
||||
rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.ENTITY,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.ENTITY,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
|
||||
rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_POSITIVE,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.HINT,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_POSITIVE,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.HINT,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
|
||||
end
|
||||
|
||||
|
||||
rule "X.3.0: Remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"
|
||||
rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION"
|
||||
salience 64
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$b.type() == $a.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.FALSE_RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$contained.type() == $container.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.4
|
||||
@ -1581,21 +1572,21 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY"
|
||||
|
||||
|
||||
// Rule unit: X.5
|
||||
rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"
|
||||
rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION"
|
||||
salience 256
|
||||
when
|
||||
$containment: Containment(
|
||||
$a: a,
|
||||
$b: b,
|
||||
$a.entityType == EntityType.RECOMMENDATION,
|
||||
$a.active(),
|
||||
$b.entityType == EntityType.RECOMMENDATION,
|
||||
$a.type() != $b.type(),
|
||||
!$b.hasManualChanges()
|
||||
$container: container,
|
||||
$contained: contained,
|
||||
$container.entityType == EntityType.RECOMMENDATION,
|
||||
$container.active(),
|
||||
$contained.entityType == EntityType.RECOMMENDATION,
|
||||
$container.type() != $contained.type(),
|
||||
!$contained.hasManualChanges()
|
||||
)
|
||||
then
|
||||
$b.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
$contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION");
|
||||
end
|
||||
|
||||
|
||||
// Rule unit: X.7
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user