Index: examples/python_tests/payraise_rt1/README
===================================================================
--- examples/python_tests/payraise_rt1/README	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/README	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,3 +1,2 @@
-#!/bin/sh
 
 #####################################################################
@@ -18,108 +17,30 @@
 # performance. But, there is no fact that says Joe is a nice coworker.
 #
-# The attached ./run_query file asks if a given principal is
-# entitled to a pay raise. Maryann is but not Joe, because his manager
-# did not affirm his pleasantness(but neither did he deny it)
+# The query.py file asks if a given principal is entitled to a pay
+# raise. Maryann is but not Joe, because his manager did not affirm 
+# his pleasantness(but neither did he deny it)
 
-rm -rf *der *pem
-
-# [keyid:Alpha].role:payRaise <-?- [keyid:Maryann] (yes)
-# [keyid:Alpha].role:payRaise <-?- [keyid:Joe] (no)
-
-creddy --generate --cn Alpha
-creddy --generate --cn Bob
-creddy --generate --cn Maryann
-creddy --generate --cn Joe
-
-alpha_keyid=`creddy --keyid --cert Alpha_ID.pem`
-
-bob_keyid=`creddy --keyid --cert Bob_ID.pem`
-maryann_keyid=`creddy --keyid --cert Maryann_ID.pem`
-joe_keyid=`creddy --keyid --cert Joe_ID.pem`
-
-performance_qT="evaluatorOf([principal:?this]).goodPerformance"
-niceguy_qT="managerOf([principal:?this]).niceCoworker"
-
-manager_qZ="managerOf([principal:?Z])"
-evaluator_qZ="evaluatorOf([principal:?Z])"
-
-evaluator_m="evaluatorOf([keyid:$maryann_keyid])"
-evaluator_j="evaluatorOf([keyid:$joe_keyid])"
-
+# Credential 1,
 # [keyid:alpha].role:payRaise <-
 #           [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance &
 #           [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker
-# Credential 1
-creddy --attribute \
-       --issuer Alpha_ID.pem --key Alpha_private.pem --role payRaise \
-       --subject-cert Alpha_ID.pem --subject-role "$performance_qT" \
-       --subject-cert Alpha_ID.pem --subject-role "$niceguy_qT" \
-       --out Alpha_payraise__Alpha_performance_qT_niceguy_qT_attr.der
 
+# Credential 2
 # [keyid:alpha].role:managerOf([principal:?Z])<-
 #           [keyid:alpha].role:evaluatorOf([principal:?Z])
-# Credential 2
-creddy --attribute \
-       --issuer Alpha_ID.pem --key Alpha_private.pem --role "$manager_qZ" \
-       --subject-cert Alpha_ID.pem --subject-role "$evaluator_qZ" \
-       --out Alpha_manager_qZ__Alpha_evaluator_qZ_attr.der
 
+# Credential 3
 # [keyid:alpha].role:evaluatorOf([keyid:Maryann]) <-[keyid:Bob]
-# Credential 3
-creddy --attribute \
-        --issuer Alpha_ID.pem --key Alpha_private.pem --role "$evaluator_m" \
-        --subject-cert Bob_ID.pem \
-        --out Alpha_evaluator_m__Bob_attr.der
 
+# Credential 4 
 # [keyid:Bob].role:goodPerformance <- [keyid:Maryann])
-# Credential 4 
-creddy --attribute \
-        --issuer Bob_ID.pem --key Bob_private.pem --role goodPerformance \
-        --subject-cert Maryann_ID.pem \
-        --out Bob_goodperformance__Maryann_attr.der
 
+# Credential 5 
 # [keyid:Bob].role:niceCoworker <- [keyid:Maryann])
-# Credential 5 
-creddy --attribute \
-        --issuer Bob_ID.pem --key Bob_private.pem --role niceCoworker \
-        --subject-cert Maryann_ID.pem \
-        --out Bob_niceworker__Maryann_attr.der
 
+# Credential 6
 # [keyid:alpha].role:evaluatorOf([keyid:Joe]) <-[keyid:Bob]
-# Credential 6
-creddy --attribute \
-        --issuer Alpha_ID.pem --key Alpha_private.pem --role "$evaluator_j" \
-        --subject-cert Bob_ID.pem \
-        --out Alpha_evaluator_j__Bob_attr.der
 
+# Credential 7 
 # [keyid:Bob].role:goodPerformance <- [keyid:Joe])
-# Credential 7 
-creddy --attribute \
-        --issuer Bob_ID.pem --key Bob_private.pem --role goodPerformance \
-        --subject-cert Joe_ID.pem \
-        --out Bob_goodperformance__Joe_attr.der
 
