Index: examples/python_tests/acme_rockets_intersection_rt0/README
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/README	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/README	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,4 +1,4 @@
 #
-# This example demonstrates intersections.  An intersection is a logical and of
+# This example demonstrates intersections.  An intersection is a logical-AND of
 # roles or osets.  An intersection succeeds if the principal is in the
 # intersection of the sets defined by the roles.
@@ -25,6 +25,15 @@
 #    Acme.buy_rockets <-?- Batman
 # 
-# Acme.buy_rockets <- Acme.preferred_customer & WarnerBros.character
-# Acme.preferred_customer <- Coyote
-# Acme.preferred_customer <- Batman
-# WarnerBros.character <- Coyote
+# acme_rockets_intersection_rt0
+
+# Credential 1
+#[keyid:Acme].role:buy_rockets <- [keyid:Acme].role:preferred_customer 
+                                    & [keyid:WarnerBros].role:charater
+# Credential 2
+# [keyid:Acme].role:preferred_customer <- [keyid:Coyote]
+
+# Credential 3
+#[keyid:Acme].role:preferred_customer <- [keyid:Batman]
+
+# Credential 4
+#[keyid:WarnerBros].role:character <- [keyid:Coyote]
Index: examples/python_tests/acme_rockets_intersection_rt0/attr.py
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/attr.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/attr.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,17 +2,22 @@
 
 """
-  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 
-
 """
 import os
 import ABAC
 
-keystore=os.environ["keystore"]
-
 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)
+
+# retrieve principals' keyid value from local credential files
 acmeID=ABAC.ID("Acme_ID.pem");
 acmeID.id_load_privkey_file("Acme_private.pem");
@@ -37,4 +42,6 @@
 
 ################################################
+# Credential 1, establish the intersection rule on who can buy
+# rockets from Acme
 #[keyid:Acme].role:buy_rockets <- [keyid:Acme].role:preferred_customer 
 #                                    & [keyid:WarnerBros].role:charater
@@ -43,8 +50,17 @@
 tail2 = ABAC.Role(warnerbros,"character")
 attr=ABAC.Attribute(head, 1800)
+
+# to add intersection, just add multiple tails, make sure they are all
+# roles or all osets
 attr.attribute_add_tail(tail1)
 attr.attribute_add_tail(tail2)
+
+# finalize the rule
 attr.attribute_bake()
+
+# save it out as external credential file
 attr.attribute_write_cert("Acme_buy_rockets__Acme_preferred_customer_and_WarnerBros_character_attr.der")
+
+# load it into context from the just created credential file
 ctxt.load_attribute_file("Acme_buy_rockets__Acme_preferred_customer_and_WarnerBros_character_attr.der")
 print attr.string() 
@@ -53,4 +69,5 @@
 
 #################################################
+# Credential 2
 #[keyid:Acme].role:preferred_customer <- [keyid:Coyote]
 head = ABAC.Role(acme,"preferred_customer")
@@ -66,4 +83,5 @@
 
 #################################################
+# Credential 3
 #[keyid:Acme].role:preferred_customer <- [keyid:Batman]
 head = ABAC.Role(acme,"preferred_customer")
@@ -80,4 +98,5 @@
 
 ################################################
+# Credential 4
 #[keyid:WarnerBros].role:character <- [keyid:Coyote]
 head=ABAC.Role(warnerbros,"character")
@@ -87,10 +106,9 @@
 attr.attribute_bake()
 attr.attribute_write_cert("WarnerBros_character__Coyote_attr.der")
-#ctxt.load_attribute_file("WarnerBros_character__Coyote_attr.der")
+
+# demonstrate how attribute can be load from structure insted of a file
 ctxt.load_attribute(attr)
-#print attr.string() 
-#print attr.typed_string()
-#print "\n"
+print attr.string() 
+print attr.typed_string()
+print "\n"
 
-ctxt.dump_yap_db()
-##
Index: examples/python_tests/acme_rockets_intersection_rt0/intersect.save
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/intersect.save	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/intersect.save	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -1,3 +1,15 @@
 % Restoring file /usr/local/lib/Yap/startup.yss
+
+...final principal set...
+(pAcme,keyid,y) 
+(pBatman,keyid,y) 
+(pCoyote,keyid,y) 
+(pWarnerBros,keyid,y) 
+
+...final policy attribute set...
+pAcme.buy_rockets <- pAcme.preferred_customer & pWarnerBros.character
+pAcme.preferred_customer <- pBatman
+pAcme.preferred_customer <- pCoyote
+pWarnerBros.character <- pCoyote
 
 ===good============ Acme.buy_rockets <- Coyote
@@ -9,18 +21,2 @@
 ===bad============ Acme.buy_rockets <- Batman
 YAP query failed
-
-...final principal set...
-(pAcme,keyid,y) 
-(pBatman,keyid,y) 
-(pCoyote,keyid,y) 
-(pWarnerBros,keyid,y) 
-
-
-
-...final policy attribute set...
-pAcme.buy_rockets <- pAcme.preferred_customer & pWarnerBros.character
-pAcme.preferred_customer <- pBatman
-pAcme.preferred_customer <- pCoyote
-pWarnerBros.character <- pCoyote
-
-
Index: examples/python_tests/acme_rockets_intersection_rt0/query.py
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/query.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/query.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,9 +2,8 @@
 
 """
-  to test with python
+Run the queries described in README
 
 cmd1:env keystore=`pwd` ./query.py 
 cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
-
 """
 
@@ -14,10 +13,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 +40,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())
+
+##########################################################################
+# can coyote buy rockets from Acme ?
 # role = "[keyid:Acme].role:buy_rockets"
 # p = "[keyid:coyote]" 
@@ -50,4 +66,5 @@
 
 ##########################################################################
+# can batman buy rockets from Acme ?
 # role = "[keyid:Acme].role:buy_rockets"
 # p = "[keyid:batman]" 
@@ -61,19 +78,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/acme_rockets_intersection_rt0/run_test
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/run_test	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/run_test	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -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/acme_rockets_intersection_rt0/setup.py
===================================================================
--- examples/python_tests/acme_rockets_intersection_rt0/setup.py	(revision 669b4810acfbeee6bdec4a2443a99b2994efedc8)
+++ examples/python_tests/acme_rockets_intersection_rt0/setup.py	(revision f824a9ec465246e1555b44ec89522ae2ad35c47e)
@@ -2,7 +2,6 @@
 
 """
-  Setup 4 principal ID credentials
-
-  Acme, Coyote, WarnerBros and Batman
+See README for the semantics.  This creates four principals used
+by the example.
 
 """
