Index: examples/access_rt2_typed/good_query.py
===================================================================
--- examples/access_rt2_typed/good_query.py	(revision 9335cfa1f9ee260325c436b438f6063dfd4ec4e7)
+++ examples/access_rt2_typed/good_query.py	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
@@ -14,4 +14,6 @@
 ctxt = ABAC.Context()
 
+# print "ABAC version %s" % ctxt.version()
+
 keystore=os.environ["keystore"]
 alpha=os.environ["alpha"]
@@ -27,4 +29,5 @@
 
 for c in out[1]:
-    print "%s <- %s" % (c.head().string(), c.tail().string())
+    print "%s <- %s" % (c.head_string(), c.tail_string())
 
+#    print "%s <- %s" % (c.role_head().string(), c.role_tails().string())
Index: examples/access_rt2_typed/run_query
===================================================================
--- examples/access_rt2_typed/run_query	(revision 9335cfa1f9ee260325c436b438f6063dfd4ec4e7)
+++ examples/access_rt2_typed/run_query	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
@@ -22,4 +22,7 @@
 $eloc/abac_prover_yap  --keystore $keyloc --dump creds_dump
 
+# double check
+#creddy  --roles --cert Alpha_access_qFqP__alpha_team_qP_attr.der
+
 #[keyid:Alpha].role:access([string:'Read'],[urn:'file//fileA']) <-?- [keyid:bob] (yes)
 echo " "
Index: examples/allout.save
===================================================================
--- examples/allout.save	(revision 9335cfa1f9ee260325c436b438f6063dfd4ec4e7)
+++ examples/allout.save	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
@@ -1,5 +1,4 @@
 
  ==> RUN on access_rt2_typed
-YAP dump succeed
  
 ===good============ Alpha.access(Read,fileA)<-?-Bob
@@ -22,5 +21,4 @@
 
  ==> RUN on acme_friend_rt1_typed
-YAP dump succeed
   
 ===bad============ Acme.friendOf(Roadrunner) <- Coyote
@@ -52,5 +50,4 @@
 
  ==> RUN on acme_rockets_intersection_rt0_typed
-YAP dump succeed
   
 ===good============ Acme.buy_rockets <- Coyote
@@ -75,5 +72,4 @@
 
  ==> RUN on acme_rockets_rt0_typed
-YAP dump succeed
   
 ===good============ Acme.preferred_customer <- Coyote
@@ -91,5 +87,5 @@
   
 ===bad=============== Acme.buy_rockets <- Acme.preferred_customer
-fail, a.r <- b.r query is not implemented yet !!!
+fail, a.o <- b.o and a.r <- a.r query is not implemented yet !!!
   
 ===bad=============== Coyote.friend <- Acme
@@ -98,5 +94,4 @@
 
  ==> RUN on alice_rt1_typed
-YAP dump succeed
   
 ===good============ Party.guests <- dourmouse
@@ -112,5 +107,4 @@
 
  ==> RUN on alumni2_rt1_typed
-YAP dump succeed
  
 ===good============ stateU.foundingAlumni <- Bob
@@ -130,5 +124,4 @@
 
  ==> RUN on alumni3_rt1_typed
-YAP dump succeed
  
 ===good============ stateU.foundingAlumni <- Bob
@@ -159,5 +152,4 @@
 
  ==> RUN on alumni_rt1_typed
-YAP dump succeed
  
 ===bad============ stateU.foundingAlumni <- Bob
@@ -180,5 +172,4 @@
 
  ==> RUN on balltime_rt2_typed
-YAP dump succeed
  
 ===good============ league.stadium(access,true,20120128T130000)<-?-john
@@ -202,5 +193,4 @@
 
  ==> RUN on evaluator_rt1_typed
-YAP dump succeed
  
 ===good============ USC.evaluatorOf(Maryann) <- John
@@ -226,5 +216,4 @@
 
  ==> RUN on experiment_create_rt0_typed
-YAP dump succeed
  
 ===good=============== Globotron.admin <- Alice
@@ -249,5 +238,4 @@
 
  ==> RUN on file_read_rt2_typed
-YAP dump succeed
  
 ===good============ alpha.read(fileA) <- Bob
@@ -264,5 +252,4 @@
 
  ==> RUN on fruits_rt2_typed
-YAP dump succeed
  
 ===good============ mary.what2eat <- navel orange
@@ -294,6 +281,25 @@
 prover failed!!
 
+ ==> RUN on leader_rt1_typed
+ 
+===yes============ geni.leader <- Bob
+YAP query succeed
+prover success!!
+credentials needed :
+ pGeni.leader  <- pBob 
+ 
+===no============ geni.leader <- Jack
+YAP query failed
+prover failed!!
+ 
+===yes============ geni.leader <- Joe
+YAP query succeed
+prover success!!
+credentials needed :
+ pGeni.leader  <- pGeni.equivalent(P:pGeni.leader) 
+ pGeni.leader  <- pBob 
+ pGeni.equivalent(pBob)  <- pJoe 
+
  ==> RUN on payraise_rt1_typed
-YAP dump succeed
  
 ===bad============ alpha.payRaise <- Joe
