Index: examples/python_tests/alice_rt1/README
===================================================================
--- examples/python_tests/alice_rt1/README	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/README	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -1,53 +1,61 @@
-#!/bin/sh
-
-## trying out different data param types
-
-# alice_rt1_typed
-
-creddy --generate --cn Alice
-creddy --generate --cn Hatter
-creddy --generate --cn MarchHare
-creddy --generate --cn Dormouse
-creddy --generate --cn Tea
-creddy --generate --cn Party 
-
-alice_keyid=`creddy --keyid --cert Alice_ID.pem`
-party_keyid=`creddy --keyid --cert Party_ID.pem`
-tea_keyid=`creddy --keyid --cert Tea_ID.pem`
-hatter_keyid=`creddy --keyid --cert Hatter_ID.pem`
-marchhare_keyid=`creddy --keyid --cert MarchHare_ID.pem`
-dormouse_keyid=`creddy --keyid --cert Dormouse_ID.pem`
-
-friendof_alice="friendOf-alice([keyid:$alice_keyid])"
-friendof_marchhare="friendOf([keyid:$marchhare_keyid])"
-guestof_marchhare="guestOf([keyid:$marchhare_keyid])"
-
-about_party="about([keyid:$tea_keyid],[time:20101010T],[boolean:true],[integer:4],[float:-200.0],[float:8],[time:20120205T182930],[string:'guest list'],[urn:'file://usr/local/party/~teaparty'])"
-
-about_other_party="about_other_party([keyid:$tea_keyid],[?],[integer:99],[time:?AAA],[integer:?BBB],[boolean:true],[integer:?])"
-
-about_time="about_time([time:20201101T])"
-about_another_time="about_another_time([time:20201101T182930])"
-about_key="about_key([keyid:$tea_keyid])"
-about_boolean="about_boolean([boolean:true])"
-about_integer="about_integer([integer:4])"
-about_another_integer="about_another_integer([integer:-7])"
-about_float="about_float([float:-200.0])"
-about_another_float="about_another_float([float:8])"
-about_third_float="about_another_float([float:0.22])"
-about_urn="about_urn([urn:'file://user/local/party/~sillyparty'])"
-about_string="about_string([string:'a confused party'])"
-about_string2="about_string([string:'a mangled \'string\''])"
+#
+# trying out different data param types
+#
+# alice_rt1
+#
+# 
+# [keyid:Party].role: about([keyid:tea],[time:20101010T],[boolean:true],[integer:4],
+#                  [float:-200.0],[float:8],[time:20120205T182930],[string:'a list'],
+#                  [urn:'file://usr/party/~teaparty'])
+#                  <- [keyid:Party].role:guestOf([keyid:MarchHare])
+#
+# [keyid:Party].role:about_other_party([keyid:tea],[?],[integer:99],[time:?AAA],
+#                  [integer:?BBB],[boolean:true],[integer:?]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_string([string:'a confused party']) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_string2([string:'a mangled \\'string\\''])
+#                 <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_urn([urn:'file://user/local/party/~sillyparty'])
+#                 <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_another_float([float:0.22]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_another_float([float:8]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_float([float:-200.0]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_another_integer([integer:-7]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_integer([integer:4]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_boolean([boolean:true]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_key([keyid:tea]) <- [keyid:MarchHare] 
+#
+# [keyid:Party].role:about_another_time([time:20201101T182930]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:about_time([time:20201101T]) <- [keyid:MarchHare]
+#
+# [keyid:Party].role:guestof([principal:?V]) 
+#                           <- [keyid:Party].role:friendOf([principal:?V])
+#
+# [keyid:Party].role:guests <- [keyid:Party].role:friendOf([keyid:MarchHare])
+#
+# [keyid:Party].role:friendOf([keyid:MarchHare]) <- [keyid:Dormouse]
+#
+# [keyid:Party].role:friendOf([keyid:Alice]) <- [keyid:Hatter]
 
 
-#[keyid:Party].role:about([keyid:tea],[time:201010],[string:'guest list'],[boolean:true],[integer:4]) <- [keyid:Party].role:guestOf([keyid:MarchHare])
-#echo "creddy --attribute --issuer Party_ID.pem --key Party_private.pem --role \"$about_party\" --subject-cert Party_ID.pem --subject-role  \"$guestof_marchhare\" --out party_about_party__guestof_marchhare_attr.der"
-creddy --attribute \
-       --issuer Party_ID.pem --key Party_private.pem --role "$about_party" \
-       --subject-cert Party_ID.pem --subject-role  "$guestof_marchhare" \
-       --out party_about_party__guestof_marchhare_attr.der
-#echo "  "
-#echo "double checking with creddy --roles -certs party_about_party__guestof_marchhare_attr.der"
-#creddy --roles --cert party_about_party__guestof_marchhare_attr.der
+
+
+
+
+
+
+
+
+
 
 #[keyid:Party].role:about_other_party([keyid:$tea_keyid],[time:?],[boolean:true]) <- [keyid:MarchHare]
Index: examples/python_tests/alice_rt1/alice.save
===================================================================
--- examples/python_tests/alice_rt1/alice.save	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/alice.save	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -1,11 +1,3 @@
 % Restoring file /usr/local/lib/Yap/startup.yss
