davemckain / qtiworks

**This project will be closed in early 2023!** IMS QTI 2.1 assessment delivery engine and Java development library (JQTI+). Supports the MathAssess extensions. Replacement for QTIEngine/JQTI and MathAssessEngine/JQTI. Note that this project has now ended and no further work is currently planned.
Other
67 stars 55 forks source link

correctResponse only accepts one value, but the QTI 2.1 specification allows 1 or many #80

Open RosemaryOrchard opened 2 years ago

RosemaryOrchard commented 2 years ago

If I upload a QTI package containing:

<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string">
    <correctResponse>
        <value>largest</value>
        <value>biggest</value>
    </correctResponse>
    <mapping lowerBound="0" upperBound="0.6" defaultValue="0">
        <mapEntry mapKey="largest" mappedValue="0.6" caseSensitive="false" />
        <mapEntry mapKey="biggest" mappedValue="0.6" caseSensitive="false" />
    </mapping>
</responseDeclaration>

QTIworks outputs the following:

Severity | Node | Line number | Column number | Message
-- | -- | -- | -- | --
Error | correctResponse | 12 | 22 | Invalid values count. Expected: 1. Found: 2

The 2.1 specification says:

Class : correctResponse ... Contains : value [1..*] {ordered} The order of the values is signficant only when the response is of ordered cardinality.

davemckain commented 2 years ago

Hi Rosemary. My memory of the QTI 2.1 spec is getting a bit hazy now...! But I think that QTIWorks is doing the right thing here.

correctResponse is used to declare the/a best response to the interaction, and is used to show the correct answer if the student clicks on the "Show model solution" button.

I suspect you're trying to use it to define multiple possible answers. This isn't how correctResponse works, and you're getting a validation error because your RESPONSE identifier has been declared to have single cardinality, but your correctResponse contains multiple value children so has multiple cardinality.

You should be able to fix your item by removing one of those 2 correctResponse values, but keeping your mapping to cover the alternative answers.

If it helps, the text_entry1.xml example (no. 35 in the list) demonstrates what I think you're trying to do here: https://webapps.ph.ed.ac.uk/qtiworks/anonymous/samples

RosemaryOrchard commented 2 years ago

Unfortunately, that's not correct. The specification explicitly says 1..*, meaning one or more of. I am aware my example above has single rather than multiple cardinality, but if that is the cause of the error I would hope for that in the output, rather than the misleading error that correctResponse does not allow more than one value.

davemckain commented 2 years ago

correctResponse allows 1..* values so that you can specify a correct response having container (e.g. multiple) cardinality, not to allow you to specify multiple different correct responses.

For example, in a multiple response question having options A, B, C, D and E, and where the correct response is to pick both options A & C, then your response variable would have multiple cardinality, and the correctResponse would be specified as <value>A</value><value>C</value>.

The QTI spec arguably doesn't define "value" particularly clearly. It's OK for single cardinality variables, but for container variables, "value" might be better called "element" or "item".

The singleness of correctResponse is maybe a bit clearer if you scroll up to the definition of responseDeclaration. There, it says:

Contains : [correctResponse] [0..1] A response declaration may assign an optional correctResponse. This value may indicate the only possible value of the response variable to be considered correct or merely just a correct value. For responses that are being measured against a more complex scale than correct/incorrect this value should be set to the (or an) optimal value. Finally, for responses for which no such optimal value is defined the correctResponse must be omitted. If a delivery system supports the display of a solution then it should display the correct values of responses (where defined) to the candidate. When correct values are displayed they must be clearly distinguished from the candidate's own responses (which may be hidden completely if necessary).