Index: examples/leader_rt1_typed/README
===================================================================
--- examples/leader_rt1_typed/README	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
+++ examples/leader_rt1_typed/README	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# This example shows a way to allow an user with multiple keyid identities 
+# to be 'reasoned' as one within a single scope.  There are 4 principals 
+# Geni, Bob, Jack, and Joe. Bob and Joe are actually the same person but 
+# not Jack.
+#
+# Credentials 1 is the policy that says a principal is a group leader
+# at Geni if it is equivalent to another principal who is a group 
+# leader at Geni. 
+#
+# Credentials 2 establishes Bob as a group leader at Geni while
+# credential 3 and 4 are the equivalent rules between Bob and Joe.
+#
+# The attached ./run_query file asks if Joe is also an group leader which
+# he is because there is a equivalent rule from Bob to him. It also asks
+# if Jack is a group leader which he isn't because there is no equivalent
+# rule from Bob to him.
+
+# leader_rt1_typed
+
+# [keyid:geni].role:leader <-?- [keyid:Bob] (yes)
+# [keyid:geni].role:leader <-?- [keyid:Jack] (no)
+# [keyid:geni].role:leader <-?- [keyid:Joe] (yes)
+
+creddy --generate --cn Geni
+creddy --generate --cn Bob
+creddy --generate --cn Jack
+creddy --generate --cn Joe
+
+geni_keyid=`creddy --keyid --cert Geni_ID.pem`
+bob_keyid=`creddy --keyid --cert Bob_ID.pem`
+jack_keyid=`creddy --keyid --cert Jack_ID.pem`
+joe_keyid=`creddy --keyid --cert Joe_ID.pem`
+
+leader_qP="equivalent([principal:?P[keyid:$geni_keyid].role:leader])"
+equivalent_bob="equivalent([keyid:$bob_keyid])"
+equivalent_joe="equivalent([keyid:$joe_keyid])"
+
+# [keyid:geni].role:leader 
+#         <- [keyid:geni].role:equivalent([principal:?P[keyid:geni].role:leader])
+# Credential 1
+/home/mei/Deter/abac/creddy/creddy --attribute \
+       --issuer Geni_ID.pem --key Geni_private.pem --role "leader" \
+       --subject-cert Geni_ID.pem --subject-role "$leader_qP" \
+       --out geni_leader__geni_leader_qP_attr.der
+
+# [keyid:geni].role:leader <- [keyid:bob]
+# Credential 2
+creddy --attribute \
+        --issuer Geni_ID.pem --key Geni_private.pem --role "leader" \
+        --subject-cert Bob_ID.pem \
+        --out geni_leader__Bob_attr.der
+
+# [keyid:geni].role:equivalent([keyid:bob]) <- [keyid:Joe]
+# Credential 3
+creddy --attribute \
+        --issuer Geni_ID.pem --key Geni_private.pem --role "$equivalent_bob" \
+        --subject-cert Joe_ID.pem \
+        --out geni_equivalent_Bob__Joe_attr.der
+
+# [keyid:geni].role:equivalent([keyid:Joe]) <- [keyid:Bob]
+# Credential 4
+creddy --attribute \
+        --issuer Geni_ID.pem --key Geni_private.pem --role "$equivalent_joe" \
+        --subject-cert Bob_ID.pem \
+        --out geni_equivalent_Joe__Bob_attr.der
+
Index: examples/leader_rt1_typed/run_query
===================================================================
--- examples/leader_rt1_typed/run_query	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
+++ examples/leader_rt1_typed/run_query	(revision 8bd77b59df89993868555d3b87f91fc241b09228)
@@ -0,0 +1,43 @@
+
+# leader_rt1_typed
+
+pwd=`pwd`
+
+eloc=$pwd/../../libabac
+keyloc=$pwd
+
+geni=`creddy --keyid --cert $keyloc/Geni_ID.pem`
+bob=`creddy --keyid --cert $keyloc/Bob_ID.pem`
+jack=`creddy --keyid --cert $keyloc/Jack_ID.pem`
+joe=`creddy --keyid --cert $keyloc/Joe_ID.pem`
+
+geni_leader="[keyid:$geni].role:leader"
+bob_prin="[keyid:$bob]"
+jack_prin="[keyid:$jack]"
+joe_prin="[keyid:$joe]"
+
+# [keyid:geni].role:leader <-?- [keyid:Bob] (yes)
+# [keyid:geni].role:leader <-?- [keyid:Jack] (no)
+# [keyid:geni].role:leader <-?- [keyid:Joe] (yes)
+
+## dump all credentials
+$eloc/abac_prover_yap  --keystore $keyloc --dump creds_dump
+
+#double checking 
+#creddy --roles --cert geni_leader__geni_leader_qP_attr.der
+
+# [keyid:geni].role:leader <-?- [keyid:Bob] (yes)
+echo " "
+echo "===yes============ geni.leader <- Bob"
+$eloc/abac_prover_yap  --keystore $keyloc --role "$geni_leader" --principal "$bob_prin"
+
+# [keyid:geni].role:leader <-?- [keyid:Jack] (no)
+echo " "
+echo "===no============ geni.leader <- Jack"
+$eloc/abac_prover_yap  --keystore $keyloc --role "$geni_leader" --principal "$jack_prin"
+
+# [keyid:geni].role:leader <-?- [keyid:Joe] (yes)
+echo " "
+echo "===yes============ geni.leader <- Joe"
+$eloc/abac_prover_yap  --keystore $keyloc --role "$geni_leader" --principal "$joe_prin"
+
