krmx_demo.properties

# This rule-based mailing system is written in Java. 
# Thus, you need a JDBC driver to connect to the database. 
# The name of the driver along with the URL of the database, 
# AND a pair of ID/password to connect to it are required.

DB_DRIVER = org.postgresql.Driver
DB_URL = jdbc:postgresql://xxxxxxxxx
DB_ID = xxxxx
DB_PASSWORD = xxxxx

DEBUG_USER = moe@db.ics.keio.ac.jp

#############################################
#                define query               #
#############################################
name
name[0] = select email from student
name[1] = select email from student where name = '$1'

dept
dept[1] = select s.email from student s join department d on s.dept = d.id where d.name ='$1'

grade
grade[1] = select email from student where grade=$1
grade[2] = select email from student where grade >= $1 and grade <= $2

club
club[1] = select s.email from student s join club c on s.club = c.id where c.name = '$1'

sex
sex[1] = select email from student where sex = '$1'


############################################
#          define limitation rule          #
############################################
LIMITATION = OFF
LIMIT_DEFAULT = deny

LIMIT[student] = SELECT email FROM student

gakuji = allow1
gakujiSelector[*] = FROM gakuji WHERE email=$sender
gakujiApply[*] = student


############################################
#           define insertion rule          #
############################################
$name = select name from student where email = $recipient

$grade = select grade from student where email = $recipient

$sex = select sex from student where email = $recipient

$scoreForm =table(科目名称, 担当者, 評価, 履修学科) 
$score = select c.name, c.teacher, e.evaluation, c.term 
         from evaluation e , student s , class c 
         where s.id= e.s_id and c.id = e.c_id and s.email = $recipient

$checkupForm = table(日付, 開始時間, 終了時間)
$checkup = select c.date, c.start_time, c.finish_time 
           from department dept, de_ch de, checkup c, student s
           where dept.id = de.d_id and c.id=de.c_id and s.dept = dept.id and s.email = $recipient