Difference between revisions of "Open Problem Library"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 5: Line 5:
 
== Obtaining the NPL ==
 
== Obtaining the NPL ==
   
First, make sure you have an <code>/opt/webwork/libraries</code> directory:
 
  +
The National Problem Library can be checked out from the WeBWorK Subversion repository via
  +
{{SVN checkout|repo=npl|branch=trunk|dir=NationalProblemLibrary}}
  +
  +
== Installing the NPL ==
  +
  +
This section assumes you have an otherwise working WeBWorK installation. The standard [[:Category:Installation Manuals|Installation instructions]] recommend WeBWorK be installed into <tt>/opt/webwork</tt>, and the instuctions here assume that location. If your installation is elsewhere, you will have to make the appropriate adjustments. So, assuming the rest of WeBWorK is in <tt>/opt/webwork/</tt> procede as follows to install the NPL. First, make sure you have an <code>/opt/webwork/libraries</code> directory:
   
 
$ mkdir -p /opt/webwork/libraries
 
$ mkdir -p /opt/webwork/libraries
   
The database problem library can be downloaded from the npl CVS repository.
+
The database problem library can be downloaded from the <tt>npl</tt> SVN repository as described above and then moved under <tt>/opt/webwork/libraries/</tt>. Or, it can be downloaded directly into that directory:
   
 
$ cd /opt/webwork/libraries
 
$ cd /opt/webwork/libraries
$ cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/npl co NationalProblemLibrary
+
$ {{SVN checkout|repo=npl|branch=trunk|dir=NationalProblemLibrary}}
# the old version was checked out using:
 
# $ cvs -d :pserver:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/asu co database_problems
 
# This old repository will no longer be updated, and will soon not be available.
 
   
 
Since courses will also look for problem libraries
 
Since courses will also look for problem libraries
Line 141: Line 146:
 
== Updating the NPL ==
 
== Updating the NPL ==
   
The CVS repository for the NPL is updated as problems are added, additional metadata is added, or problem bugs are fixed. So, it is a good idea to update your copy of the NPL periodically, say once per semester.
+
The SVN repository for the NPL is updated as problems are added, additional metadata is added, or problem bugs are fixed. So, it is a good idea to update your copy of the NPL periodically, say once per semester.
   
To update, run the <code>cvs update</code> command to download the latest versions from our server. Then, re-run <code>loadDB2</code> (WeBWorK 2.3.x) or NPL-update (WeBWorK 2.4.x).
+
To update, run the <code>svn update</code> command to download the latest versions from our server. Then, re-run <code>loadDB2</code> (WeBWorK 2.3.x) or NPL-update (WeBWorK 2.4.x).
   
