Index: examples/python_tests/access_rt2/run_test
===================================================================
--- examples/python_tests/access_rt2/run_test	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/access_rt2/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -4,6 +4,4 @@
 export ABAC_PROVER_PATH
 
-
-rm -rf *der *pem
 
 echo '---setup principals'
Index: examples/python_tests/acme_rockets_rt0/README
===================================================================
--- examples/python_tests/acme_rockets_rt0/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# The example makes use of 2 principals, Acme and Coyote.
+#
+# This example shows a very simple delegation of roles by Acme.  Acme's
+# buy_rockets role includes all of Acme's preferred customers.  The example
+# creates the principals and 2 credentials.  Credential 1 encodes the policy
+# that all of Acme's preferred customers can buy rockets from Acme and
+# Credential 2 defines the Coyote as an Acme preferred customer.
+
+# The ./run_query script issues queries to show that the Coyote is both a preferred
+# customer and can buy rockets.  Two invalid queries are also made, checking if
+# Acme is the Coyote's friend, which it isn't and whether a query about
+# something other than a principal works (it doesn't).
+
+# acme_rockets_rt0_typed
+
+creddy --generate --cn Acme
+creddy --generate --cn Coyote
+
+#[keyid:Acme].role:buy_rockets <- [keyid:Acme].role:preferred_customer 
+# Credential 1
+creddy --attribute \
+       --issuer Acme_ID.pem --key Acme_private.pem --role buy_rockets \
+       --subject-cert Acme_ID.pem --subject-role preferred_customer \
+       --out Acme_buy_rockets__Acme_preferred_customer_attr.der
+
+#[keyid:Acme].role:preferred_customer <- [keyid:Coyote]
+# Credential 2
+creddy --attribute \
+       --issuer Acme_ID.pem --key Acme_private.pem --role preferred_customer \
+       --subject-cert Coyote_ID.pem \
+       --out Acme_preferred_customer__Coyote_attr.der
+
Index: examples/python_tests/acme_rockets_rt0/attr.py
===================================================================
--- examples/python_tests/acme_rockets_rt0/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+"""
+  Setup access policy attribute rules
+
+cmd1:env keystore=`pwd` ./attr.py 
+
+"""
+import os
+import ABAC
+
+keystore=os.environ["keystore"]
+
+ctxt = ABAC.Context()
+print "ABAC version %s" % ctxt.version()
+
+acmeID=ABAC.ID("Acme_ID.pem");
+acmeID.id_load_privkey_file("Acme_private.pem");
+ctxt.load_id(acmeID)
+acme=acmeID.id_keyid()
+
+coyoteID=ABAC.ID("Coyote_ID.pem");
+coyoteID.id_load_privkey_file("Coyote_private.pem");
+ctxt.load_id(coyoteID)
+coyote=coyoteID.id_keyid()
+
+################################################
+#[keyid:Acme].role:buy_rockets <- [keyid:Acme].role:preferred_customer
+head = ABAC.Role(acme,"buy_rockets")
+tail = ABAC.Role(acme,"preferred_customer")
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Acme_buy_rockets__Acme_preferred_customer_attr.der")
+ctxt.load_attribute_file("Acme_buy_rockets__Acme_preferred_customer_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+#[keyid:Acme].role:preferred_customer <- [keyid:Coyote]
+head = ABAC.Role(acme,"preferred_customer")
+tail = ABAC.Role(coyote)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Acme_preferred_customer__Coyote_attr.der")
+ctxt.load_attribute_file("Acme_preferred_customer__Coyote_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+ctxt.dump_yap_db()
+##
Index: examples/python_tests/acme_rockets_rt0/query.py
===================================================================
--- examples/python_tests/acme_rockets_rt0/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# print "ABAC version %s" % ctxt.version()
+
+keystore=os.environ["keystore"]
+
+ctxt.load_directory(keystore)
+
+acmeID=ABAC.ID("Acme_ID.pem");
+acmeID.id_load_privkey_file("Acme_private.pem");
+acme=acmeID.id_keyid()
+
+coyoteID=ABAC.ID("Coyote_ID.pem");
+coyoteID.id_load_privkey_file("Coyote_private.pem");
+coyote=coyoteID.id_keyid()
+
+##########################################################################
+# role=[keyid:Acme].role:preferred_customer
+# p =[keyid:coyote]
+role = ABAC.Role(acme,"preferred_customer")
+p = ABAC.Role(coyote)
+print "\n===good============ Acme.preferred_customer <- Coyote"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:Acme].role:buy_rockets
+# p =[keyid:coyote]
+role = ABAC.Role(acme,"buy_rockets")
+p = ABAC.Role(coyote)
+print "\n===good============ Acme.buy_rockets <- Coyote"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+
+##########################################################################
+# role=[keyid:Coyote].role:friend
+# p=[keyid:Acme] 
+role = ABAC.Role(coyote,"friend")
+p = ABAC.Role(acme)
+print "\n===bad=============== Coyote.friend <- Acme"
+out = ctxt.query(role, p)
+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/acme_rockets_rt0/rocket.save
===================================================================
--- examples/python_tests/acme_rockets_rt0/rocket.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/rocket.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,25 @@
+% Restoring file /usr/local/lib/Yap/startup.yss
+
+===good============ Acme.preferred_customer <- Coyote
+YAP query succeed
+pAcme.preferred_customer <- pCoyote
+
+===good============ Acme.buy_rockets <- Coyote
+YAP query succeed
+pAcme.buy_rockets <- pAcme.preferred_customer
+pAcme.preferred_customer <- pCoyote
+
+===bad=============== Coyote.friend <- Acme
+YAP query failed
+
+...final principal set...
+(pAcme,keyid,y) 
+(pCoyote,keyid,y) 
+
+
+
+...final policy attribute set...
+pAcme.buy_rockets <- pAcme.preferred_customer
+pAcme.preferred_customer <- pCoyote
+
+
Index: examples/python_tests/acme_rockets_rt0/run_test
===================================================================
--- examples/python_tests/acme_rockets_rt0/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,35 @@
+#!/bin/sh 
+
+ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
+export ABAC_PROVER_PATH
+
+echo '---setup principals'
+env keystore=`pwd` ./setup.py 1>/dev/null 2>& 1
+
+echo '---setup attributes'
+env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
+
+echo '---run queries'
+
+# Make prover queries
+g_cmd_sha=`grep "cmd1:" query.py |sed "s/cmd1://g" `
+g_cmd_cn=`grep "cmd2:" query.py |sed "s/cmd2://g" `
+
+echo '...with sha'
+eval $g_cmd_sha 2>/dev/null 1 > rocket.sha
+
+echo '...with cn'
+eval $g_cmd_cn 1>rocket.cn 2>&1
+
+result=`diff rocket.cn rocket.save 2>/dev/null`
+if [ $? -eq 0 ]; then
+    if [ "$result" = "" ]; then
+       echo "   PASSED"
+    else
+       echo "   ERROR:acme_rockets_rt0 test result differs!!!"
+    fi
+else
+    echo "   ERROR:acme_rockets_rt0 test result differs!!!"
+fi
+
+
Index: examples/python_tests/acme_rockets_rt0/setup.py
===================================================================
--- examples/python_tests/acme_rockets_rt0/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/acme_rockets_rt0/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+"""
+  Setup 4 principal ID credentials
+
+  Acme, Coyote, WarnerBros and Batman
+
+"""
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+alpha=ABAC.ID("Acme", 0)
+alpha.id_write_cert("Acme_ID.pem")
+alpha.id_write_privkey("Acme_private.pem")
+
+coyote=ABAC.ID("Coyote", 0)
+coyote.id_write_cert("Coyote_ID.pem")
+coyote.id_write_privkey("Coyote_private.pem")
+
Index: examples/python_tests/allout.save
===================================================================
--- examples/python_tests/allout.save	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/allout.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -24,5 +24,29 @@
    PASSED
 
+ ==> RUN on acme_rockets_rt0
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
+ ==> RUN on alumni2_rt1
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
  ==> RUN on alumni3_rt1
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
+ ==> RUN on alumni_rt1
 ---setup principals
 ---setup attributes
@@ -46,4 +70,28 @@
    PASSED
 
+ ==> RUN on evaluator_rt1
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
+ ==> RUN on experiment_create_rt0
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
+ ==> RUN on file_read_rt2
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
  ==> RUN on fruits_rt2
 ---setup principals
@@ -53,2 +101,18 @@
 ...with cn
    PASSED
+
+ ==> RUN on leader_rt1
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
+
+ ==> RUN on payraise_rt1
+---setup principals
+---setup attributes
+---run queries
+...with sha
+...with cn
+   PASSED
Index: examples/python_tests/alumni2_rt1/README
===================================================================
--- examples/python_tests/alumni2_rt1/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# This example shows an example of reasoning about a role's parameters.  There
+# are 4 principals StateU, Bob, Maryann, and Joe.  StateU wants to establish a
+# set of founding alumni based on the year of graduation.  On graduation each
+# alum has previously been issued a credential parameterized with their major
+# and graduation year.  StateU sets up a policy that says that a principal is a
+# founding alum if they graduated in 1960, 1961, or 1963 no matter what major
+# the principal had.  One assumes there was some kind of NCAA suspension in
+# 1962.  This policy is expressed in Credential 1.
+#
+# Credentials 2, 3, and 4 each assign a diploma credential to Bob (a 1961
+# mathematics degree), Joe (a 1955 zoology degree) and Maryann (a 1962
+# psychology degree).
+#
+# The attached ./run_query file asks if each of these principals are favored
+# alums, and only Bob is.
+
+# alumni2_rt1_typeD
+
+# [keyid:stateU].role:foundingAlumni <-?- [keyid:Bob] (yes)
+# [keyid:stateU].role:foundingAlumni <-?- [keyid:Maryann] (no)
+# [keyid:stateU].role:foundingAlumni <-?- [keyid:Joe] (no)
+
+creddy --generate --cn StateU
+creddy --generate --cn Bob
+creddy --generate --cn Maryann
+creddy --generate --cn Joe
+
+stateU_keyid=`creddy --keyid --cert StateU_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`
+
+diploma_q_qY="diploma([?], [integer:?Year:[1960,1961,1963]])"
+
+diploma_m="diploma([string:'mathmatics'],[integer:1961])"
+diploma_z="diploma([string:'zoology'],[integer:1955])"
+diploma_p="diploma([string:'psychology'],[integer:1962])"
+
+# [keyid:stateU].role:foundingAlumni 
+#                   <- [keyid:stateU].role:diploma([?], [integer:?Year:[1960,1961,1963]])
+# Credential 1
+creddy --attribute \
+       --issuer StateU_ID.pem --key StateU_private.pem --role "foundingAlumni" \
+       --subject-cert StateU_ID.pem --subject-role "$diploma_q_qY" \
+       --out StateU_foundingAlumni__stateU_diploma_q_qY_attr.der
+
+# [keyid:stateU].role:diploma([string:'mathmatics'],[integer:1961]) <- [keyid:bob]
+# Credential 2
+creddy --attribute \
+        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_m" \
+        --subject-cert Bob_ID.pem \
+        --out StateU_diploma_m__Bob_attr.der
+
+# [keyid:stateU].role:diploma([string:'zoology'],[integer:1955]) <- [keyid:joe]
+# Credential 3
+creddy --attribute \
+        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_z" \
+        --subject-cert Joe_ID.pem \
+        --out StateU_diploma_m__Joe_attr.der
+
+# [keyid:stateU].role:diploma([string:'psychology'],[integer:1962]) <- [keyid:maryann]
+# Credential 4
+creddy --attribute \
+        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_p" \
+        --subject-cert Maryann_ID.pem \
+        --out StateU_diploma_m__Maryann_attr.der
+
Index: examples/python_tests/alumni2_rt1/alumni2.save
===================================================================
--- examples/python_tests/alumni2_rt1/alumni2.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/alumni2.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,28 @@
+% Restoring file /usr/local/lib/Yap/startup.yss
+
+===good============ stateU.foundingAlumni <- Bob
+YAP query succeed
+pStateU.foundingAlumni <- pStateU.diploma(_,Year:[1963,1961,1960])
+pStateU.diploma('mathmatics',1961) <- pBob
+
+===bad============ stateU.foundingAlumni <- Maryann
+YAP query failed
+
+===bad============ stateU.foundingAlumni <- Joe
+YAP query failed
+
+...final principal set...
+(pBob,keyid,y) 
+(pJoe,keyid,y) 
+(pMaryann,keyid,y) 
+(pStateU,keyid,y) 
+
+
+
+...final policy attribute set...
+pStateU.diploma('mathmatics',1961) <- pBob
+pStateU.diploma('psychology',1962) <- pMaryann
+pStateU.diploma('zoology',1955) <- pJoe
+pStateU.foundingAlumni <- pStateU.diploma(_,Year:[1963,1961,1960])
+
+
Index: examples/python_tests/alumni2_rt1/attr.py
===================================================================
--- examples/python_tests/alumni2_rt1/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+
+"""
+  Setup access policy attribute rules
+
+cmd1:env keystore=`pwd` ./attr.py 
+
+"""
+
+import os
+import ABAC
+
+keystore=os.environ["keystore"]
+
+ctxt = ABAC.Context()
+print "ABAC version %s" % ctxt.version()
+
+ctxt.load_directory(keystore)
+
+out = ctxt.context_principals()
+print "...initial principal set..."
+for x in out[1]:
+    print "%s " % x.string()
+print "\n" 
+
+out = ctxt.context_credentials()
+print "...initial policy attribute set..."
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+print "\n"
+
+stateUID=ABAC.ID("StateU_ID.pem")
+stateUID.id_load_privkey_file("StateU_private.pem")
+stateU=stateUID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem")
+bobID.id_load_privkey_file("Bob_private.pem")
+bob=bobID.id_keyid()
+
+joeID=ABAC.ID("Joe_ID.pem")
+joeID.id_load_privkey_file("Joe_private.pem")
+joe=joeID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem")
+maryann=maryannID.id_keyid()
+
+
+################################################
+# [keyid:stateU].role:foundingAlumni
+#                   <- [keyid:stateU].role:diploma([?], [integer:?Year:[1960,1961,1963]])
+head = ABAC.Role(stateU,"foundingAlumni")
+param1=ABAC.DataTerm("anonymous", "_")
+cond=ABAC.Constraint("integer")
+cond.constraint_add_integer_target(1960)
+cond.constraint_add_integer_target(1961)
+cond.constraint_add_integer_target(1963)
+param2=ABAC.DataTerm("integer", "Year", cond)
+tail = ABAC.Role(stateU,"diploma")
+tail.role_add_data_term(param1)
+tail.role_add_data_term(param2)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("StateU_foundingAlumni__stateU_diploma_q_qY_attr.der")
+ctxt.load_attribute_file("StateU_foundingAlumni__stateU_diploma_q_qY_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:stateU].role:diploma([string:'mathmatics'],[integer:1961]) <- [keyid:bob]
+param1=ABAC.DataTerm("string", "'mathmatics'")
+param2=ABAC.DataTerm("integer", "1961")
+head = ABAC.Role(stateU,"diploma")
+head.role_add_data_term(param1)
+head.role_add_data_term(param2)
+tail = ABAC.Role(bob)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("StateU_diploma_m__Bob_attr.der")
+ctxt.load_attribute_file("StateU_diploma_m__Bob_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:stateU].role:diploma([string:'zoology'],[integer:1955]) <- [keyid:joe]
+param1=ABAC.DataTerm("string", "'zoology'")
+param2=ABAC.DataTerm("integer", "1955")
+head = ABAC.Role(stateU,"diploma")
+head.role_add_data_term(param1)
+head.role_add_data_term(param2)
+tail = ABAC.Role(joe)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("StateU_diploma_z__Joe_attr.der")
+ctxt.load_attribute_file("StateU_diploma_z__Joe_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:stateU].role:diploma([string:'psychology'],[integer:1962]) <- [keyid:maryann]
+param1=ABAC.DataTerm("string", "'psychology'")
+param2=ABAC.DataTerm("integer", "1962")
+head = ABAC.Role(stateU,"diploma")
+head.role_add_data_term(param1)
+head.role_add_data_term(param2)
+tail = ABAC.Role(maryann)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("StateU_diploma_p__Maryann_attr.der")
+ctxt.load_attribute_file("StateU_diploma_p__Maryann_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+ctxt.dump_yap_db()
+##
Index: examples/python_tests/alumni2_rt1/query.py
===================================================================
--- examples/python_tests/alumni2_rt1/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# print "ABAC version %s" % ctxt.version()
+
+keystore=os.environ["keystore"]
+
+ctxt.load_directory(keystore)
+
+stateUID=ABAC.ID("StateU_ID.pem")
+stateUID.id_load_privkey_file("StateU_private.pem")
+stateU=stateUID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem")
+bobID.id_load_privkey_file("Bob_private.pem")
+bob=bobID.id_keyid()
+
+joeID=ABAC.ID("Joe_ID.pem")
+joeID.id_load_privkey_file("Joe_private.pem")
+joe=joeID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem")
+maryann=maryannID.id_keyid()
+
+##########################################################################
+# role=[keyid:stateU].role:foundingAlumni
+# p=[keyid:Bob] 
+role = ABAC.Role(stateU,"foundingAlumni")
+p = ABAC.Role(bob)
+print "\n===good============ stateU.foundingAlumni <- Bob"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:stateU].role:foundingAlumni
+# p=[keyid:Maryann] 
+role = ABAC.Role(stateU,"foundingAlumni")
+p = ABAC.Role(maryann)
+print "\n===bad============ stateU.foundingAlumni <- Maryann"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:stateU].role:foundingAlumni
+# p=[keyid:Joe] 
+role = ABAC.Role(stateU,"foundingAlumni")
+p = ABAC.Role(joe)
+print "\n===bad============ stateU.foundingAlumni <- Joe"
+out = ctxt.query(role, p)
+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/alumni2_rt1/run_test
===================================================================
--- examples/python_tests/alumni2_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,35 @@
+#!/bin/sh 
+
+ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
+export ABAC_PROVER_PATH
+
+echo '---setup principals'
+env keystore=`pwd` ./setup.py 1>/dev/null 2>& 1
+
+echo '---setup attributes'
+env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
+
+echo '---run queries'
+
+# Make prover queries
+g_cmd_sha=`grep "cmd1:" query.py |sed "s/cmd1://g" `
+g_cmd_cn=`grep "cmd2:" query.py |sed "s/cmd2://g" `
+
+echo '...with sha'
+eval $g_cmd_sha 2>/dev/null 1 > alumni2.sha
+
+echo '...with cn'
+eval $g_cmd_cn 1>alumni2.cn 2>&1
+
+result=`diff alumni2.cn alumni2.save 2>/dev/null`
+if [ $? -eq 0 ]; then
+    if [ "$result" = "" ]; then
+       echo "   PASSED"
+    else
+       echo "   ERROR:alumni2_rt1 test result differs!!!"
+    fi
+else
+    echo "   ERROR:alumni2_rt1 test result differs!!!"
+fi
+
+
Index: examples/python_tests/alumni2_rt1/setup.py
===================================================================
--- examples/python_tests/alumni2_rt1/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/alumni2_rt1/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+"""
+  Setup 4 principal ID credentials
+
+"""
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+stateU=ABAC.ID("StateU", 0)
+stateU.id_write_cert("StateU_ID.pem")
+stateU.id_write_privkey("StateU_private.pem")
+
+bob=ABAC.ID("Bob", 0)
+bob.id_write_cert("Bob_ID.pem")
+bob.id_write_privkey("Bob_private.pem")
+
+joe=ABAC.ID("Joe", 0)
+joe.id_write_cert("Joe_ID.pem")
+joe.id_write_privkey("Joe_private.pem")
+
+maryann=ABAC.ID("Maryann", 0)
+maryann.id_write_cert("Maryann_ID.pem")
+maryann.id_write_privkey("Maryann_private.pem")
+
+
Index: examples/python_tests/alumni3_rt1/run_test
===================================================================
--- examples/python_tests/alumni3_rt1/run_test	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/alumni3_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -3,6 +3,4 @@
 ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
 export ABAC_PROVER_PATH
-
-rm -rf *.der *.pem
 
 echo '---setup principals'
Index: examples/python_tests/balltime_rt2/run_test
===================================================================
--- examples/python_tests/balltime_rt2/run_test	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/balltime_rt2/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -3,6 +3,4 @@
 ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
 export ABAC_PROVER_PATH
-
-rm -rf *.der *.pem
 
 echo '---setup principals'
Index: examples/python_tests/evaluator_rt1/README
===================================================================
--- examples/python_tests/evaluator_rt1/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# This example demonstrates linking parameterized roles and delegating across
+# institutions.  There are 4 principals USC, ISI, John, and Maryann.  USC and
+# ISI are companies, and USC owns ISI.  USC sets the policy that the manager of
+# a principal (an employee) has the role of evaluating that employee (and no
+# others).  That policy is expressed in Credential 1.  Credential 2 says that
+# ISI's assignment of manager roles is accepted by USC.  Similarly Credential 4
+# says that any ISI employee is a USC employee.
+#
+# Credential 3 encodes ISI asserting that John is the manager of Maryann and
+# credentials 5 and 6 idicate that John and Maryann are ISI employees.
+# 
+# the attached ./run_query script queries that USC grants John the role of evaluator
+# of Maryann, that ISI asserts John is Maryann's manager and that John is an
+# ISI employee.
+
+# evaluator_rt1_typed
+
+#[keyid:USC].role:employee <-?- [keyid:John]
+#[keyid:USC].role:evaluatorOf([keyid:Maryann])<-?- [keyid:John]
+
+creddy --generate --cn ISI
+creddy --generate --cn USC
+creddy --generate --cn Maryann
+creddy --generate --cn John
+
+isi_keyid=`creddy --keyid --cert ISI_ID.pem`
+usc_keyid=`creddy --keyid --cert USC_ID.pem`
+maryann_keyid=`creddy --keyid --cert Maryann_ID.pem`
+john_keyid=`creddy --keyid --cert John_ID.pem`
+
+managerof_maryann="managerOf([keyid:$maryann_keyid])"
+
+#[keyid:USC].role:evaluatorOf([principal:?K])<-[keyid:USC].role:managerOf([principal:?K])
+# Credential 1
+creddy --attribute \
+       --issuer USC_ID.pem --key USC_private.pem --role 'evaluatorOf([principal:?K])' \
+       --subject-cert USC_ID.pem --subject-role 'managerOf([principal:?K])' \
+       --out USC_evaluatorof_qK__USC_managerof_qK_attr.der
+
+#[keyid:USC].role:managerOf([principal:?K])<-[keyid:ISI].role:managerOf([principal:?K])
+# Credential 2
+creddy --attribute \
+       --issuer USC_ID.pem --key USC_private.pem --role 'managerOf([principal:?K])' \
+       --subject-cert ISI_ID.pem --subject-role 'managerOf([principal:?K])' \
+       --out USC_managerof_qK__USC_employee_attr.der
+
+#[keyid:ISI].role:managerOf([keyid:Maryann]) <- [keyid:John]
+# Credential 3
+creddy --attribute \
+       --issuer ISI_ID.pem --key ISI_private.pem --role "$managerof_maryann" \
+       --subject-cert John_ID.pem \
+       --out ISI_manageof_Maryann__John_attr.der
+
+#[keyid:USC].role:employee <- [keyid:ISI].role:employee
+# Credential 4
+creddy --attribute \
+       --issuer USC_ID.pem --key USC_private.pem --role employee \
+       --subject-cert ISI_ID.pem --subject-role employee \
+       --out USC_employee__ISI_employee_attr.der
+
+#[keyid:ISI].role:employee  <- [keyid:Maryann]
+# Credential 5
+creddy --attribute \
+       --issuer ISI_ID.pem --key ISI_private.pem --role employee \
+       --subject-cert Maryann_ID.pem \
+       --out ISI_employee__Maryann_attr.der
+
+#[keyid:ISI].role:employee <- [keyid:John]
+# Credential 6
+creddy --attribute \
+       --issuer ISI_ID.pem --key ISI_private.pem --role employee \
+       --subject-cert John_ID.pem \
+       --out ISI_employee__John_attr.der
+
Index: examples/python_tests/evaluator_rt1/attr.py
===================================================================
--- examples/python_tests/evaluator_rt1/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./attr.py 
+"""
+
+import os
+import ABAC
+
+keystore=os.environ["keystore"]
+
+ctxt = ABAC.Context()
+print "ABAC version %s" % ctxt.version()
+
+ctxt.load_directory(keystore)
+
+out = ctxt.context_principals()
+print "...initial principal set..."
+for x in out[1]:
+    print "%s " % x.string()
+print "\n" 
+
+out = ctxt.context_credentials()
+print "...initial policy attribute set..."
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+print "\n"
+
+isiID=ABAC.ID("ISI_ID.pem")
+isiID.id_load_privkey_file("ISI_private.pem");
+isi=isiID.id_keyid()
+
+uscID=ABAC.ID("USC_ID.pem")
+uscID.id_load_privkey_file("USC_private.pem");
+usc=uscID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem");
+maryann=maryannID.id_keyid()
+
+johnID=ABAC.ID("John_ID.pem")
+johnID.id_load_privkey_file("John_private.pem");
+john=johnID.id_keyid()
+
+################################################
+#[keyid:USC].role:evaluatorOf([principal:?K])
+#           <-[keyid:USC].role:managerOf([principal:?K])
+param=ABAC.DataTerm("principal", "K")
+head = ABAC.Role(usc,"evaluatorOf")
+head.role_add_data_term(param)
+param=ABAC.DataTerm("principal","K")
+tail = ABAC.Role(usc,"managerOf")
+tail.role_add_data_term(param)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("USC_evaluatorof_qK__USC_managerof_qK_attr.der")
+ctxt.load_attribute_file("USC_evaluatorof_qK__USC_managerof_qK_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:USC].role:managerOf([principal:?K])
+#            <-[keyid:ISI].role:managerOf([principal:?K])
+#
+param=ABAC.DataTerm("principal", "K")
+head = ABAC.Role(usc,"managerOf")
+head.role_add_data_term(param)
+param=ABAC.DataTerm("principal", "K")
+tail = ABAC.Role(isi,"managerOf")
+tail.role_add_data_term(param)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("USC_managerof_qK__USC_employee_attr.der")
+ctxt.load_attribute_file("USC_managerof_qK__USC_employee_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:ISI].role:managerOf([keyid:Maryann]) 
+#                        <- [keyid:John]
+param=ABAC.DataTerm(maryannID)
+head = ABAC.Role(isi,"managerOf")
+head.role_add_data_term(param)
+tail = ABAC.Role(john)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("ISI_manageof_Maryann__John_attr.der")
+ctxt.load_attribute_file("ISI_manageof_Maryann__John_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+################################################
+# [keyid:USC].role:employee <- [keyid:ISI].role:employee
+head=ABAC.Role(usc,"employee")
+tail = ABAC.Role(isi,"employee")
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("USC_employee__ISI_employee_attr.der")
+#ctxt.load_attribute_file("USC_employee__ISI_employee_attr.der")
+ctxt.load_attribute(attr)
+#print attr.string() 
+#print attr.typed_string()
+#print "\n"
+
+
+#################################################
+# [keyid:ISI].role:employee  <- [keyid:Maryann]
+head = ABAC.Role(isi,"employee")
+tail= ABAC.Role(maryann)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("ISI_employee__Maryann_attr.der")
+#ctxt.load_attribute_file("ISI_employee__Maryann_attr.der")
+ctxt.load_attribute(attr)
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:ISI].role:employee  <- [keyid:John]
+head = ABAC.Role(isi,"employee")
+tail= ABAC.Role(john)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("ISI_employee__John_attr.der")
+#ctxt.load_attribute_file("ISI_employee__John_attr.der")
+ctxt.load_attribute(attr)
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+ctxt.dump_yap_db()
+##
Index: examples/python_tests/evaluator_rt1/evaluator.save
===================================================================
--- examples/python_tests/evaluator_rt1/evaluator.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/evaluator.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,35 @@
+% Restoring file /usr/local/lib/Yap/startup.yss
+
+===good============ USC.evaluatorOf(Maryann) <- John
+YAP query succeed
+pUSC.evaluatorOf(K) <- pUSC.managerOf(K)
+pUSC.managerOf(K) <- pISI.managerOf(K)
+pISI.managerOf(pMaryann) <- pJohn
+
+===good============ USC.managerOf(Maryann) <- John
+YAP query succeed
+pUSC.managerOf(K) <- pISI.managerOf(K)
+pISI.managerOf(pMaryann) <- pJohn
+
+===good============  USC.employee <-?- John
+YAP query succeed
+pUSC.employee <- pISI.employee
+pISI.employee <- pJohn
+
+...final principal set...
+(pISI,keyid,y) 
+(pJohn,keyid,y) 
+(pMaryann,keyid,y) 
+(pUSC,keyid,y) 
+
+
+
+...final policy attribute set...
+pISI.employee <- pJohn
+pISI.employee <- pMaryann
+pISI.managerOf(pMaryann) <- pJohn
+pUSC.employee <- pISI.employee
+pUSC.evaluatorOf(K) <- pUSC.managerOf(K)
+pUSC.managerOf(K) <- pISI.managerOf(K)
+
+
Index: examples/python_tests/evaluator_rt1/query.py
===================================================================
--- examples/python_tests/evaluator_rt1/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# print "ABAC version %s" % ctxt.version()
+
+keystore=os.environ["keystore"]
+
+ctxt.load_directory(keystore)
+
+isiID=ABAC.ID("ISI_ID.pem")
+isiID.id_load_privkey_file("ISI_private.pem");
+isi=isiID.id_keyid()
+
+uscID=ABAC.ID("USC_ID.pem")
+uscID.id_load_privkey_file("USC_private.pem");
+usc=uscID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem");
+maryann=maryannID.id_keyid()
+
+johnID=ABAC.ID("John_ID.pem")
+johnID.id_load_privkey_file("John_private.pem");
+john=johnID.id_keyid()
+
+##########################################################################
+#role=[keyid:USC].role:evaluatorOf([keyid:Maryann])
+#p=[keyid:John]
+param=ABAC.DataTerm(maryannID)
+role = ABAC.Role(usc,"evaluatorOf")
+role.role_add_data_term(param)
+p = ABAC.Role(john)
+print "\n===good============ USC.evaluatorOf(Maryann) <- John"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+#role=[keyid:USC].role:managerOf([keyid:Maryann])
+#p=[keyid:John]
+param=ABAC.DataTerm(maryannID)
+role = ABAC.Role(usc,"managerOf")
+role.role_add_data_term(param)
+p = ABAC.Role(john)
+print "\n===good============ USC.managerOf(Maryann) <- John"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:USC].role:employee 
+# p=[keyid:John]"
+role = ABAC.Role(usc,"employee")
+p = ABAC.Role(john)
+print "\n===good============  USC.employee <-?- John"
+out = ctxt.query(role,p)
+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/evaluator_rt1/run_test
===================================================================
--- examples/python_tests/evaluator_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,36 @@
+#!/bin/sh 
+
+ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
+export ABAC_PROVER_PATH
+
+
+echo '---setup principals'
+env keystore=`pwd` ./setup.py 1>/dev/null 2>& 1
+
+echo '---setup attributes'
+env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
+
+echo '---run queries'
+
+# Make prover queries
+g_cmd_sha=`grep "cmd1:" query.py |sed "s/cmd1://g" `
+g_cmd_cn=`grep "cmd2:" query.py |sed "s/cmd2://g" `
+
+echo '...with sha'
+eval $g_cmd_sha 2>/dev/null 1 > evaluator.sha
+
+echo '...with cn'
+eval $g_cmd_cn 1>evaluator.cn 2>&1
+
+result=`diff evaluator.cn evaluator.save 2>/dev/null`
+if [ $? -eq 0 ]; then
+    if [ "$result" = "" ]; then
+       echo "   PASSED"
+    else
+       echo "   ERROR:evaluator_rt1 test result differs!!!"
+    fi
+else
+    echo "   ERROR:evaluator_rt1 test result differs!!!"
+fi
+
+
Index: examples/python_tests/evaluator_rt1/setup.py
===================================================================
--- examples/python_tests/evaluator_rt1/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/evaluator_rt1/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+
+"""
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+isiID=ABAC.ID("ISI", 0)
+isiID.id_write_cert("ISI_ID.pem")
+isiID.id_write_privkey("ISI_private.pem")
+
+uscID=ABAC.ID("USC", 0)
+uscID.id_write_cert("USC_ID.pem")
+uscID.id_write_privkey("USC_private.pem")
+
+maryannID=ABAC.ID("Maryann", 0)
+maryannID.id_write_cert("Maryann_ID.pem")
+maryannID.id_write_privkey("Maryann_private.pem")
+
+johnID=ABAC.ID("John", 0)
+johnID.id_write_cert("John_ID.pem")
+johnID.id_write_privkey("John_private.pem")
+
Index: examples/python_tests/experiment_create_rt0/README
===================================================================
--- examples/python_tests/experiment_create_rt0/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/experiment_create_rt0/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+#
+#Acme runs a testbed. They've delegated the authority to create
+#experiments to all their partners. The Globotron company is one such
+#partner.
+#
+#    Acme.experiment_create <- Acme.partner.experiment_create
+#
+#Globotron has delegated the authority to anyone an admin thinks is a
+#'power user'.
+#
+#    Globotron.experiment_create <- Globotron.admin.power_user
+#
+#Alice is an admin, and her friend Bob is a power user:
+#
+#    Globotron.admin <- Alice
+#    Alice.power_user <- Bob
+#
+#From these credentials, it is possible to construct a proof graph
+#showing that Acme.experiment_create <- Bob.
+#
+#Note that there is a one-to-one correspondence with each credential
+#above and the attribute certificates below.
+#
+
+# experiment_create_rt0_typed 
+
+creddy --generate --cn Acme
+creddy --generate --cn Globotron
+creddy --generate --cn Alice
+creddy --generate --cn Bob
+
+#[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
+
+#[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 
+
+#[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
+
+#[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 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/experiment_create_rt0/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./attr.py 
+"""
+
+import os
+import ABAC
+
+keystore=os.environ["keystore"]
+
+ctxt = ABAC.Context()
+print "ABAC version %s" % ctxt.version()
+
+ctxt.load_directory(keystore)
+
+out = ctxt.context_principals()
+print "...initial principal set..."
+for x in out[1]:
+    print "%s " % x.string()
+print "\n" 
+
+out = ctxt.context_credentials()
+print "...initial policy attribute set..."
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+print "\n"
+
+acmeID=ABAC.ID("Acme_ID.pem");
+acmeID.id_load_privkey_file("Acme_private.pem");
+acme=acmeID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem");
+bobID.id_load_privkey_file("Bob_private.pem");
+bob=bobID.id_keyid()
+
+aliceID=ABAC.ID("Alice_ID.pem");
+aliceID.id_load_privkey_file("Alice_private.pem");
+alice=aliceID.id_keyid()
+
+globotronID=ABAC.ID("Globotron_ID.pem");
+globotronID.id_load_privkey_file("Globotron_private.pem");
+globotron=globotronID.id_keyid()
+
+################################################
+# [keyid:Acme].role:experiment_create 
+#           <- [keyid:Acme].role:partner.role:experiment_create
+head=ABAC.Role(acme,"experiment_create")
+tail = ABAC.Role(acme,"partner","experiment_create")
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Acme_experiment_create__Acme_partner_experiment_create_attr.der")
+ctxt.load_attribute_file("Acme_experiment_create__Acme_partner_experiment_create_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:Acme].role:partner <- [keyid:Globotron]
+#
+head=ABAC.Role(acme,"partner")
+tail = ABAC.Role(globotron)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Acme_partner__Globotron_attr.der")
+ctxt.load_attribute_file("Acme_partner__Globotron_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:Globotron].role:expriment_create 
+#           <- [keyid:Globotron].role:admin.role:power_user
+head = ABAC.Role(acme,"experiment_create")
+tail = ABAC.Role(globotron,"admin","power_user")
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Globotron_experiment_create__Globotron_admin_power_user_attr.der")
+ctxt.load_attribute_file("Globotron_experiment_create__Globotron_admin_power_user_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:Globotron].role:admin <- [keyid:Alice]
+head = ABAC.Role(globotron,"admin")
+tail = ABAC.Role(alice)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Globotron_admin__Alice_attr.der")
+ctxt.load_attribute_file("Globotron_admin__Alice_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:Alice].role:power_user <- [keyid:Bob]
+head = ABAC.Role(alice,"power_user")
+tail = ABAC.Role(bob)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Alice_power_user__Bob_attr.der")
+ctxt.load_attribute_file("Alice_power_user__Bob_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+ctxt.dump_yap_db()
+##
Index: examples/python_tests/experiment_create_rt0/query.py
===================================================================
--- examples/python_tests/experiment_create_rt0/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/experiment_create_rt0/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# print "ABAC version %s" % ctxt.version()
+
+keystore=os.environ["keystore"]
+
+ctxt.load_directory(keystore)
+
+acmeID=ABAC.ID("Acme_ID.pem");
+acmeID.id_load_privkey_file("Acme_private.pem");
+acme=acmeID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem");
+bobID.id_load_privkey_file("Bob_private.pem");
+bob=bobID.id_keyid()
+
+aliceID=ABAC.ID("Alice_ID.pem");
+aliceID.id_load_privkey_file("Alice_private.pem");
+alice=aliceID.id_keyid()
+
+globotronID=ABAC.ID("Globotron_ID.pem");
+globotronID.id_load_privkey_file("Globotron_private.pem");
+globotron=globotronID.id_keyid()
+
+##########################################################################
+# role=[keyid:Globotron].role:admin 
+# p=[keyid:Alice]
+role = ABAC.Role(globotron,"admin")
+p = ABAC.Role(alice)
+print "\n===good=============== Globotron.admin <- Alice"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:Globotron].role:admin 
+# p=[keyid:Bob]
+role = ABAC.Role(globotron,"admin")
+p = ABAC.Role(bob)
+print "\n===bad=============== Globotron.admin <- Bob"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+
+##########################################################################
+# role=[keyid:Acme].role:experiment_create 
+# p=[keyid:Bob]
+role = ABAC.Role(acme,"experiment_create")
+p = ABAC.Role(bob)
+print "\n===good=============== Acme.experiment_create <- Bob"
+out = ctxt.query(role, p)
+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 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/experiment_create_rt0/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,36 @@
+#!/bin/sh 
+
+ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
+export ABAC_PROVER_PATH
+
+
+echo '---setup principals'
+env keystore=`pwd` ./setup.py 1>/dev/null 2>& 1
+
+echo '---setup attributes'
+env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
+
+echo '---run queries'
+
+# Make prover queries
+g_cmd_sha=`grep "cmd1:" query.py |sed "s/cmd1://g" `
+g_cmd_cn=`grep "cmd2:" query.py |sed "s/cmd2://g" `
+
+echo '...with sha'
+eval $g_cmd_sha 2>/dev/null 1 > experiment.sha
+
+echo '...with cn'
+eval $g_cmd_cn 1>experiment.cn 2>&1
+
+result=`diff experiment.cn experiment.save 2>/dev/null`
+if [ $? -eq 0 ]; then
+    if [ "$result" = "" ]; then
+       echo "   PASSED"
+    else
+       echo "   ERROR:experiment_created_rt0 test result differs!!!"
+    fi
+else
+    echo "   ERROR:experiment_created_rt0 test result differs!!!"
+fi
+
+
Index: examples/python_tests/experiment_create_rt0/setup.py
===================================================================
--- examples/python_tests/experiment_create_rt0/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/experiment_create_rt0/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+
+"""
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+acmeID=ABAC.ID("Acme", 0)
+acmeID.id_write_cert("Acme_ID.pem")
+acmeID.id_write_privkey("Acme_private.pem")
+
+bobID=ABAC.ID("Bob", 0)
+bobID.id_write_cert("Bob_ID.pem")
+bobID.id_write_privkey("Bob_private.pem")
+
+aliceID=ABAC.ID("Alice", 0)
+aliceID.id_write_cert("Alice_ID.pem")
+aliceID.id_write_privkey("Alice_private.pem")
+
+globotronID=ABAC.ID("Globotron", 0)
+globotronID.id_write_cert("Globotron_ID.pem")
+globotronID.id_write_privkey("Globotron_private.pem")
+
+
Index: examples/python_tests/file_read_rt2/README
===================================================================
--- examples/python_tests/file_read_rt2/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/README	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+#####################################################################
+# This example demonstrates using a parameters to control access to files based
+# on the attributes of the principals.  The script creates three principals
+# Alpha, Bob, Maryann and Joe and sets out the access policy.
+# 
+# files are named by URNs and are not principals.
+# 
+# A principal's access rights are controlled by the Alpha principal.  If a
+# principal has the role role::read(urn:filename) that
+# principal can read filename.  The policy is that the manager of the owner of
+# a file can read it. (Presumably the owner can, too, but that is not encoded
+# here.)
+# 
+# The example below lays out the policy that the manager of the owner of a file
+# can read it in Credential 1. Credential 2 establishes Bob as the manager of
+# Joe. and Credential 3 establishes Joe as the owner of the file.
+#
+# The attached ./run_query file runs 2 queries.  First it confirms that Bob can read
+# fileA, then it confirms that Maryann cannot. 
+
+# file_read_rt2_typed
+
+# alpha.read(fileA) <-?- Bob
+#[keyid:Alpha].role:read([urn:'file://fileA']) <-?- [keyid:Bob] (yes)
+#[keyid:Alpha].role:read([urn:'file://fileA']) <-?- [keyid:Maryann] (yes)
+
+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`
+
+read_fileA="read([urn:'file://fileA'])"
+managerof_joe="managerOf([keyid:$joe_keyid])"
+ownerof_fileA="ownerOf([urn:'file://fileA'])"
+managerof_qE="managerOf([principal:?E[keyid:$alpha_keyid].role:ownerOf([urn:?F])])"
+
+# alpha.read(?F) <- alpha.managerOf(?E:alpha.ownerOf(?F))
+# [keyid:alpha].role:read([urn:?F])<-
+#    [keyid:alpha].role:managerOf([principal:?E[keyid:alpha].role:ownerOf([urn:?F])]
+# Credential 1
+creddy --attribute \
+       --issuer Alpha_ID.pem --key Alpha_private.pem --role "read([urn:?F])" \
+       --subject-cert Alpha_ID.pem --subject-role "$managerof_qE" \
+       --out Alpha_read_qF__alpha_managerof_qE_attr.der
+
+# Credential 2
+#[keyid:Alpha].role:managerOf([Keyid:Joe]) <- [keyid:Bob]
+creddy --attribute \
+        --issuer Alpha_ID.pem --key Alpha_private.pem --role "$managerof_joe" \
+        --subject-cert Bob_ID.pem \
+        --out Alpha_managerof_Joe__Bob_attr.der
+
+# Credential 3
+#[keyid:Alpha].role:ownerOf([urn:'file://fileA']) <- [keyid:Joe]
+creddy --attribute \
+        --issuer Alpha_ID.pem --key Alpha_private.pem --role "$ownerof_fileA" \
+        --subject-cert Joe_ID.pem \
+        --out Alpha_ownerof_fileA__Joe_attr.der
+
+####################################################################################
+# note:
+# 
+# alpha.read(?F) <- alpha.manager(?E:alpha.owner(?F))
+# [keyid:alpha].role:read([urn:?F])<-
+#       #[keyid:alpha].role:manager([principal:?E[keyid:alpha].role:owner([urn:?F])])
+# 
+# alpha.read(?F) <- alpha.manager(?E) 
+# and alpha.owner(?F) <- ?E
+# 
+# [keyid:alpha].role:read([urn:?F])<-[keyid:?M]
+#     [keyid:alpha].role:manager([principal:?E])<-[keyid:?M]
+#     [keyid:alpha].role:owner([urn:?F])<-[keyid:?E]
+# 
+# isMember(M,role(alpha,read,F)) :-
+#       isMember(M, role(alpha,manager,E)),
+#       isMember(E, role(alpha,owner,F))  <-- constraining rule
+# 
+# alpha.read(?F) <- alpha.manager(?E)
+# alpha.owner(?F) <- ?E
+# 
+# condition like this,
+#          ?E:A.r  needs to be translate into constraining rule,  A.r<-?E
+# 
+# query,
+# alpha.read(fileA) <-?- Bob
+# needs
+# alpha.manager(Joe)<-Bob
+# alpha.owner(fileA)<-Joe
+
Index: examples/python_tests/file_read_rt2/attr.py
===================================================================
--- examples/python_tests/file_read_rt2/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./attr.py 
+"""
+
+import os
+import ABAC
+
+keystore=os.environ["keystore"]
+
+ctxt = ABAC.Context()
+print "ABAC version %s" % ctxt.version()
+
+ctxt.load_directory(keystore)
+
+out = ctxt.context_principals()
+print "...initial principal set..."
+for x in out[1]:
+    print "%s " % x.string()
+print "\n" 
+
+out = ctxt.context_credentials()
+print "...initial policy attribute set..."
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+print "\n"
+
+alphaID=ABAC.ID("Alpha_ID.pem")
+alphaID.id_load_privkey_file("Alpha_private.pem");
+alpha=alphaID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem")
+bobID.id_load_privkey_file("Bob_private.pem");
+bob=bobID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem")
+maryann=maryannID.id_keyid()
+
+joeID=ABAC.ID("Joe_ID.pem")
+joeID.id_load_privkey_file("Joe_private.pem")
+joe=joeID.id_keyid()
+
+
+################################################
+# [keyid:alpha].role:read([urn:?F])<-
+#    [keyid:alpha].role:managerOf([principal:?E[keyid:alpha].role:ownerOf([urn:?F])]
+param=ABAC.DataTerm("urn", "F")
+head = ABAC.Role(alpha,"read")
+head.role_add_data_term(param)
+param=ABAC.DataTerm("urn", "F")
+condoset=ABAC.Role(alpha,"ownerOf")
+condoset.role_add_data_term(param)
+cond=ABAC.Constraint(condoset)
+param=ABAC.DataTerm("principal", "E", cond)
+tail = ABAC.Role(alpha,"managerOf")
+tail.role_add_data_term(param)
+attr=ABAC.Attribute(head, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Alpha_read_qF__alpha_managerof_qE_attr.der")
+ctxt.load_attribute_file("Alpha_read_qF__alpha_managerof_qE_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+# [keyid:Alpha].role:managerOf([Keyid:Joe]) <- [keyid:Bob]
+#
+param=ABAC.DataTerm(joeID)
+role = ABAC.Role(alpha,"managerOf")
+role.role_add_data_term(param)
+tail = ABAC.Role(bob)
+attr=ABAC.Attribute(role, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Alpha_managerof_Joe__Bob_attr.der")
+ctxt.load_attribute_file("Alpha_managerof_Joe__Bob_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+#################################################
+#[keyid:Alpha].role:ownerOf([urn:'file://fileA']) <- [keyid:Joe]
+#
+param=ABAC.DataTerm("urn", "'file://fileA'")
+role = ABAC.Role(alpha,"ownerOf")
+role.role_add_data_term(param)
+tail = ABAC.Role(joe)
+attr=ABAC.Attribute(role, 1800)
+attr.attribute_add_tail(tail)
+attr.attribute_bake()
+attr.attribute_write_cert("Alpha_ownerof_fileA__Joe_attr.der")
+ctxt.load_attribute_file("Alpha_ownerof_fileA__Joe_attr.der")
+print attr.string() 
+print attr.typed_string()
+print "\n"
+
+
+ctxt.dump_yap_db()
+##
Index: examples/python_tests/file_read_rt2/file.save
===================================================================
--- examples/python_tests/file_read_rt2/file.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/file.save	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,25 @@
+% Restoring file /usr/local/lib/Yap/startup.yss
+
+===good============ alpha.read(fileA) <- Bob
+YAP query succeed
+pAlpha.read(F) <- pAlpha.managerOf(E:pAlpha.ownerOf(F))
+pAlpha.ownerOf('file://fileA') <- pJoe
+pAlpha.managerOf(pJoe) <- pBob
+
+===bad============ alpha.read(fileA) <- Maryann
+YAP query failed
+
+...final principal set...
+(pAlpha,keyid,y) 
+(pBob,keyid,y) 
+(pJoe,keyid,y) 
+(pMaryann,keyid,y) 
+
+
+
+...final policy attribute set...
+pAlpha.managerOf(pJoe) <- pBob
+pAlpha.ownerOf('file://fileA') <- pJoe
+pAlpha.read(F) <- pAlpha.managerOf(E:pAlpha.ownerOf(F))
+
+
Index: examples/python_tests/file_read_rt2/query.py
===================================================================
--- examples/python_tests/file_read_rt2/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/query.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+cmd1:env keystore=`pwd` ./query.py 
+cmd2: env ABAC_CN=1 keystore=`pwd` ./query.py
+
+"""
+
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+# print "ABAC version %s" % ctxt.version()
+
+keystore=os.environ["keystore"]
+
+ctxt.load_directory(keystore)
+
+alphaID=ABAC.ID("Alpha_ID.pem")
+alphaID.id_load_privkey_file("Alpha_private.pem");
+alpha=alphaID.id_keyid()
+
+bobID=ABAC.ID("Bob_ID.pem")
+bobID.id_load_privkey_file("Bob_private.pem");
+bob=bobID.id_keyid()
+
+maryannID=ABAC.ID("Maryann_ID.pem")
+maryannID.id_load_privkey_file("Maryann_private.pem")
+maryann=maryannID.id_keyid()
+
+joeID=ABAC.ID("Joe_ID.pem")
+joeID.id_load_privkey_file("Joe_private.pem")
+joe=joeID.id_keyid()
+
+##########################################################################
+# role=[keyid:Alpha].role:read([urn:'file://fileA']) 
+# p=[keyid:Bob]
+param=ABAC.DataTerm("urn", "'file://fileA'")
+role = ABAC.Role(alpha,"read")
+role.role_add_data_term(param)
+p=ABAC.Role(bob)
+print "\n===good============ alpha.read(fileA) <- Bob"
+out = ctxt.query(role, p)
+for c in out[1]:
+    print "%s <- %s" % (c.head_string(), c.tail_string())
+
+##########################################################################
+# role=[keyid:Alpha].role:read([urn:'file://fileA']) 
+# p=[keyid:Maryann]
+param=ABAC.DataTerm("urn", "'file://fileA'")
+role = ABAC.Role(alpha,"read")
+p=ABAC.Role(maryann)
+print "\n===bad============ alpha.read(fileA) <- Maryann"
+out = ctxt.query(role, p)
+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/file_read_rt2/run_test
===================================================================
--- examples/python_tests/file_read_rt2/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,36 @@
+#!/bin/sh 
+
+ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
+export ABAC_PROVER_PATH
+
+
+echo '---setup principals'
+env keystore=`pwd` ./setup.py 1>/dev/null 2>& 1
+
+echo '---setup attributes'
+env keystore=`pwd` ./attr.py 1>/dev/null 2>& 1
+
+echo '---run queries'
+
+# Make prover queries
+g_cmd_sha=`grep "cmd1:" query.py |sed "s/cmd1://g" `
+g_cmd_cn=`grep "cmd2:" query.py |sed "s/cmd2://g" `
+
+echo '...with sha'
+eval $g_cmd_sha 2>/dev/null 1 > file.sha
+
+echo '...with cn'
+eval $g_cmd_cn 1>file.cn 2>&1
+
+result=`diff file.cn file.save 2>/dev/null`
+if [ $? -eq 0 ]; then
+    if [ "$result" = "" ]; then
+       echo "   PASSED"
+    else
+       echo "   ERROR:file_read_rt2 test result differs!!!"
+    fi
+else
+    echo "   ERROR:file_read_rt2 test result differs!!!"
+fi
+
+
Index: examples/python_tests/file_read_rt2/setup.py
===================================================================
--- examples/python_tests/file_read_rt2/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
+++ examples/python_tests/file_read_rt2/setup.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+"""
+  to test with python
+
+
+"""
+import os
+import ABAC
+
+ctxt = ABAC.Context()
+
+alphaID=ABAC.ID("Alpha", 0)
+alphaID.id_write_cert("Alpha_ID.pem")
+alphaID.id_write_privkey("Alpha_private.pem")
+
+bobID=ABAC.ID("Bob", 0)
+bobID.id_write_cert("Bob_ID.pem")
+bobID.id_write_privkey("Bob_private.pem")
+
+maryannID=ABAC.ID("Maryann", 0)
+maryannID.id_write_cert("Maryann_ID.pem")
+maryannID.id_write_privkey("Maryann_private.pem")
+
+joeID=ABAC.ID("Joe", 0)
+joeID.id_write_cert("Joe_ID.pem")
+joeID.id_write_privkey("Joe_private.pem")
Index: examples/python_tests/leader_rt1/run_test
===================================================================
--- examples/python_tests/leader_rt1/run_test	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/leader_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -3,7 +3,4 @@
 ABAC_PROVER_PATH="/home/mei/Deter/abac/libabac"
 export ABAC_PROVER_PATH
-
-
-rm -rf *der *pem
 
 echo '---setup principals'
Index: examples/python_tests/payraise_rt1/attr.py
===================================================================
--- examples/python_tests/payraise_rt1/attr.py	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/payraise_rt1/attr.py	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -49,6 +49,4 @@
 #      [keyid:alpha].role:evaluatorOf([principal:?this]).role:goodPerformance &
 #      [keyid:alpha].role:managerOf([principal:?this]).role:niceCoworker
-
-# [keyid:alpha].role:access([string:'Read'],[urn:'file//fileB']) <- [keyid:bob]
 head=ABAC.Role(alpha,"payRaise")
 param=ABAC.DataTerm("principal", "This")
Index: examples/python_tests/payraise_rt1/run_test
===================================================================
--- examples/python_tests/payraise_rt1/run_test	(revision 7211a95f1601147c8c72a41f8043ef08062de055)
+++ examples/python_tests/payraise_rt1/run_test	(revision 5f551d32ce8befe42bdd0b6cc9391e217749c595)
@@ -4,6 +4,4 @@
 export ABAC_PROVER_PATH
 
-
-rm -rf *der *pem
 
 echo '---setup principals'
