RED-7898 - Publish rule is not applied line-wise
This commit is contained in:
parent
7aec2801a1
commit
a68633091a
@ -172,6 +172,18 @@ public class Table implements SemanticNode {
|
|||||||
return streamChildrenOfType(NodeType.TABLE_CELL).map(node -> (TableCell) node);
|
return streamChildrenOfType(NodeType.TABLE_CELL).map(node -> (TableCell) node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streams all TableCells that contain at least one entity of a given type in this Table row-wise.
|
||||||
|
*
|
||||||
|
* @param type The type of the entity
|
||||||
|
* @return Stream of filtered TableCells
|
||||||
|
*/
|
||||||
|
public Stream<TableCell> streamTableCellsWhichContainType(String type) {
|
||||||
|
|
||||||
|
return streamTableCells()
|
||||||
|
.filter(tableCell -> tableCell.getEntities().stream().filter(TextEntity::active).anyMatch(entity -> entity.getType().equals(type)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streams all TableCells in this Table which have the provided header row-wise.
|
* Streams all TableCells in this Table which have the provided header row-wise.
|
||||||
|
|||||||
@ -147,9 +147,8 @@ rule "CBI.7.0: Do not redact Names and Addresses if published information found
|
|||||||
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
||||||
when
|
when
|
||||||
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
||||||
$tableCell: TableCell() from $table.streamTableCells().toList()
|
$cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList()
|
||||||
$sameRowCell: TableCell(row == $tableCell.row) from $table.streamTableCells().toList()
|
$tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList()
|
||||||
TextEntity(type == "published_information", active()) from $tableCell.getEntities()
|
|
||||||
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
||||||
then
|
then
|
||||||
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
||||||
|
|||||||
@ -330,9 +330,8 @@ rule "CBI.7.0: Do not redact Names and Addresses if published information found
|
|||||||
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
||||||
when
|
when
|
||||||
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
||||||
$tableCell: TableCell() from $table.streamTableCells().toList()
|
$cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList()
|
||||||
$sameRowCell: TableCell(row == $tableCell.row) from $table.streamTableCells().toList()
|
$tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList()
|
||||||
TextEntity(type == "published_information", active()) from $tableCell.getEntities()
|
|
||||||
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
||||||
then
|
then
|
||||||
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
||||||
|
|||||||
@ -143,9 +143,8 @@ rule "CBI.7.0: Do not redact Names and Addresses if published information found
|
|||||||
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
||||||
when
|
when
|
||||||
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
||||||
$tableCell: TableCell() from $table.streamTableCells().toList()
|
$cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList()
|
||||||
$sameRowCell: TableCell(row == $tableCell.row) from $table.streamTableCells().toList()
|
$tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList()
|
||||||
TextEntity(type == "published_information", active()) from $tableCell.getEntities()
|
|
||||||
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
||||||
then
|
then
|
||||||
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
||||||
|
|||||||
@ -330,9 +330,8 @@ rule "CBI.7.0: Do not redact Names and Addresses if published information found
|
|||||||
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
||||||
when
|
when
|
||||||
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
||||||
$tableCell: TableCell() from $table.streamTableCells().toList()
|
$cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList()
|
||||||
$sameRowCell: TableCell(row == $tableCell.row) from $table.streamTableCells().toList()
|
$tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList()
|
||||||
TextEntity(type == "published_information", active()) from $tableCell.getEntities()
|
|
||||||
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
||||||
then
|
then
|
||||||
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
||||||
|
|||||||
@ -330,9 +330,8 @@ rule "CBI.7.0: Do not redact Names and Addresses if published information found
|
|||||||
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
rule "CBI.7.1: Do not redact Names and Addresses if published information found in same table row"
|
||||||
when
|
when
|
||||||
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
$table: Table(hasEntitiesOfType("published_information"), hasEntitiesOfType("CBI_author"))
|
||||||
$tableCell: TableCell() from $table.streamTableCells().toList()
|
$cellsWithPublishedInformation: TableCell() from $table.streamTableCellsWhichContainType("published_information").toList()
|
||||||
$sameRowCell: TableCell(row == $tableCell.row) from $table.streamTableCells().toList()
|
$tableCell: TableCell(row == $cellsWithPublishedInformation.row) from $table.streamTableCells().toList()
|
||||||
TextEntity(type == "published_information", active()) from $tableCell.getEntities()
|
|
||||||
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
$author: TextEntity(type == "CBI_author", active()) from $tableCell.getEntities()
|
||||||
then
|
then
|
||||||
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
$author.skipWithReferences("CBI.7.1", "Published Information found in row", $table.getEntitiesOfTypeInSameRow("published_information", $author));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user