-
-===good============ Party.guests <- dourmouse
-YAP query succeed
-pParty.guests <- pParty.friendOf(pMarchhare)
-pParty.friendOf(pMarchhare) <- pDormouse
-
-===bad============ Party.guests <- hatter
-YAP query failed
 
 ...final principal set...
@@ -16,6 +8,4 @@
 (pParty,keyid,y) 
 (pTea,keyid,y) 
-
-
 
 ...final policy attribute set...
@@ -28,5 +18,5 @@
 pParty.about_key(pTea) <- pMarchhare
 pParty.about_other_party(pTea,_,99,AAA,BBB,true,_) <- pMarchhare
-pParty.about(pTea,time(2010,10,10,00,00,00),true,4,-200.0,8,time(2012,02,05,18,29,30),'guest','file://usr/party/~teaparty') <- pParty.guestOf(pMarchhare)
+pParty.about(pTea,time(2010,10,10,00,00,00),true,4,-200.0,8,time(2012,02,05,18,29,30),'a list','file://usr/party/~teaparty') <- pParty.guestOf(pMarchhare)
 pParty.about_string2('a mangled \'string\'') <- pMarchhare
 pParty.about_string('a confused party') <- pMarchhare
@@ -39,3 +29,9 @@
 pParty.guests <- pParty.friendOf(pMarchhare)
 
+===good============ Party.guests <- dourmouse
+YAP query succeed
+pParty.guests <- pParty.friendOf(pMarchhare)
+pParty.friendOf(pMarchhare) <- pDormouse
 
+===bad============ Party.guests <- hatter
+YAP query failed
Index: examples/python_tests/alice_rt1/attr.py
===================================================================
--- examples/python_tests/alice_rt1/attr.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/attr.py	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -2,8 +2,8 @@
 
 """
-  Setup access policy attribute rules
+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 
-
 """
 
@@ -11,11 +11,14 @@
 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)
+
+# retrieve principals' keyid value from local credential files
 out = ctxt.context_principals()
 print "...initial principal set..."
@@ -59,7 +62,9 @@
 # and could not push/pull out of ietf_attribute_t properly
 ###############################################
+# NOTE: space and '~' in string value
+#       time value's optional ending
 # [keyid:Party].role: about([keyid:tea],[time:20101010T],[boolean:true],
 #                           [integer:4],[float:-200.0],[float:8],[time:20120205T182930],
-#                           [string:'guest'],[urn:'file://usr/party/~teaparty'])
+#                           [string:'a list'],[urn:'file://usr/party/~teaparty'])
 #                <- [keyid:Party].role:guestOf([keyid:MarchHare])
 head=ABAC.Role(party,"about")
@@ -78,5 +83,5 @@
 param=ABAC.DataTerm("time","20120205T182930")
 head.role_add_data_term(param)
-param=ABAC.DataTerm("string","'guest'")
+param=ABAC.DataTerm("string","'a list'")
 head.role_add_data_term(param)
 param=ABAC.DataTerm("urn","'file://usr/party/~teaparty'")
@@ -95,4 +100,6 @@
 
 ###############################################
+# NOTE: anonymous parameter
+#       Variable value for different parameter types
 # [keyid:Party].role:about_other_party([keyid:tea],[?],
 #                         [integer:99],[time:?AAA],[integer:?BBB],
@@ -141,4 +148,5 @@
 
 ###############################################
+# NOTE: how to escape within a string value
 # [keyid:Party].role:about_string2([string:'a mangled \\'string\\''])
 #                 <- [keyid:MarchHare]
@@ -317,4 +325,5 @@
 
 ###############################################
+# NOTE: principal parameter type
 # [keyid:Party].role:guestof([principal:?V]) 
 #           <- [keyid:Party].role:friendOf([principal:?V])
@@ -370,4 +379,5 @@
 
 ###############################################
+# NOTE: named principal tail
 # [keyid:Party].role:friendOf([keyid:Alice]) 
 #                               <- [keyid:Hatter]
@@ -386,4 +396,2 @@
 print "\n"
 
-ctxt.dump_yap_db()
-##
Index: examples/python_tests/alice_rt1/query.py
===================================================================
--- examples/python_tests/alice_rt1/query.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/query.py	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -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
 aliceID=ABAC.ID("Alice_ID.pem")
 aliceID.id_load_privkey_file("Alice_private.pem")
@@ -44,7 +48,18 @@
 dormouse=dormouseID.id_keyid()
 
-
+##########################################################################
+# 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())
 
 ##########################################################################
+# can dormouse be a guest at the party ?
 # role=[keyid:Party].role:guests 
 # p=[keyid:dormouse]
@@ -57,4 +72,5 @@
 
 ##########################################################################
+# can hatter be a guest at the party ?
 # role=[keyid:Party].role:guests 
 # p=[keyid:hatter]
@@ -66,16 +82,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/alice_rt1/run_test
===================================================================
--- examples/python_tests/alice_rt1/run_test	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/run_test	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -1,6 +1,3 @@
 #!/bin/sh 
-
-ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
-export ABAC_PROVER_PATH
 
 echo '---setup principals'
Index: examples/python_tests/alice_rt1/setup.py
===================================================================
--- examples/python_tests/alice_rt1/setup.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/alice_rt1/setup.py	(revision 3a867a1e95724a8e45ffb3a18a7b1fbaaa9df0de)
@@ -2,6 +2,5 @@
 
 """
-  Setup principal ID credentials
-
+See README for the semantics.  This creates many principals.
 """
 import os
