Skip to content

Similarity Checker Setup[Deprecated]

Rhys Young edited this page Feb 15, 2018 · 1 revision

All commands are to be run in Vagrant from the vagrant user's home directory (cd ~).

$ before a command indicates that it should be run in a regular shell; mysql> indicates the command should be in MySQL.

Install the Java Runtime Environment

$ sudo apt-get update && sudo apt-get install default-jre

Download Similarity Checker and Wrapper

$ wget -O jplag.jar https://github.com/jplag/jplag/releases/download/v2.11.8-SNAPSHOT/jplag-2.11.8-SNAPSHOT-jar-with-dependencies.jar
$ wget -O similarity-api.jar https://github.com/ipavl/similarity-api/releases/download/20170328/similarity-assembly-0.0.1-SNAPSHOT.jar

Create the Database

Create a MySQL database called similarity:

$ mysql
mysql> create database similarity;

Get Sample Assignment Data

$ git clone https://github.com/guelph-code-ninjas/sample-assignments submissions

Run the Service

$ SIMILARITY_DB_USER=homestead SIMILARITY_DB_PASSWORD=secret java -jar similarity-api.jar &>/dev/null &

This will run the service in the background with no output using the provided database credentials as environment variables. To run it in the foreground with output, exclude the &>/dev/null & part of the command.

To stop the service with the service running in the background, type fg to bring the process to the foreground and then CTRL+C, or run ps aux | grep similarity-api and kill <PID> where PID is the id of the java process running the service.

Checking the Database

$ mysql
mysql> use similarity;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from submissions;
+-----------+-----------+---------------+--------------+----+
| student_a | student_b | assignment_id | jplag_result | id |
+-----------+-----------+---------------+--------------+----+
| jdoe05    | jsmith12  |            33 |     55.76923 |  1 |
+-----------+-----------+---------------+--------------+----+
1 row in set (0.00 sec)

API Documentation

https://ipavl.github.io/similarity-api/

Clone this wiki locally