Search in sources :

Example 1 with QTIMetadataType

use of org.olat.imsqti.xml.manifest.QTIMetadataType in project OpenOLAT by OpenOLAT.

the class ManifestMetadataBuilder method setQtiMetadataTool.

public void setQtiMetadataTool(String toolName, String toolVendor, String toolVersion) {
    QTIMetadataType qtiMetadata = getQtiMetadata(true);
    qtiMetadata.setToolName(toolName);
    qtiMetadata.setToolVendor(toolVendor);
    qtiMetadata.setToolVersion(toolVersion);
}
Also used : QTIMetadataType(org.olat.imsqti.xml.manifest.QTIMetadataType)

Example 2 with QTIMetadataType

use of org.olat.imsqti.xml.manifest.QTIMetadataType in project OpenOLAT by OpenOLAT.

the class ManifestMetadataBuilder method getQtiMetadata.

/**
 * Return the qti metadata if it exists or if specified, create
 * one and append it to the metadata of the resource.
 *
 * @param resource The resource with the metadata
 * @param create True create the qtiMetadata
 * @return
 */
public QTIMetadataType getQtiMetadata(boolean create) {
    List<Object> anyMetadataList = getMetadataList();
    QTIMetadataType qtiMetadata = null;
    for (Object anyMetadata : anyMetadataList) {
        if (anyMetadata instanceof JAXBElement<?> && ((JAXBElement<?>) anyMetadata).getValue() instanceof QTIMetadataType) {
            qtiMetadata = (QTIMetadataType) ((JAXBElement<?>) anyMetadata).getValue();
        }
    }
    if (qtiMetadata == null && create) {
        qtiMetadata = qtiObjectFactory.createQTIMetadataType();
        getMetadataList().add(qtiObjectFactory.createQtiMetadata(qtiMetadata));
    }
    return qtiMetadata;
}
Also used : JAXBElement(javax.xml.bind.JAXBElement) QTIMetadataType(org.olat.imsqti.xml.manifest.QTIMetadataType)

Example 3 with QTIMetadataType

use of org.olat.imsqti.xml.manifest.QTIMetadataType in project openolat by klemens.

the class ManifestMetadataBuilder method setQtiMetadataTool.

public void setQtiMetadataTool(String toolName, String toolVendor, String toolVersion) {
    QTIMetadataType qtiMetadata = getQtiMetadata(true);
    qtiMetadata.setToolName(toolName);
    qtiMetadata.setToolVendor(toolVendor);
    qtiMetadata.setToolVersion(toolVersion);
}
Also used : QTIMetadataType(org.olat.imsqti.xml.manifest.QTIMetadataType)

Example 4 with QTIMetadataType

use of org.olat.imsqti.xml.manifest.QTIMetadataType in project openolat by klemens.

the class ManifestPackageTest method readManifest.

/**
 * @throws URISyntaxException
 */
@Test
public void readManifest() throws URISyntaxException {
    URL xmlUrl = ManifestPackageTest.class.getResource("resources/manifest/oo_assessmentitem_imsmanifest_12_2.xml");
    File xmlFile = new File(xmlUrl.toURI());
    ManifestBuilder manifest = ManifestBuilder.read(xmlFile);
    ManifestMetadataBuilder questionMetadata = manifest.getResourceBuilderByHref("sca9b540c9684ba58f489f02e8b5c590.xml");
    Assert.assertNotNull(questionMetadata);
    // LOM
    String title = questionMetadata.getTitle();
    Assert.assertEquals("Metadata", title);
    String identifier = questionMetadata.getIdentifier();
    Assert.assertEquals("id9f1ae47b-dc7f-482e-a688-111287f99fa6", identifier);
    String keywords = questionMetadata.getGeneralKeywords();
    Assert.assertTrue(keywords.contains("Meta"));
    Assert.assertTrue(keywords.contains("data"));
    Assert.assertTrue(keywords.contains("keywords"));
    String context = "de";
    Assert.assertEquals("de", context);
    // educational
    String educationContext = questionMetadata.getEducationContext();
    Assert.assertEquals("Primarschule", educationContext);
    String typicalLearningTime = "P1DT2H3M4S";
    Assert.assertEquals("P1DT2H3M4S", typicalLearningTime);
    // lifecycle
    String version = "1.0";
    Assert.assertEquals("1.0", version);
    // classification
    String taxonomyPath = questionMetadata.getClassificationTaxonomy();
    Assert.assertEquals("/Mathematik/Topologie", taxonomyPath);
    // QTI 2.1
    QTIMetadataType qtiMetadata = questionMetadata.getQtiMetadata(false);
    Assert.assertTrue(qtiMetadata.getInteractionType().contains("choiceInteraction"));
    Assert.assertEquals("OpenOLAT", qtiMetadata.getToolName());
    Assert.assertEquals("12.3a", qtiMetadata.getToolVersion());
    // OpenOLAT specific
    OpenOLATMetadataType openolatMetadata = questionMetadata.getOpenOLATMetadata(false);
    Assert.assertEquals(Double.valueOf(0.5d), openolatMetadata.getDiscriminationIndex());
    Assert.assertEquals(Double.valueOf(0.3d), openolatMetadata.getDifficulty());
    Assert.assertEquals(Double.valueOf(0.4d), openolatMetadata.getStandardDeviation());
    Assert.assertEquals(Integer.valueOf(1), openolatMetadata.getDistractors());
    Assert.assertEquals("sc", openolatMetadata.getQuestionType());
    Assert.assertEquals(Integer.valueOf(12), openolatMetadata.getUsage());
    Assert.assertEquals("formative", openolatMetadata.getAssessmentType());
}
Also used : File(java.io.File) OpenOLATMetadataType(org.olat.oo.xml.manifest.OpenOLATMetadataType) URL(java.net.URL) QTIMetadataType(org.olat.imsqti.xml.manifest.QTIMetadataType) Test(org.junit.Test)

