Question Block

Question Block

Where Is It?

The question block is found in the Primary drawer of the Blawx toolbox.

What Does It Do?

The question block is used to send a question to the Blawx reasoner, and get one or more answers based on the code provided.

In most programming languages, all of the code that you write tells the computer what to "do". In Blawx, that's not true. Most of the code tells the computer what it "knows," and only question blocks ask the computer to do anything.

So if you have code, but no question block, when you click "Run", nothing much will happen!

Technical Details

The question block is an outer block, and accepts a single stack of statements. Multiple statements together are treated as though they were seperated with "and", and all of the statements must be true at the same time for the reasoner to find an answer.

Running your code in the Test Editor with a question block in the code will make Blawx attempt to find any values that can be placed into any variables in your question, so as to make the statement or statements in the question true.

If there are no values which can be used to make the statement or statements true, the server will return the text "No Models" in the Test Editor Output Pane.

If the statement or statements is true for any number of values, each combination of values will be returned as an answer. Each reason those values make the statement true will be returned as an explanation for that answer. One answer may have more than one explanation. Each explanation will include reasons that each statement in the question was true in that model.

Note that a question with no variables can only have either one answer which indicates the statement is true, or "no models" which indicates that it is not. But if it is true, it still may have multiple explanations.

If you have more than one question block in your Test Editor when you run your test, Blawx will use only one of them, and it can be difficult to predict which. If you want to have multiple questions, but use only one at a time, it is best to mark the question blocks you are not using as "disabled" in the context menu for that question block.

Tips

If your question block returns the answer "no models found", but you think that it should be finding answers, here are a few good troubleshooting tricks:

  1. Try removing statements from the question block until you get an answer, and then adding them back in until you find which statement is failing.
  2. Try removing variables from the question block and replacing them with object selectors that you think should have been returned.
  3. Try using assumption blocks to see if adding or removing assumptions from your code changes the result.
  4. If your query is a single statement, try surrounding it with a not block, to see if Blawx can explain why no answer was found.
  5. If the query and the opposite both return no models, check to see if disabling relevant logical constraint blocks prevents that from happening.
  6. If you are using defaults and exceptions, try to query whether your conclusions hold, or are defeasibly concluded by using the "holds" and "according to" blocks.