-
-#####################################################################
-# 
-# alpha.payRaise <- alpha.evaluatorOf(this).goodPerformance & 
-#                   alpha.managerOf(this).niceCoworker
-# [keyid:alpha].role:payRaise <-
-#           [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance &
-#           [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker
-#
-# alpha.managerOf(this) <- alpha.evaluatorOf(this)
-# [keyid:alpha].role:managerOf([principal:?this])<-
-#           [keyid:alpha].role:evaluatorOf([principal:?this])
-#
-# alpha.evaluatorOf(Maryann)<-Bob
-# [keyid:alpha].role:evaluatorOf([keyid:Maryann]) <-[keyid:Bob]
-# Bob.goodPerformance<-Maryann
-# [keyid:Bob].role:goodPerformance <- [keyid:Maryann])
-# Bob.niceCoworker<-Maryann
-# [keyid:Bob].role:niceCoworker <- [keyid:Maryann])
-#
-# alpha.evaluatorOf(Joe)<-Bob
-# [keyid:alpha].role:evaluatorOf([keyid:Joe]) <-[keyid:Bob]
-# Bob.goodPerformance<-Joe
-# [keyid:Bob].role:goodPerformance <- [keyid:Joe])
Index: examples/python_tests/payraise_rt1/attr.py
===================================================================
--- examples/python_tests/payraise_rt1/attr.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/attr.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,5 +2,6 @@
 
 """
-  to test with python
+See README in this directory for the semantics of the example.  This file
+constructs the credentials described and puts copies into this directory
 
 cmd1:env keystore=`pwd` ./attr.py 
@@ -10,10 +11,12 @@
 import ABAC
 
-keystore=os.environ["keystore"]
-
 ctxt = ABAC.Context()
 print "ABAC version %s" % ctxt.version()
 
-ctxt.load_directory(keystore)
+# Keystore is the directory containing the principal credentials.
+# Load existing principals and/or policy credentials
+if (os.environ.has_key("keystore")) :
+    keystore=os.environ["keystore"]
+    ctxt.load_directory(keystore)
 
 out = ctxt.context_principals()
@@ -29,4 +32,5 @@
 print "\n"
 
+# retrieve principals' keyid value from local credential files
 alphaID=ABAC.ID("Alpha_ID.pem");
 alphaID.id_load_privkey_file("Alpha_private.pem");
@@ -46,18 +50,34 @@
 
 ################################################
+# Credential 1, intersecting linking roles with This principal param for the
+#               linked role
 # [keyid:alpha].role:payRaise <-
 #      [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance &
 #      [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker
 head=ABAC.Role(alpha,"payRaise")
+
+# build a data term with ?This
 param=ABAC.DataTerm("principal", "This")
 tail1 = ABAC.Role(alpha,"evaluatorOf","goodPerformance")
+
+# add the param to the linked role
 tail1.role_add_linked_data_term(param)
+
+# build another data term with ?This
 param=ABAC.DataTerm("principal", "This")
 tail2 = ABAC.Role(alpha,"managerOf","niceCoworker")
+
+# add the param to the linked role
 tail2.role_add_linked_data_term(param)
+
+# compose the intersecting role attribute policy
 attr=ABAC.Attribute(head, 1800)
 attr.attribute_add_tail(tail1)
 attr.attribute_add_tail(tail2)
+
+# finalize the attribute policy
 attr.attribute_bake()
+
+# write out the attribute credential file
 attr.attribute_write_cert("Alpha_payraise__Alpha_performance_qT_niceguy_qT_attr.der")
 ctxt.load_attribute_file("Alpha_payraise__Alpha_performance_qT_niceguy_qT_attr.der")
@@ -67,4 +87,5 @@
 
 #################################################
+# Credential 2, 
 # [keyid:alpha].role:managerOf([principal:?Z])<-
 #           [keyid:alpha].role:evaluatorOf([principal:?Z])
@@ -85,4 +106,5 @@
 
 #################################################
+# Credential 3
 # [keyid:alpha].role:evaluatorOf([keyid:Maryann]) <-[keyid:Bob]
 param=ABAC.DataTerm(maryannID)
@@ -100,4 +122,5 @@
 
 #################################################
+# Credential 4
 # [keyid:Bob].role:goodPerformance <- [keyid:Maryann])
 head = ABAC.Role(bob,"goodPerformance")
@@ -113,4 +136,5 @@
 
 #################################################
+# Credential 5
 # [keyid:Bob].role:niceCoworker <- [keyid:Maryann])
 head = ABAC.Role(bob,"niceCoworker")
@@ -126,4 +150,5 @@
 
 #################################################
+# Credential 6
 # [keyid:alpha].role:evaluatorOf([keyid:Joe]) <-[keyid:Bob]
 param=ABAC.DataTerm(joeID)
@@ -141,4 +166,5 @@
 
 #################################################
+# Credential 7
 # [keyid:Bob].role:goodPerformance <- [keyid:Joe])
 head = ABAC.Role(bob,"goodPerformance")
@@ -153,5 +179,2 @@
 print "\n"
 
-
-ctxt.dump_yap_db()
-##
Index: examples/python_tests/payraise_rt1/pay.save
===================================================================
--- examples/python_tests/payraise_rt1/pay.save	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/pay.save	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,3 +1,18 @@
 % Restoring file /usr/local/lib/Yap/startup.yss
+
+...final principal set...
+(pAlpha,keyid,y) 
+(pBob,keyid,y) 
+(pJoe,keyid,y) 
+(pMaryann,keyid,y) 
+
+...final policy attribute set...
+pAlpha.evaluatorOf(pJoe) <- pBob
+pAlpha.evaluatorOf(pMaryann) <- pBob
+pAlpha.managerOf(Z) <- pAlpha.evaluatorOf(Z)
+pAlpha.payRaise <- pAlpha.evaluatorOf(This).goodPerformance & pAlpha.managerOf(This).niceCoworker
+pBob.goodPerformance <- pJoe
+pBob.goodPerformance <- pMaryann
+pBob.niceCoworker <- pMaryann
 
 ===bad============ alpha.payRaise <- Joe
@@ -11,21 +26,2 @@
 pAlpha.managerOf(Z) <- pAlpha.evaluatorOf(Z)
 pBob.niceCoworker <- pMaryann
-
-...final principal set...
-(pAlpha,keyid,y) 
-(pBob,keyid,y) 
-(pJoe,keyid,y) 
-(pMaryann,keyid,y) 
-
-
-
-...final policy attribute set...
-pAlpha.evaluatorOf(pJoe) <- pBob
-pAlpha.evaluatorOf(pMaryann) <- pBob
-pAlpha.managerOf(Z) <- pAlpha.evaluatorOf(Z)
-pAlpha.payRaise <- pAlpha.evaluatorOf(This).goodPerformance & pAlpha.managerOf(This).niceCoworker
-pBob.goodPerformance <- pJoe
-pBob.goodPerformance <- pMaryann
-pBob.niceCoworker <- pMaryann
-
-
Index: examples/python_tests/payraise_rt1/query.py
===================================================================
--- examples/python_tests/payraise_rt1/query.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/query.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,5 +2,5 @@
 
 """