Example 5 with QTIMetadataType

use of org.olat.imsqti.xml.manifest.QTIMetadataType in project OpenOLAT by OpenOLAT.

the class ManifestPackageTest method readManifest.

/**
 * @throws URISyntaxException
 */
@Test
public void readManifest() throws URISyntaxException {
    URL xmlUrl = ManifestPackageTest.class.getResource("resources/manifest/oo_assessmentitem_imsmanifest_12_2.xml");
    File xmlFile = new File(xmlUrl.toURI());
    ManifestBuilder manifest = ManifestBuilder.read(xmlFile);
    ManifestMetadataBuilder questionMetadata = manifest.getResourceBuilderByHref("sca9b540c9684ba58f489f02e8b5c590.xml");
    Assert.assertNotNull(questionMetadata);
    // LOM
    String title = questionMetadata.getTitle();
    Assert.assertEquals("Metadata", title);
    String identifier = questionMetadata.getIdentifier();
    Assert.assertEquals("id9f1ae47b-dc7f-482e-a688-111287f99fa6", identifier);
    String keywords = questionMetadata.getGeneralKeywords();
    Assert.assertTrue(keywords.contains("Meta"));
    Assert.assertTrue(keywords.contains("data"));
    Assert.assertTrue(keywords.contains("keywords"));
    String context = "de";
    Assert.assertEquals("de", context);
    // educational
    String educationContext = questionMetadata.getEducationContext();
    Assert.assertEquals("Primarschule", educationContext);
    String typicalLearningTime = "P1DT2H3M4S";
    Assert.assertEquals("P1DT2H3M4S", typicalLearningTime);
    // lifecycle
    String version = "1.0";
    Assert.assertEquals("1.0", version);
    // classification
    String taxonomyPath = questionMetadata.getClassificationTaxonomy();
    Assert.assertEquals("/Mathematik/Topologie", taxonomyPath);
    // QTI 2.1
    QTIMetadataType qtiMetadata = questionMetadata.getQtiMetadata(false);
    Assert.assertTrue(qtiMetadata.getInteractionType().contains("choiceInteraction"));
    Assert.assertEquals("OpenOLAT", qtiMetadata.getToolName());
    Assert.assertEquals("12.3a", qtiMetadata.getToolVersion());
    // OpenOLAT specific
    OpenOLATMetadataType openolatMetadata = questionMetadata.getOpenOLATMetadata(false);
    Assert.assertEquals(Double.valueOf(0.5d), openolatMetadata.getDiscriminationIndex());
    Assert.assertEquals(Double.valueOf(0.3d), openolatMetadata.getDifficulty());
    Assert.assertEquals(Double.valueOf(0.4d), openolatMetadata.getStandardDeviation());
    Assert.assertEquals(Integer.valueOf(1), openolatMetadata.getDistractors());
    Assert.assertEquals("sc", openolatMetadata.getQuestionType());
    Assert.assertEquals(Integer.valueOf(12), openolatMetadata.getUsage());
    Assert.assertEquals("formative", openolatMetadata.getAssessmentType());
}
Also used : File(java.io.File) OpenOLATMetadataType(org.olat.oo.xml.manifest.OpenOLATMetadataType) URL(java.net.URL) QTIMetadataType(org.olat.imsqti.xml.manifest.QTIMetadataType) Test(org.junit.Test)

Aggregations

QTIMetadataType (org.olat.imsqti.xml.manifest.QTIMetadataType)10 OpenOLATMetadataType (org.olat.oo.xml.manifest.OpenOLATMetadataType)4 File (java.io.File)2 BigDecimal (java.math.BigDecimal)2 URL (java.net.URL)2 JAXBElement (javax.xml.bind.JAXBElement)2 Test (org.junit.Test)2 EducationalType (org.olat.imsmd.xml.manifest.EducationalType)2