StudentRecordSet-class | R Documentation |
"StudentRecordSet"
This class provides a collection of student records. Optionally, it can be hitched to a database so that student can be saved and restored across scoring sessions.
The StudentRecordSet
exists to hold a collection of
StudentRecord
objects. If, when constructed, the
record set is passed information about a database, the record set is
stored in the database. If not, it is merely stored in memory. The
database version, in particular, allows restoring the object from
memory. The primary key for the student record in the database is the
app
ID (which is a field in the record set) and the uid
which is passed through the getSR
method.
The method getSR
takes different arguments based on
which version is passed. In particular, the ser
argument
allows a serialized (JSON) version of the data to be passed in.
In particular, getSR
will do one of the following
things (in order of priority):
If the ser
argument is supplied, the student record
will be restored from this.
If the StudentRecordSet
is connected to a database,
then the student record is restored from information in the
database, based on the uid
argument and the app
field.
A new student record is created for the uid
.
The record set also contains a link to a PnetWarehouse
which it uses to try and find the Pnet
associated with the StudentRecord
. If the
Pnet
already exists in the warehouse, it is just connected to
the fetched record. If not, then it is restored from a serialized
version either from the passed in serialized record, or from the
serialized Pnet
in the database.
All reference classes extend and inherit methods from
"envRefClass"
.
signature(x = "StudentRecordSet")
: Returns the
application this record set is associated with.
signature(srs = "StudentRecordSet",
uid="ANY",ser="character")
: Returns the student record for the
specified ID. If ser
is supplied it should be a json list
object containing the student record.
signature(srs = "StudentRecordSet",
uid="character")
: Creates a new Student Record for the
specified ID by cloning the default student record.
signature(srs = "StudentRecordSet")
: If
connected to a database, the SR is saved to the database.
signature(srs = "StudentRecordSet")
: If
connected to a database, the SR in the database are cleared.
app
:Object of class character
which contains
the application identifier
dbname
:Object of class character
which
contains the name of the database.
db
:Object of class JSONDB
a connection to the
database or NULL
if the object is not connected to the
database. Users should call the recorddb()
function rather
than access this field directly.
warehouse
:Object of class
PnetWarehouse
which contains already loaded
nets.
defaultSR
:Object of class
StudentRecord
or NULL
. This is the
default student record which is cloned to create new studnet records.
initialize(app, dbname, dburi, db, warehouse,
...)
:Initializes the student record set.
recorddb()
:Returns the database handle (if connected
to a database) or NULL
if not connected to a database.
Note that this initializes the database the first time it is
called, so it should be called rather than accessing the db
field directly.
clearAll(clearDefault=FALSE)
:Clears all records from
the database and the warehouse. If clearDefault==FALSE
,
then the default record is not cleared.
Russell Almond
StudentRecordSet
for the constructor.
StudentRecord
for the contained objects.
PnetWarehouse
and Pnet
for
information about the contained Bayesian networks.
BNEngine
for the engine that holds it.
showClass("StudentRecordSet")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.