RED-6929: fix acceptance tests/rules
* updated rule files
This commit is contained in:
parent
0dd4f9c2d9
commit
574a3d0717
@ -246,7 +246,6 @@ rule "CBI.5.0: Redact Names and Addresses if no_redaction_indicator but also red
|
|||||||
then
|
then
|
||||||
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.applyWithReferences(
|
entity.applyWithReferences(
|
||||||
"CBI.5.0",
|
"CBI.5.0",
|
||||||
"no_redaction_indicator but also redaction_indicator found",
|
"no_redaction_indicator but also redaction_indicator found",
|
||||||
@ -264,10 +263,9 @@ rule "CBI.5.1: Redact Names and Addresses if no_redaction_indicator but also red
|
|||||||
hasEntitiesOfType("redaction_indicator"),
|
hasEntitiesOfType("redaction_indicator"),
|
||||||
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
||||||
then
|
then
|
||||||
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("redaction_indicator", "no-redaction_indicator"))
|
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("redaction_indicator", "no_redaction_indicator"))
|
||||||
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.applyWithReferences(
|
entity.applyWithReferences(
|
||||||
"CBI.5.1",
|
"CBI.5.1",
|
||||||
"no_redaction_indicator but also redaction_indicator found",
|
"no_redaction_indicator but also redaction_indicator found",
|
||||||
@ -290,7 +288,6 @@ rule "CBI.6.0: Don't redact Names and Addresses if vertebrate but also published
|
|||||||
then
|
then
|
||||||
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.skipWithReferences(
|
entity.skipWithReferences(
|
||||||
"CBI.6.0",
|
"CBI.6.0",
|
||||||
"vertebrate but also published_information found",
|
"vertebrate but also published_information found",
|
||||||
@ -307,10 +304,9 @@ rule "CBI.6.1: Don't redact Names and Addresses if vertebrate but also published
|
|||||||
hasEntitiesOfType("published_information"),
|
hasEntitiesOfType("published_information"),
|
||||||
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
||||||
then
|
then
|
||||||
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("redaction_indicator", "no-redaction_indicator"))
|
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("vertebrate", "published_information"))
|
||||||
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.skipWithReferences(
|
entity.skipWithReferences(
|
||||||
"CBI.6.1",
|
"CBI.6.1",
|
||||||
"vertebrate but also published_information found",
|
"vertebrate but also published_information found",
|
||||||
@ -1229,8 +1225,9 @@ rule "ETC.5.0: Ignore dossier_redaction entries if confidentiality is not 'confi
|
|||||||
not FileAttribute(label == "Confidentiality", value == "confidential")
|
not FileAttribute(label == "Confidentiality", value == "confidential")
|
||||||
$dossierRedaction: RedactionEntity(type == "dossier_redaction")
|
$dossierRedaction: RedactionEntity(type == "dossier_redaction")
|
||||||
then
|
then
|
||||||
$dossierRedaction.removeFromGraph();
|
$dossierRedaction.setIgnored(true);
|
||||||
retract($dossierRedaction);
|
update($dossierRedaction);
|
||||||
|
$dossierRedaction.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1334,6 +1331,7 @@ rule "MAN.0.0: Apply manual resize redaction"
|
|||||||
manualRedactionApplicationService.resizeEntityAndReinsert($entityToBeResized, $resizeRedaction);
|
manualRedactionApplicationService.resizeEntityAndReinsert($entityToBeResized, $resizeRedaction);
|
||||||
retract($resizeRedaction);
|
retract($resizeRedaction);
|
||||||
update($entityToBeResized);
|
update($entityToBeResized);
|
||||||
|
$entityToBeResized.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1369,11 +1367,14 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
|||||||
rule "MAN.2.0: Apply force redaction"
|
rule "MAN.2.0: Apply force redaction"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
ManualForceRedaction($id: annotationId, status == AnnotationStatus.APPROVED, requestDate != null, $legalBasis: legalBasis)
|
$force: ManualForceRedaction($id: annotationId, status == AnnotationStatus.APPROVED, requestDate != null, $legalBasis: legalBasis)
|
||||||
$entityToForce: RedactionEntity(matchesAnnotationId($id))
|
$entityToForce: RedactionEntity(matchesAnnotationId($id))
|
||||||
then
|
then
|
||||||
$entityToForce.apply("MAN.2.0", "Forced redaction", $legalBasis);
|
$entityToForce.apply("MAN.2.0", "Forced redaction", $legalBasis);
|
||||||
$entityToForce.setSkipRemoveEntitiesContainedInLarger(true);
|
$entityToForce.setSkipRemoveEntitiesContainedInLarger(true);
|
||||||
|
update($entityToForce);
|
||||||
|
retract($force);
|
||||||
|
$entityToForce.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1381,10 +1382,13 @@ rule "MAN.2.0: Apply force redaction"
|
|||||||
rule "MAN.3.0: Apply image recategorization"
|
rule "MAN.3.0: Apply image recategorization"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
ManualImageRecategorization($id: annotationId, status == AnnotationStatus.APPROVED, $imageType: type)
|
$recategorization: ManualImageRecategorization($id: annotationId, status == AnnotationStatus.APPROVED, $imageType: type)
|
||||||
$image: Image($id == id)
|
$imageToBeRecategorized: Image($id == id)
|
||||||
then
|
then
|
||||||
$image.setImageType(ImageType.fromString($imageType));
|
$imageToBeRecategorized.setImageType(ImageType.fromString($imageType));
|
||||||
|
update($imageToBeRecategorized);
|
||||||
|
retract($recategorization);
|
||||||
|
update($imageToBeRecategorized.getParent());
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1415,6 +1419,7 @@ rule "X.1.0: merge intersecting Entities of same type"
|
|||||||
retract($first);
|
retract($first);
|
||||||
retract($second);
|
retract($second);
|
||||||
insert(mergedEntity);
|
insert(mergedEntity);
|
||||||
|
mergedEntity.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1425,6 +1430,7 @@ rule "X.2.0: remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
|||||||
$falsePositive: RedactionEntity($type: type, entityType == EntityType.FALSE_POSITIVE)
|
$falsePositive: RedactionEntity($type: type, entityType == EntityType.FALSE_POSITIVE)
|
||||||
$entity: RedactionEntity(containedBy($falsePositive), type == $type, entityType == EntityType.ENTITY, !resized, !skipRemoveEntitiesContainedInLarger)
|
$entity: RedactionEntity(containedBy($falsePositive), type == $type, entityType == EntityType.ENTITY, !resized, !skipRemoveEntitiesContainedInLarger)
|
||||||
then
|
then
|
||||||
|
$entity.getIntersectingNodes().forEach(node -> update(node));
|
||||||
$entity.removeFromGraph();
|
$entity.removeFromGraph();
|
||||||
retract($entity)
|
retract($entity)
|
||||||
end
|
end
|
||||||
@ -1474,6 +1480,7 @@ rule "X.6.0: remove Entity of lower rank, when intersected by entity of type ENT
|
|||||||
$higherRank: RedactionEntity($type: type, entityType == EntityType.ENTITY)
|
$higherRank: RedactionEntity($type: type, entityType == EntityType.ENTITY)
|
||||||
$lowerRank: RedactionEntity(intersects($higherRank), type != $type, dictionary.getDictionaryRank(type) < dictionary.getDictionaryRank($type), !resized, !skipRemoveEntitiesContainedInLarger)
|
$lowerRank: RedactionEntity(intersects($higherRank), type != $type, dictionary.getDictionaryRank(type) < dictionary.getDictionaryRank($type), !resized, !skipRemoveEntitiesContainedInLarger)
|
||||||
then
|
then
|
||||||
|
$lowerRank.getIntersectingNodes().forEach(node -> update(node));
|
||||||
$lowerRank.removeFromGraph();
|
$lowerRank.removeFromGraph();
|
||||||
retract($lowerRank);
|
retract($lowerRank);
|
||||||
end
|
end
|
||||||
|
|||||||
@ -184,7 +184,6 @@ rule "CBI.5.0: Redact Names and Addresses if no_redaction_indicator but also red
|
|||||||
then
|
then
|
||||||
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
$section.getEntitiesOfType(List.of("CBI_author", "CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.applyWithReferences(
|
entity.applyWithReferences(
|
||||||
"CBI.5.0",
|
"CBI.5.0",
|
||||||
"no_redaction_indicator but also redaction_indicator found",
|
"no_redaction_indicator but also redaction_indicator found",
|
||||||
@ -202,10 +201,9 @@ rule "CBI.5.1: Redact Names and Addresses if no_redaction_indicator but also red
|
|||||||
hasEntitiesOfType("redaction_indicator"),
|
hasEntitiesOfType("redaction_indicator"),
|
||||||
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
(hasEntitiesOfType("CBI_author") || hasEntitiesOfType("CBI_address")))
|
||||||
then
|
then
|
||||||
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("redaction_indicator", "no-redaction_indicator"))
|
$table.streamEntitiesWhereRowContainsEntitiesOfType(List.of("redaction_indicator", "no_redaction_indicator"))
|
||||||
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
.filter(entity -> entity.getType().equals("CBI_author") || entity.getType().equals("CBI_address"))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.addEngine(Engine.RULE);
|
|
||||||
entity.applyWithReferences(
|
entity.applyWithReferences(
|
||||||
"CBI.5.1",
|
"CBI.5.1",
|
||||||
"no_redaction_indicator but also redaction_indicator found",
|
"no_redaction_indicator but also redaction_indicator found",
|
||||||
@ -909,8 +907,9 @@ rule "ETC.5.0: Ignore dossier_redaction entries if confidentiality is not 'confi
|
|||||||
not FileAttribute(label == "Confidentiality", value == "confidential")
|
not FileAttribute(label == "Confidentiality", value == "confidential")
|
||||||
$dossierRedaction: RedactionEntity(type == "dossier_redaction")
|
$dossierRedaction: RedactionEntity(type == "dossier_redaction")
|
||||||
then
|
then
|
||||||
$dossierRedaction.removeFromGraph();
|
$dossierRedaction.setIgnored(true);
|
||||||
retract($dossierRedaction);
|
update($dossierRedaction);
|
||||||
|
$dossierRedaction.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1001,6 +1000,7 @@ rule "MAN.0.0: Apply manual resize redaction"
|
|||||||
manualRedactionApplicationService.resizeEntityAndReinsert($entityToBeResized, $resizeRedaction);
|
manualRedactionApplicationService.resizeEntityAndReinsert($entityToBeResized, $resizeRedaction);
|
||||||
retract($resizeRedaction);
|
retract($resizeRedaction);
|
||||||
update($entityToBeResized);
|
update($entityToBeResized);
|
||||||
|
$entityToBeResized.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1008,21 +1008,27 @@ rule "MAN.0.0: Apply manual resize redaction"
|
|||||||
rule "MAN.1.0: Apply id removals that are valid and not in forced redactions to Entity"
|
rule "MAN.1.0: Apply id removals that are valid and not in forced redactions to Entity"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
IdRemoval(status == AnnotationStatus.APPROVED, !removeFromDictionary, requestDate != null, $id: annotationId)
|
$idRemoval: IdRemoval(status == AnnotationStatus.APPROVED, !removeFromDictionary, requestDate != null, $id: annotationId)
|
||||||
not ManualForceRedaction($id == annotationId, status == AnnotationStatus.APPROVED, requestDate != null)
|
not ManualForceRedaction($id == annotationId, status == AnnotationStatus.APPROVED, requestDate != null)
|
||||||
$entityToBeRemoved: RedactionEntity(matchesAnnotationId($id))
|
$entityToBeRemoved: RedactionEntity(matchesAnnotationId($id))
|
||||||
then
|
then
|
||||||
$entityToBeRemoved.setIgnored(true);
|
$entityToBeRemoved.setIgnored(true);
|
||||||
|
update($entityToBeRemoved);
|
||||||
|
retract($idRemoval);
|
||||||
|
$entityToBeRemoved.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to Image"
|
rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to Image"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
IdRemoval(status == AnnotationStatus.APPROVED, !removeFromDictionary, requestDate != null, $id: annotationId)
|
$idRemoval: IdRemoval(status == AnnotationStatus.APPROVED, !removeFromDictionary, requestDate != null, $id: annotationId)
|
||||||
not ManualForceRedaction($id == annotationId, status == AnnotationStatus.APPROVED, requestDate != null)
|
not ManualForceRedaction($id == annotationId, status == AnnotationStatus.APPROVED, requestDate != null)
|
||||||
$imageEntityToBeRemoved: Image($id == id)
|
$imageEntityToBeRemoved: Image($id == id)
|
||||||
then
|
then
|
||||||
$imageEntityToBeRemoved.setIgnored(true);
|
$imageEntityToBeRemoved.setIgnored(true);
|
||||||
|
update($imageEntityToBeRemoved);
|
||||||
|
retract($idRemoval);
|
||||||
|
update($imageEntityToBeRemoved.getParent());
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1030,11 +1036,14 @@ rule "MAN.1.1: Apply id removals that are valid and not in forced redactions to
|
|||||||
rule "MAN.2.0: Apply force redaction"
|
rule "MAN.2.0: Apply force redaction"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
ManualForceRedaction($id: annotationId, status == AnnotationStatus.APPROVED, requestDate != null, $legalBasis: legalBasis)
|
$force: ManualForceRedaction($id: annotationId, status == AnnotationStatus.APPROVED, requestDate != null, $legalBasis: legalBasis)
|
||||||
$entityToForce: RedactionEntity(matchesAnnotationId($id))
|
$entityToForce: RedactionEntity(matchesAnnotationId($id))
|
||||||
then
|
then
|
||||||
$entityToForce.apply("MAN.2.0", "Forced redaction", $legalBasis);
|
$entityToForce.apply("MAN.2.0", "Forced redaction", $legalBasis);
|
||||||
$entityToForce.setSkipRemoveEntitiesContainedInLarger(true);
|
$entityToForce.setSkipRemoveEntitiesContainedInLarger(true);
|
||||||
|
update($entityToForce);
|
||||||
|
retract($force);
|
||||||
|
$entityToForce.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1042,10 +1051,13 @@ rule "MAN.2.0: Apply force redaction"
|
|||||||
rule "MAN.3.0: Apply image recategorization"
|
rule "MAN.3.0: Apply image recategorization"
|
||||||
salience 128
|
salience 128
|
||||||
when
|
when
|
||||||
ManualImageRecategorization($id: annotationId, status == AnnotationStatus.APPROVED, $imageType: type)
|
$recategorization: ManualImageRecategorization($id: annotationId, status == AnnotationStatus.APPROVED, $imageType: type)
|
||||||
$image: Image($id == id)
|
$imageToBeRecategorized: Image($id == id)
|
||||||
then
|
then
|
||||||
$image.setImageType(ImageType.fromString($imageType));
|
$imageToBeRecategorized.setImageType(ImageType.fromString($imageType));
|
||||||
|
update($imageToBeRecategorized);
|
||||||
|
retract($recategorization);
|
||||||
|
update($imageToBeRecategorized.getParent());
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1076,6 +1088,7 @@ rule "X.1.0: merge intersecting Entities of same type"
|
|||||||
retract($first);
|
retract($first);
|
||||||
retract($second);
|
retract($second);
|
||||||
insert(mergedEntity);
|
insert(mergedEntity);
|
||||||
|
mergedEntity.getIntersectingNodes().forEach(node -> update(node));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1086,6 +1099,7 @@ rule "X.2.0: remove Entity of type ENTITY when contained by FALSE_POSITIVE"
|
|||||||
$falsePositive: RedactionEntity($type: type, entityType == EntityType.FALSE_POSITIVE)
|
$falsePositive: RedactionEntity($type: type, entityType == EntityType.FALSE_POSITIVE)
|
||||||
$entity: RedactionEntity(containedBy($falsePositive), type == $type, entityType == EntityType.ENTITY, !resized, !skipRemoveEntitiesContainedInLarger)
|
$entity: RedactionEntity(containedBy($falsePositive), type == $type, entityType == EntityType.ENTITY, !resized, !skipRemoveEntitiesContainedInLarger)
|
||||||
then
|
then
|
||||||
|
$entity.getIntersectingNodes().forEach(node -> update(node));
|
||||||
$entity.removeFromGraph();
|
$entity.removeFromGraph();
|
||||||
retract($entity)
|
retract($entity)
|
||||||
end
|
end
|
||||||
@ -1135,6 +1149,7 @@ rule "X.6.0: remove Entity of lower rank, when intersected by entity of type ENT
|
|||||||
$higherRank: RedactionEntity($type: type, entityType == EntityType.ENTITY)
|
$higherRank: RedactionEntity($type: type, entityType == EntityType.ENTITY)
|
||||||
$lowerRank: RedactionEntity(intersects($higherRank), type != $type, dictionary.getDictionaryRank(type) < dictionary.getDictionaryRank($type), !resized, !skipRemoveEntitiesContainedInLarger)
|
$lowerRank: RedactionEntity(intersects($higherRank), type != $type, dictionary.getDictionaryRank(type) < dictionary.getDictionaryRank($type), !resized, !skipRemoveEntitiesContainedInLarger)
|
||||||
then
|
then
|
||||||
|
$lowerRank.getIntersectingNodes().forEach(node -> update(node));
|
||||||
$lowerRank.removeFromGraph();
|
$lowerRank.removeFromGraph();
|
||||||
retract($lowerRank);
|
retract($lowerRank);
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user