Froglingo |
An Alternative to DBMS, Programming Language, Web Server, and File System |
|
|
/* Case
Study: The demo system for RuleML 2010 Challenge Froglingo
Development Association 8/27/2010 File
Name: ruleml.frog The
MS DOS command to inventory this application in the batch model: frog
-b ruleml.frog For
example in the folder FOLDER having the executable frog.exe: C:\FOLDER\frog
-b college.frog A
database file .EPDB will be generated in the folder. By
the way, user the interactive mode to enter the expressions in
the file will help user to better understand the system. The
users' guide is available at http://www.froglingo.com/FrogUserGuide10.doc Description:
This application includes a school administration system (//college.edu),
and a residential community system, (//ssd.gov,
"Social Security Department"). The school system has two
Froglingo expressions "enroll" and "register". They serve
as interfaces
to residents in the community, which accept the requests for
school student enrollments and course registrations. The
data in the school administration system grows by the interactions with
the residents. At the same time, residents can create their own data
and share their own data with others. */ /* System starts from scrach. Set a password for the
entire system so that the system can start to accept the requests for new
user account creations. When this file is batch-loaded by using option
"-b", the password is automatically generated. Please remember the
root password that will be displayed on the console. This is true also for
all the passwords generated after the command "addusr". */ passwd; /* add the first user. Again please remember the generated
password */ addusr ssd.gov; /* Log into the account */ login ssd.gov "password"; /* add two new users under ssd.gov */ addusr john; addusr dave; /* the user //ssd.gov add data for the user dave */ create dave name = "David Lottery"; /* log into the account john */ login (//ssd.gov john) "password"; /* user john create his own data */ create SSN =
123445; create birth = '6/1/1990'; /* the image file photo.jpg should be in the MS folder */ load photo.jpg; /* log into the root user // to add another user
college.edu */ login // "password"; addusr college.edu; login college.edu "pas"; create admin; create enrolldate; create CS CS100 pub; grtacc (CS CS100 pub) anyone; /* add the function enroll to be accessible to any users
*/ create redun $usr = (create
admin $usr enrolldate = timestamp), "You have enrolled
successfully."; create enroll $usr:[$usr isa signature] = redun $usr; /* grtacc, grant access permission to anyone user */ grtacc enroll anyone; /* add another interface register */ create register_validate false $usr $class = "The
registration was not successful. You must have registered the class
already."; create register_validate true $usr $class = "You
have successfully registered the class", $class,
(create
$class (admin $usr)); create register $class_desc $usr:[not (admin $usr ==
null)] =
register_validate ((pterm
$class_desc) (admin $usr) == null) $usr
(pterm
$class_desc); grtacc register anyone; /* john applies for enrolling into college.edu as a
student */ login (//ssd.gov john) "password"; //college.edu enroll signature; //college.edu register (//college.edu CS CS100 pub)
signature; login (//college.edu) "k"; create CS CS100 (admin (// ssd.gov john)) grade =
"F"; /* queries */ select $x where $x {=+ . and $x {=- admin (//ssd.gov
john); print CS; /* user dave add some expressions in his own interests */ login (//ssd.gov dave) "password"; create myfuns; cd myfuns; create fac 0 = 1; create fac $n = ($n * (fac ($n - 1))); create fun $x 1 $y = ($x + $y); create fun $x 2 $y = ($x * $y); /* make the factorial function available to other people
*/ grtacc fac anyone; /* anyone user try to access the two functions under dave
*/ login anyone "anyone"; //ssd.gov dave myfuns fac 4; //ssd.gov dave myfuns fun 2 2 3; /* All the interactions discussed earlier also can be done
via web browser: without a user login, System assume the user is an
"anyone" user: http://ssd.gov/dave myfuns fac 4 Dave log in to system, enroll as a student, and register a
course: http://ssd.gov/dave/login . "password" http://ssd.gov/dave/%2F%2Fcollege.edu enroll signature http://ssd.gov/dave/%2F%2Fcollege.edu register
(%2F%2Fcollege.edu CS CS100 pub) signature */ |