Skip to content

Commit 826315b

Browse files
authored
Merge pull request #579 from Lexpedite/reorder_applies
Reorder applies
2 parents 57e9cb5 + 728cceb commit 826315b

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ As of v0.2-alpha, this project is attempting to adhere to [Semantic Versioning](
77
While alpha, however, any version may include breaking changes that may not be specifically noted as such,
88
and breaking changes will not necessarily result in changes to the main version number.
99

10+
## [v1.6.21-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.21-alpha) 2023-09-21
11+
12+
### Fixes
13+
* Attributed rules subject to applicability with multiple category checks were slowing the code.
14+
1015
## [v1.6.20-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.6.20-alpha) 2023-09-21
1116

1217
This release is backwards compatible with v1.6.19-alpha.

blawx/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from pathlib import Path
1414

1515
# For adding a version identifier
16-
BLAWX_VERSION = "v1.6.20-alpha"
16+
BLAWX_VERSION = "v1.6.21-alpha"
1717

1818

1919
# Build paths inside the project like this: BASE_DIR / 'subdir'.

blawx/static/blawx/scasp_generator.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,18 +1176,6 @@ sCASP['attributed_rule'] = function(block) {
11761176
// IF the user has said defeasible, the second rule checks for defeats.
11771177
// In order to check for defeats, we just need the conclusion, so that's fine. But to check for applicability,
11781178
// we need the list of objects whose categories have been tested in the conditions.
1179-
var applicable_targets = [];
1180-
if (checkbox_inapplicable) {
1181-
// So get the next block from the conditions connector, check if it is an object category block, if so add
1182-
// to the list of categories, repeat until there is no next block.
1183-
var statement = this.getInputTargetBlock('conditions');
1184-
while(statement) {
1185-
if (statement.type == "new_object_category") {
1186-
applicable_targets.push(sCASP.valueToCode(statement,'object', sCASP.ORDER_ATOMIC));
1187-
}
1188-
statement = statement.getNextBlock();
1189-
}
1190-
}
11911179
var first_rule = "according_to(" + value_source + ",";
11921180
var conclusion_parameters = deconstruct_term(statements_conclusion);
11931181
for (var i = 0; i< conclusion_parameters.length; i++) {
@@ -1197,16 +1185,15 @@ sCASP['attributed_rule'] = function(block) {
11971185
}
11981186
}
11991187
first_rule += ") :- ";
1200-
if (checkbox_inapplicable) {
1201-
for(var t=0; t < applicable_targets.length; t++) {
1202-
first_rule += "blawx_applies(" + value_source + "," + applicable_targets[t].trim() + "),\n";
1203-
}
1204-
}
12051188
currentBlock = this.getInputTargetBlock('conditions');
12061189
while (currentBlock) {
12071190
var codeForBlock = getCodeForSingleBlock(currentBlock);
1208-
currentBlock = currentBlock.getNextBlock();
1191+
if (currentBlock.type == "new_object_category" && checkbox_inapplicable) {
1192+
var target = sCASP.valueToCode(currentBlock,'object', sCASP.ORDER_ATOMIC)
1193+
codeForBlock += ",\nblawx_applies(" + value_source + "," + target.trim() + ")";
1194+
}
12091195
first_rule += codeForBlock;
1196+
currentBlock = currentBlock.getNextBlock();
12101197
if (currentBlock) {
12111198
first_rule += ",\n";
12121199
}

0 commit comments

Comments
 (0)