-  to test with python
+Run the queries described in README
 
 cmd1:env keystore=`pwd` ./query.py 
@@ -14,10 +14,14 @@
 ctxt = ABAC.Context()
 
-# print "ABAC version %s" % ctxt.version()
+# Keystore is the directory containing the principal credentials.
+# Load existing principals and/or policy credentials
+if (os.environ.has_key("keystore")) :
+    keystore=os.environ["keystore"]
+    ctxt.load_directory(keystore)
+else:
+    print("keystore is not set...")
+    exit(1)
 
-keystore=os.environ["keystore"]
-
-ctxt.load_directory(keystore)
-
+# retrieve principals' keyid value from local credential files
 alphaID=ABAC.ID("Alpha_ID.pem");
 alphaID.id_load_privkey_file("Alpha_private.pem");
@@ -37,4 +41,17 @@
 
 ##########################################################################
+# dump the loaded principals/policies
+#
+out = ctxt.context_principals()
+print "\n...final principal set..."
+for x in out[1]:
+    print "%s " % x.string()
+out = ctxt.context_credentials()
+print "\n...final policy attribute set..."
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# Is Joe getting a pay raise ?
 # role=[keyid:alpha].role:payRaise 
 # p=[keyid:Joe]
@@ -49,4 +66,5 @@
 
 ##########################################################################
+# Is Maryann getting a pay raise ?
 # role=[keyid:alpha].role:payRaise 
 # p=[keyid:Maryann]
@@ -58,18 +76,2 @@
     print "%s <- %s" % (c.head_string(), c.tail_string())
 
-
-##########################################################################
-# dump the loaded principals/policies
-#
-out = ctxt.context_principals()
-print "\n...final principal set..."
-for x in out[1]:
-    print "%s " % x.string()
-print "\n"
-out = ctxt.context_credentials()
-print "\n...final policy attribute set..."
-for c in out[1]:
-    print "%s <- %s" % (c.head_string(), c.tail_string())
-print "\n"
-
-
Index: examples/python_tests/payraise_rt1/run_test
===================================================================
--- examples/python_tests/payraise_rt1/run_test	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/run_test	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,7 +1,3 @@
 #!/bin/sh 
-
-ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
-export ABAC_PROVER_PATH
-
 
 echo '---setup principals'
Index: examples/python_tests/payraise_rt1/setup.py
===================================================================
--- examples/python_tests/payraise_rt1/setup.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/payraise_rt1/setup.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,7 +2,6 @@
 
 """
-  to test with python
-
-
+See README for the semantics.  This creates principals
+used by the example.
 """
 import os
