Index: examples/python_tests/experiment_create_rt0/README
===================================================================
--- examples/python_tests/experiment_create_rt0/README	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/README	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,4 +1,2 @@
-#!/bin/sh
-#
 #
 #Acme runs a testbed. They've delegated the authority to create
@@ -18,47 +16,28 @@
 #    Alice.power_user <- Bob
 #
-#From these credentials, it is possible to construct a proof graph
-#showing that Acme.experiment_create <- Bob.
+#From these credentials, it is possible to show that 
+#    Acme.experiment_create <- Bob.
 #
-#Note that there is a one-to-one correspondence with each credential
-#above and the attribute certificates below.
+#In query.py, it checks if Alice is a admin of Globotron which is true;
+#and if Bob is an admin of Globotron which is not true; and also show
+# that Bob can create experiment at Acme
 #
+# experiment_create_rt0 
 
-# experiment_create_rt0_typed 
+# Credential 1
+#[keyid:Acme].role:experiment_create 
+#                 <- [keyid:Acme].role:partner.role:experiment_create
 
-creddy --generate --cn Acme
-creddy --generate --cn Globotron
-creddy --generate --cn Alice
-creddy --generate --cn Bob
+# Credential 2
+#[keyid:Acme].role:partner <- [keyid:Globotron]
 
-#[keyid:Acme].role:experiment_create <- [keyid:Acme].role:partner.role:experiment_create
-creddy --attribute \
-       --issuer Acme_ID.pem --key Acme_private.pem --role experiment_create \
-       --subject-cert Acme_ID.pem --subject-role partner.experiment_create \
-       --out Acme_experiment_create__Acme_partner_experiment_create_attr.der
+# Credential 3
+#[keyid:Globotron].role:expriment_create 
+                 <- [keyid:Globotron].role:admin.role:power_user
 
-#[keyid:Acme].role:partner <- [keyid:Globotron]
-creddy --attribute \
-       --issuer Acme_ID.pem --key Acme_private.pem --role partner \
-       --subject-cert Globotron_ID.pem \
-       --out Acme_partner__Globotron_attr.der 
+# Credential 4
+#[keyid:Globotron].role:admin <- [keyid:Alice]
 
-#[keyid:Globotron].role:expriment_create <- [keyid:Globotron].role:admin.role:power_user
-creddy --attribute \
-       --issuer Globotron_ID.pem --key Globotron_private.pem --role experiment_create \
-       --subject-cert Globotron_ID.pem --subject-role admin.power_user \
-       --out Globotron_experiment_create__Globotron_admin_power_user_attr.der
+# Credential 5
+#[keyid:Alice].role:power_user <- [keyid:Bob]
 
-#[keyid:Globotron].role:admin <- [keyid:Alice]
-creddy --attribute \
-       --issuer Globotron_ID.pem --key Globotron_private.pem --role admin \
-       --subject-cert Alice_ID.pem \
-       --out Globotron_admin__Alice_attr.der
-
-#[keyid:Alice].role:power_user <- [keyid:Bob]
-creddy --attribute \
-       --issuer Alice_ID.pem --key Alice_private.pem --role power_user \
-       --subject-cert Bob_ID.pem \
-       --out Alice_power_user__Bob_attr.der
-
-
Index: examples/python_tests/experiment_create_rt0/attr.py
===================================================================
--- examples/python_tests/experiment_create_rt0/attr.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/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
 acmeID=ABAC.ID("Acme_ID.pem");
 acmeID.id_load_privkey_file("Acme_private.pem");
@@ -46,12 +50,24 @@
 
 ################################################
+# Credential 1, Anyone who is allowed to create experiment by Acme's
+#               partners can create experiment at Acme
 # [keyid:Acme].role:experiment_create 
 #           <- [keyid:Acme].role:partner.role:experiment_create
 head=ABAC.Role(acme,"experiment_create")
+
+# creating a linking role
 tail = ABAC.Role(acme,"partner","experiment_create")