$ cd /opt/webwork/libraries/database_problems
+
$ cd /opt/webwork/libraries/NationalProblemLibrary
$ cvs -q update -dPA
+
$ svn up
$ ./loadDB2
+
$ ./NPL-update
What is the root password for mysql? *****
+
What is the root password for mysql? ***** (#Or the webworkWrite user, following recent [[:Category:Installation Manuals|installation instructions]]
 
Mysql database reinitialized
 
Mysql database reinitialized
 
Converting data from tagged pgfiles into mysql.
 
Converting data from tagged pgfiles into mysql.
Line 161: Line 166:
   
 
[[Category:Problem Libraries]]
 
[[Category:Problem Libraries]]
  +
[[Category:National Problem Library]]

Revision as of 09:45, 28 June 2010

The National Problem Library contains problems from several of the File Based Problem Libraries, including all of the problems from the Arizona State, Rochester, Cal State Long Beach, University of Virginia libraries. It also contains most, if not all, of the problems from Union College, College of New Jersey, Dartmouth, Ohio State, Northern Arizona University, and Indiana University.

In addition to merging these problem collections into a single collection, WeBWorK provides a different interface to these problems. Problems in the NPL are marked internally with metadata, and instructors can search for problems on the basis of this data. This mechanism is built into WeBWorK's library browser. In particular, one can search hierarchically by course, chapter, section. To a limited extent, problems have been indexed against sections of textbooks in which case an instructor can also search for problems on that basis. WeBWorK stores this information in a database, so part of the installation involves loading metadata into the database.

Obtaining the NPL

The National Problem Library can be checked out from the WeBWorK Subversion repository via

svn co http://svn.webwork.maa.org/npl/trunk/NationalProblemLibrary

Installing the NPL

This section assumes you have an otherwise working WeBWorK installation. The standard Installation instructions recommend WeBWorK be installed into /opt/webwork, and the instuctions here assume that location. If your installation is elsewhere, you will have to make the appropriate adjustments. So, assuming the rest of WeBWorK is in /opt/webwork/ procede as follows to install the NPL. First, make sure you have an /opt/webwork/libraries directory:

$ mkdir -p /opt/webwork/libraries

The database problem library can be downloaded from the npl SVN repository as described above and then moved under /opt/webwork/libraries/. Or, it can be downloaded directly into that directory:

$ cd /opt/webwork/libraries
$ svn co http://svn.webwork.maa.org/npl/trunk/NationalProblemLibrary

Since courses will also look for problem libraries at /opt/webwork/libraries/ProblemLibrary, and /opt/webwork/libraries/database_problib For backwards compatibility we'll create symbolic links to:

$ ln -s /opt/webwork/libraries/NationalProblemLibrary /opt/webwork/libraries/ProblemLibrary
$ ln -s /opt/webwork/libraries/NationalProblemLibrary /opt/webwork/libraries/database_problems

Depending on your previous setup you may have to create additional symbolic links from the previous locations of libraries to the current ones. In particular the popular file libraries are now contained in the National Problem Library so you may need links such as

$ ln -s /opt/webwork/libraries/NationalProblemLibrary/Rochester /opt/webwork/libraries/rochester_problib

at least in the short run to keep older set definition files working.

If you are running WeBWorK 2.3.x, you must create a ProblemLibrary database on your MySQL server. (***** represents the MySQL root password.)

$ mysql -u root
Password: *****
> CREATE DATABASE ProblemLibrary;
> GRANT SELECT on ProblemLibrary.* TO webworkWrite@localhost;
> quit
Bye.
$

If you are running WeBWorK 2.4.x, this is not necessary as the NPL indexes are stored within the main webwork database.

Configure WeBWorK to access the problem library. The settings are in global.conf:

For WeBWorK 2.3.x:

variable description
$problemLibrary{root} Path to NationalProblemLibrary directory. Should be /opt/webwork/libraries/NationalProblemLibrary.
$problemLibrary{version} Version of the problem library database. Should be =2=.
$problemLibrary{sourceSQL} Name of the database. Should be ProblemLibrary.
$problemLibrary{userSQL} Username to use when connecting to the database. Can usually be left as $database_username.
$problemLibrary{passwordSQL} Password to use when connecting to the database. Can usually be left as $database_password.

For WeBWorK 2.4.x

variable description
$problemLibrary{root} Path to NationalProblemLibrary directory. Should be /opt/webwork/libraries/NationalProblemLibrary.
$problemLibrary{version} Version of the problem library database. Should be =2=.
$problemLibrary_db{dbsource} Name of the database. Can usually be left as $database_dsn.
$problemLibrary_db{user} Username to use when connecting to the database. Can usually be left as $database_username.
$problemLibrary_db{passwd} Password to use when connecting to the database. Can usually be left as $database_password.

Finally, populate the database:

For WeBWorK 2.3.x:

Run the loadDB2 script to populate the database. This script must be run from the database_problems directory.

$ cd /opt/webwork/libraries/database_problems
$ ./loadDB2
What is the root password for mysql? *****
Mysql database reinitialized
Converting data from tagged pgfiles into mysql.
$ 

For WeBWorK 2.4.x:

Run the NPL-update script to populate the database. This script is located in the webwork2/bin directory and may be invoked from anywhere.

$ /opt/webwork/webwork2/bin/NPL-update
Mysql database reinitialized.
Reading in textbook data.
Converting data from tagged pgfiles into mysql.
Number of files processed:
   100   200   300   400   500   600   700   800   900  1000
...
Done.
$ 

There is no need to add symlinks to course templates directory, as is necessary with file based Problem Libraries. It is done automatically.

Browsing the NPL

Log into a WeBWorK course and select Library Browser from the links menu. On the resulting screen, click the National Problem Library button.

Add this stanza in the global.conf file to obtain an "NPL Directory" button which will enable you to browse the NationalProblemLibrary subdirectories.

# Additional library buttons can be added to the Library Browser (SetMaker.pm)
# by adding the libraries you want to the following line.  For each key=>value
# in the list, if a directory (or link to a directory) with name 'key' appears
# in the templates directory, then a button with name 'value' will be placed at
# the top of the problem browser.  (No button will appear if there is no
# directory or link with the given name in the templates directory.)  For
# example,
# 
#     $courseFiles{problibs} = {rochester => "Rochester", asu => "ASU"};
# 
# would add two buttons, one for the Rochester library and one for the ASU
# library, provided templates/rochester and templates/asu exists either as 
# subdirectories or links to other directories. The "NPL Directory" button
# activated below gives access to all the sub directories in the National 
# Problem Library.
# 
    $courseFiles{problibs}    = {
         Library          => "NPL Directory",
       #       rochesterLibrary => "Rochester", 
       #       asuLibrary       => "Arizona State",
       # 	dcdsLibrary      => "Detroit CDS",
       # 	dartmouthLibrary => "Dartmouth",
       # 	indianaLibrary   => "Indiana",
       # 	osuLibrary       => "Ohio State",	
       #	capaLibrary      => "CAPA",
       #	ucsbLibrary        => "UCSB"
   };

Updating the NPL

The SVN repository for the NPL is updated as problems are added, additional metadata is added, or problem bugs are fixed. So, it is a good idea to update your copy of the NPL periodically, say once per semester.

To update, run the svn update command to download the latest versions from our server. Then, re-run loadDB2 (WeBWorK 2.3.x) or NPL-update (WeBWorK 2.4.x).

$ cd /opt/webwork/libraries/NationalProblemLibrary
$ svn up
$ ./NPL-update
What is the root password for mysql? ***** (#Or the webworkWrite user, following recent installation instructions
Mysql database reinitialized
Converting data from tagged pgfiles into mysql.
$ 

Contributing to the NPL

If you have written new problems, you might like to contribute them to the NPL so others can benefit from them as well.