Skip to content

Commit

Permalink
Merge pull request #245 from Lexpedite:attributes
Browse files Browse the repository at this point in the history
adding the ability to display attributed values
  • Loading branch information
Gauntlet173 authored Jun 7, 2022
2 parents 48c9b24 + ea7ad3f commit efbdde2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ As of v0.2-alpha, this project is attempting to adhere to [Semantic Versioning](
While alpha, however, any version may include breaking changes that may not be specifically noted as such,
and breaking changes will not necessarily result in changes to the main version number.

## [v1.3.10-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.3.10-alpha) 2022-06-07

Fixing display of attributed variables in answers.

### Changed
* Inequality and numerical constraints on bound variables are now displayed in the bindings of answers.
* Names generated by the reasoner are not displayed as attributes.

## [v1.3.9-alpha](https://github.com/Lexpedite/blawx/releases/tag/v1.3.9-alpha) 2022-06-03

Added ontology and interview endpoints for tests, and added BlawxBot demonstration expert systems to tests.
Expand Down
26 changes: 25 additions & 1 deletion blawx/static/blawx/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,33 @@ runCode = function(button) {
models = answers[i].Models;
output_content += '<div class="accordian accordian-flush">'
output_content += '<ul>'
var attributes_output = "";
for (var key in variables) {
output_content += '<li>' + key + ': ' + variables[key] + '</li>';
if (key == "Attributes") {
for (var attribute in variables['Attributes']) {
if (variables['Attributes'][attribute]['functor'] == "put_attr" && variables['Attributes'][attribute]['args'][1] == 'scasp_output' && variables['Attributes'][attribute]['args'][2]['functor'] == 'name') {
// This is designed to prevent re-printing information about the Attributes that is already displayed.
// If the only thing present int he attributes is the name, just skip it.
continue;
} else if (variables['Attributes'][attribute]['functor'] == "∉") {
// This is an inequality constraint
attributes_output += "<li>where " + variables['Attributes'][attribute]['args'][0] + " is not ";
if (variables['Attributes'][attribute]['args'][1].length > 1) {
attributes_output += "one of ";
}
attributes_output += variables['Attributes'][attribute]['args'][1].toString() + "</li>"
} else if (variables['Attributes'][attribute]['functor'] == "{}") {
attributes_output += "<li>where" + variables['Attributes'][attribute]['args'][0]['args'][0] + " " + variables['Attributes'][attribute]['args'][0]['functor'] + " " + variables['Attributes'][attribute]['args'][0]['args'][1] + "</li>";
} else {
// It should throw a console warning if there was something else in there.
console.warn("Unrecognized attribute in output: " + attribute['functor'] + ".");
}
}
} else {
output_content += '<li>' + key + ': ' + variables[key] + '</li>';
}
}
output_content += attributes_output;
output_content += '</ul>'

for (let j = 0; j < models.length; j++) {
Expand Down
26 changes: 25 additions & 1 deletion blawx/templates/blawx/bot.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,33 @@ <h5 class="card-title">Test Facts</h5>
models = answers[i].Models;
output_content += '<div class="accordian accordian-flush">'
output_content += '<ul>'
var attributes_output = "";
for (var key in variables) {
output_content += '<li>' + key + ': ' + variables[key] + '</li>';
if (key == "Attributes") {
for (var attribute in variables['Attributes']) {
if (variables['Attributes'][attribute]['functor'] == "put_attr" && variables['Attributes'][attribute]['args'][1] == 'scasp_output' && variables['Attributes'][attribute]['args'][2]['functor'] == 'name') {
// This is designed to prevent re-printing information about the Attributes that is already displayed.
// If the only thing present int he attributes is the name, just skip it.
continue;
} else if (variables['Attributes'][attribute]['functor'] == "∉") {
// This is an inequality constraint
attributes_output += "<li>where " + variables['Attributes'][attribute]['args'][0] + " is not ";
if (variables['Attributes'][attribute]['args'][1].length > 1) {
attributes_output += "one of ";
}
attributes_output += variables['Attributes'][attribute]['args'][1].toString() + "</li>"
} else if (variables['Attributes'][attribute]['functor'] == "{}") {
attributes_output += "<li>where" + variables['Attributes'][attribute]['args'][0]['args'][0] + " " + variables['Attributes'][attribute]['args'][0]['functor'] + " " + variables['Attributes'][attribute]['args'][0]['args'][1] + "</li>";
} else {
// It should throw a console warning if there was something else in there.
console.warn("Unrecognized attribute in output: " + attribute['functor'] + ".");
}
}
} else {
output_content += '<li>' + key + ': ' + variables[key] + '</li>';
}
}
output_content += attributes_output;
output_content += '</ul>'

for (let j = 0; j < models.length; j++) {
Expand Down

0 comments on commit efbdde2

Please sign in to comment.