+
+# compose the policy attribute
 attr=ABAC.Attribute(head, 1800)
 attr.attribute_add_tail(tail)
+
+# finalize the policy
 attr.attribute_bake()
+
+# write out the policy to an external file
 attr.attribute_write_cert("Acme_experiment_create__Acme_partner_experiment_create_attr.der")
+
+# load the policy into the context by accessing that external file
 ctxt.load_attribute_file("Acme_experiment_create__Acme_partner_experiment_create_attr.der")
 print attr.string() 
@@ -60,4 +76,5 @@
 
 #################################################
+# Credential 2
 # [keyid:Acme].role:partner <- [keyid:Globotron]
 #
@@ -74,7 +91,10 @@
 
 #################################################
+# Credential 3
 # [keyid:Globotron].role:expriment_create 
 #           <- [keyid:Globotron].role:admin.role:power_user
 head = ABAC.Role(acme,"experiment_create")
+
+# a linking role
 tail = ABAC.Role(globotron,"admin","power_user")
 attr=ABAC.Attribute(head, 1800)
@@ -88,6 +108,9 @@
 
 #################################################
+# Credential 4, named term at the right
 # [keyid:Globotron].role:admin <- [keyid:Alice]
 head = ABAC.Role(globotron,"admin")
+
+# the named role is using keyid of alice
 tail = ABAC.Role(alice)
 attr=ABAC.Attribute(head, 1800)
@@ -113,4 +136,2 @@
 print "\n"
 
-ctxt.dump_yap_db()
-##
Index: examples/python_tests/experiment_create_rt0/experiment.save
===================================================================
--- examples/python_tests/experiment_create_rt0/experiment.save	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/experiment.save	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,3 +1,16 @@
 % Restoring file /usr/local/lib/Yap/startup.yss
+
+...final principal set...
+(pAcme,keyid,y) 
+(pAlice,keyid,y) 
+(pBob,keyid,y) 
+(pGlobotron,keyid,y) 
+
+...final policy attribute set...
+pAcme.experiment_create <- pAcme.partner.experiment_create
+pAcme.partner <- pGlobotron
+pAlice.power_user <- pBob
+pGlobotron.admin <- pAlice
+pAcme.experiment_create <- pGlobotron.admin.power_user
 
 ===good=============== Globotron.admin <- Alice
@@ -13,19 +26,2 @@
 pGlobotron.admin <- pAlice
 pAlice.power_user <- pBob
-
-...final principal set...
-(pAcme,keyid,y) 
-(pAlice,keyid,y) 
-(pBob,keyid,y) 
-(pGlobotron,keyid,y) 
-
-
-
-...final policy attribute set...
-pAcme.experiment_create <- pAcme.partner.experiment_create
-pAcme.partner <- pGlobotron
-pAlice.power_user <- pBob
-pGlobotron.admin <- pAlice
-pAcme.experiment_create <- pGlobotron.admin.power_user
-
-
Index: examples/python_tests/experiment_create_rt0/query.py
===================================================================
--- examples/python_tests/experiment_create_rt0/query.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/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
 acmeID=ABAC.ID("Acme_ID.pem");
 acmeID.id_load_privkey_file("Acme_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 alice a admin at Globotron ?
 # role=[keyid:Globotron].role:admin 
 # p=[keyid:Alice]
@@ -47,4 +64,5 @@
 
 ##########################################################################
+# is bob a admin at Globotron ?
 # role=[keyid:Globotron].role:admin 
 # p=[keyid:Bob]
@@ -58,4 +76,5 @@
 
 ##########################################################################
+# can bob create experiment at Acme ?
 # role=[keyid:Acme].role:experiment_create 
 # p=[keyid:Bob]
@@ -66,19 +85,2 @@
 for c in out[1]:
     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/experiment_create_rt0/run_test
===================================================================
--- examples/python_tests/experiment_create_rt0/run_test	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/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/experiment_create_rt0/setup.py
===================================================================
--- examples/python_tests/experiment_create_rt0/setup.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/experiment_create_rt0/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
