SASI-Manual

by Alexander Merz
$Id: manual.html,v 1.2 2004/03/11 16:01:52 alexmerz Exp $

Table of contents

What is SASI?

SASI is short for SCORM-aicc_script-Interpreter. If you need general information about SCORM visit the ADLNet website. A short explanation follows:

SCORM is short for "Sharable Content Object Reference Model". The idea behind this is a independent standard for exchancing resources for learners and students. It defines how this resources are organized and depends on each other, it says how to run such resources and provides a data model for student specific results while using such a resource.

SCORM 1.2 based courses are described using XML. On of the XML-tags is <adlc:prerequisites> which describe, when a student can enter a specific resource. This description is written in aicc_script, not really a script or programming language, more an expression.

An example of such an expression is:

          (s1&s2)&2*{s3,s4,s5}
         
The identifier sX stand for an item X which can the student have passed (read/viewed) or not. (An item represents a resource in SCORM speech, BTW)

The expression means: the student can enter this item, if the resources s1 and s2 where passed, and if he/she passed at least two of the given resources in the braces (s3, s4 or s5).

SASI helps you at this point: you provide a list of items with their status ("passed", "failed"...) and the expression to evalute - and SASI say you if the expression is true or not.

Getting SASI

SASI is a project hosted on SourceForge.net.

The current release of SASI is avaible on the SASI-Project website.

There are two kinds of files avaible for each release:

Installation

There is no much to say about installation. Just copy the downloaded .jar file somewhere in your filesystem, where Java looks for class files.

Testing

The SASI.jar file contains a executable class. For a simple test on the commandline: switch in your shell to the directory where the jar file is located, then execute:

          java -classpath SASI.jar SASI
         
You should see some output with "true" and "false".

If you get a Java error message ("class not found" or similar), then the jar file could be corrupted and try to download the file again.

Using

If you want to use SASI in your application, ensure that SASI.jar is in your Java classpath. The you must import the SASI* classes:

          import net.sourceforge.sasi.*;
         
You need also java.util.HashMap for the list of items and there status.

The items and status must stored in a HashMap, where the item identifier is used as key and the value is the status, bioth stored as String:

          import java.util.HahsMap;
          ...
          HashMap hm = new HashMap():
          hm.put("s1", "passed");
          hm.put("s2", "failed");
          ...
         

The next steps depends on your desire; you can use SASI in two ways:

Evaluating an expression to true or false consists of two parts: first parsing the expression into a tree representation; and second going through the tree an evaluate each node in this tree. Creating the tree requires time and storing the tree memory; evaluting the tree less time and no memory.

Static usage

If you want to evaluate an expression only once, you should use this way.

            // the expression to evaluate
            String expression = "...." ;
            // create the tree
            SASIEval tree = SASIInterpreter.create(expression);
            // evaluate the expression based on the data in the HashMap
            boolean result = SASIInterpreter.interpret(tree, hm);
         
We could also write this as:
            SASIInterpreter.interpret(SASIInterpreter.create(expression), hm);
         
The advantage of this way is, we have to keep the tree in memory only for a short time, on the other side the tree is build up each time.

OO-based usage

If you want to create ie. a SCORM player, you have to evalute an expression each time after the student did something with an item, like finishing an item. In such situations you should keep the tree persistent and re-evaluate the expression only.

We start with creating an array for your interpreter objects

          SASIInterpreter [] sasi = new SASIInterpreter[2];

          sasi[0] = new SASIInterpreter("s0");
          sasi[1] = new SASIInterpreter("s1|s2");
          sasi[2] = new SASIInterpreter("~s2");
         
Now, we create the trees:
          for(int i=0; i<sasi.length(); i++)
            sasi[i].create();
         
Somewhere on an other place, we evaluate them
          if(something_has_changed) {
            for(int i=0; i<sasi.length(); i++)
                Item[i].setAccess(sasi[i].interprete(hm));
          }
         
(Item may represent an array with objects of a class managing the items of a SCORM course.)

Building SASI from Source

You can build SASI from the Java source only, or up from the grammar files. You need the zipped source file in both cases

From Java source only

Just run the Java compiler over the *.java files located in the source base dir, the java_cup/runtime dir and the net/sourceforge/sasi directory.

Note, that it makes no sense to edit other files than SASIInterpreter.java and SASIEval.java in the net/sourceforge/sasi directory. The other files are created from the grammar files, and the files in directory java_cup directory are part of the CUP project.

From the grammar files

After changing the grammar files (sasi.cup and sasi.flex), you must recreate the classes SASIParser.java, SASISym.java and SASILexer.java.

To do this you must have installed CUP and JFlex.

First create the SASILexer.java by using JFlex and then run CUP. Which settings are required can be fetched from makejj.bat. The further steps are equal to installing from Java source.

As side note: if this explanation is to comprehensive for you, then you should not edit the grammar files.

A note about SCORM 2004

SASI handles a tag which is part of the SCROM 1.2 standard, but it is deprecated in the SCORM 2004 standard. In the new standard they use a bunch of complex XML-tags to offer more flexibility for navigating and sequencing. (You can also say, they replaced a single tree with a jungle)

Due to the complexity of the new stuff, it still makes sense to support the old prerequisites-tag. I'm sure, a lot of people/companies will still use the simple tag also in SCORM 2004 compliant courses. (You does not want to know, what is required for expressing a simple "s1&s2" with the new XML-tags)