Advertisement
logicmoo

Untitled

Nov 14th, 2018
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 1.03 KB | None | 0 0
  1. :- use_module(library(objects)).
  2. :- include('library_db.pl').
  3. :- use_module(library(pillow)).
  4.  
  5. knowledgeDb :: {
  6.  
  7.     spec([userAccess(+,-), userGroup(+,-)]) &
  8.     predicates([userAccess, userGroup]) &
  9.        
  10.     addUser(Username,Forms,Groups):-   
  11.         spec(Spec),
  12.        
  13.        
  14.         %:Data1 = userAccess(Username,Forms),
  15.         %:Data2 = userGroup(Username,Groups),
  16.        
  17.         %db  :: dbDelete(Username, Spec, userAccess(Username,[form1,form2]))
  18.        
  19.            
  20.         % We use the username to unqiuely identifiy a database
  21.         db :: dbUpdate(Username, Spec, userAccess(Username,Groups)) &
  22.  
  23.     lookupUser(Username):- 
  24.         spec(Spec),
  25.         db :: dbLookup(Username, Spec, userAccess(Username,FormAccess)),
  26.         :write(FormAccess) &
  27.    
  28.     lookupUserProlog(Username, FormAccess):-   
  29.         spec(Spec),
  30.         db :: dbLookup(Username, Spec, userAccess(Username,FormAccess)) &
  31.                
  32.     deleteUser(Username):-
  33.         spec(Spec),
  34.         db :: dbDelete(Username, Spec, userAccess(Username,X))&
  35.        
  36.     deleteAllUser(Username):-
  37.         spec(Spec),
  38.         db :: dbDeleteAll(Username, Spec, userAccess(Username,X))
  39.        
  40. }.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement