#!/bin/sh 

#####################################################################
# This policy.sh contains the RT2 policy rules Ted Faber 
# translated from Jeff Chase's GENI authorization writeup for prolog
# 
#
keyloc=`pwd`

makeWho() {
    WHO=$1
    rm -rf ${WHO}_*.pem
    creddy --generate --cn ${WHO}
}
makeWho G
makeWho PA
makeWho SA

g=`creddy --keyid --cert $keyloc/G_ID.pem`
pa=`creddy --keyid --cert $keyloc/PA_ID.pem`
sa=`creddy --keyid --cert $keyloc/SA_ID.pem`

#####################################################################
sfile=sfile
echo "s/$g/G/g "  > $sfile 
echo "s/$pa/PA/g "  >> $sfile
echo "s/$sa/SA/g "  >> $sfile

#####################################################################
pname=yap_clauses
namespace=access1

#####################################################################
## G.identityProvider <- (G.geniRoot).identityProvider
attr="[keyid:$g].role:identityProvider <- [keyid:$g].role:geniRoot.role:identityProvider"
name=G_idenProver__gRoot_idenProvider_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.sliceAuthority <- (G.geniRoot).sliceAuthority
attr="[keyid:$g].role:sliceAuthority <- [keyid:$g].role:geniRoot.role:sliceAuthority"
name=G_sliceAuthority__gRoot_sliceAuthority_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.projectAuthority <- (G.geniRoot).projectAuthority
attr="[keyid:$g].role:projectAuthority <- [keyid:$g].role:geniRoot.role:projectAuthority"
name=G_projAuthority__gRoot_projAuthority_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.geniProxy <- (G.geniRoot).geniProxy
attr="[keyid:$g].role:geniProxy <- [keyid:$g].role:geniRoot.role:geniProxy"
name=G_geniProxy__gRoot_geniProxy_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.aggregate <- (G.geniRoot).aggregate
attr="[keyid:$g].role:aggregate <- [keyid:$g].role:geniRoot.role:aggregate"
name=G_aggr__gRoot_aggr_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.gmoc <- (G.geniRoot).gmoc
attr="[keyid:$g].role:gmoc <- [keyid:$g].role:geniRoot.role:gmoc"
name=G_gmoc__gRoot_gmoc_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.geniUser <- (G.identityProvider).geniUser
attr="[keyid:$g].role:geniUser <- [keyid:$g].role:identityProvider.role:geniUser"
name=G_geniUser__idenProvider_geniUser_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.geniPI <- (G.identityProvider).geniPI
attr="[keyid:$g].role:geniPI <- [keyid:$g].role:identityProvider.role:geniPI"
name=G_geniPI__idenProvider_geniPI_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.root(?P) <- (G.projectAuthority).root(?P)
attr="[keyid:$g].role:root([string:?P]) <- [keyid:$g].role:projectAuthority.role:root([string:?P])"
name=G_root_qP__projAuthority_root_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.root(?S) <- (G.sliceAuthority).root(?S)
attr="[keyid:$g].role:root([string:?S]) <- [keyid:$g].role:sliceAuthority.role:root([string:?S])"
name=G_root_qP__sliceAuthority_root_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## G.qualifiedProject <- (G.root(?this)).project
attr="[keyid:$g].oset:qualifiedProject <- [keyid:$g].role:root([?this]).oset:project"
name=G_qualProject__root_qTHIS_proj_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member(?P:PA.standard) <- PA.member_(?P)
attr="[keyid:$pa].role:member([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:member_([string:?P])"
name=PA_member_qP_std__PA_memberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member(?P:PA.standard) <- PA.delegate_member_(?P)
attr="[keyid:$pa].role:member([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:delegate_member_([string:?P])"
name=PA_member_qP_std__PA_delmemberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member(?P:PA.standard) <- PA.owner(?P)
attr="[keyid:$pa].role:member([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:owner([string:?P])"
name=PA_member_qP_std__PA_owner_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member_(?P:PA.standard) <- PA.owner(?P)
attr="[keyid:$pa].role:member_([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:owner([string:?P])"
name=PA_memberDel_qP_std__PA_owner_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member(?P:PA.standard) <- (PA.owner(?P)).member(?P)
attr="[keyid:$pa].role:member([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:owner([string:?P]).role:member([string:?P])"
name=PA_member_qP_std__PA_owner_qP_member_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member(?P:PA.standard) <- (PA.member_(?P)).member(?P)
attr="[keyid:$pa].role:member([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:member_([string:?P]).role:member([string:?P])"
name=PA_member_qP_std__PA_memberDel_qP_member_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.delegate_member_(?P:PA.standard) <- (PA.owner(?P)).delegate_member_(?P)
attr="[keyid:$pa].role:delegate_member_([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:owner([string:?P]).role:delegate_member_([string:?P])"
name=PA_delmemberDel_qP_std__PA_owner_qP_delmemberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member_(?P:PA.standard) <- (PA.delegate_member_(?P)).member_(?P)
attr="[keyid:$pa].role:member_([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:delegate_member_([string:?P]).role:member_([string:?P])"
name=PA_memberDel_qP_std__PA_delmemberDel_qP_memberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.member_(?P:PA.standard) <- (PA.owner(?P)).member_(?P)
attr="[keyid:$pa].role:member_([string:?P[keyid:$pa].oset:standard])<-[keyid:$pa].role:owner([string:?P]).role:member_([string:?P])"
name=PA_memberDel_qP_std__PA_owner_qP_memberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ(?P:PA.standard, ?Priv:PA.std_ops) <- PA.member(?P)
attr="[keyid:$pa].role:memberQ([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:member([string:?P])"
name=PA_memberQ_qP_std_qPRIV_stdops__member_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ(?P:PA.standard, ?Priv:PA.std_ops) <- PA.memberQ_(?P, ?Priv)
attr="[keyid:$pa].role:memberQ([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:memberQ_([string:?P],[string:?Priv])"
name=PA_memberQ_qP_std_qPRIV_stdops__memberQDel_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ(?P:PA.standard, ?Priv:PA.std_ops) <- PA.delegate_memberQ_(?P, ?Priv)
attr="[keyid:$pa].role:memberQ([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:delegate_memberQ_([string:?P],[string:?Priv])"
name=PA_memberQ_qP_std_qPRIV_stdops__delmemberQDel_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ(?P:PA.standard, ?Priv:PA.std_ops) <- (PA.memberQ_(?P, ?Priv)).memberQ(?P, ?Priv)
attr="[keyid:$pa].role:memberQ([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:memberQ_([string:?P],[string:?Priv]).role:memberQ([string:?P],[string:?Priv])"
name=PA_memberQ_qP_std_qPRIV_stdops__memberQDel_qP_qPRIV_stdops_memberQ_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ(?P:PA.standard, ?Priv:PA.std_ops) <- (PA.owner(?P)).memberQ(?P, ?Priv)
attr="[keyid:$pa].role:memberQ([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:owner([string:?P]).role:memberQ([string:?P],[string:?Priv])"
name=PA_memberQ_qP_std_qPRIV_stdops__owner_qP_memberQ_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.delegate_memberQ_(?P:PA.standard, ?Priv:PA.std_ops) <- (PA.owner(?P)).delegate_memberQ(?P, ?Priv)
attr="[keyid:$pa].role:delegate_memberQ_([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:owner([string:?P]).role:delegate_memberQ_([string:?P],[string:?Priv])"
name=PA_delmemberQDel_qP_std_qPRIV_stdops__owner_qP_delmemberQDel_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ_(?P:PA.standard, ?Priv:PA.std_ops) <- (PA.delegate_memberQ_(?P,?Priv)).memberQ_(?P,?Priv)
attr="[keyid:$pa].role:memberQ_([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops])<-[keyid:$pa].role:delegate_memberQ_([string:?P],[string:?Priv]).role:memberQ_([string:?P],[string:?Priv])"
name=PA_memberQDel_qP_std_qPRIV_stdops__PA_delmemberQDel_qP_qPRIV_memberQDel_qP_qPRIV_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ_(?P:PA.standard, ?Priv:PA.std_ops) <- (PA.owner(?P)).memberQ_(?P, ?Priv)
attr="[keyid:$pa].role:memberQ_([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:owner([string:?P]).role:memberQ_([string:?P],[string:?Priv])"
name=PA_memberQDel_qP_std_qPRIV_stdops__owner_qP_memberQDel_qP_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ_(?P:PA.standard, ?Priv:PA.std_ops) <- PA.member_(?P)
attr="[keyid:$pa].role:memberQ_([string:?P[keyid:$pa].oset:standard], [string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:member_([string:?P])"
name=PA_memberQDel_qP_std_qPRIV_stdops__memberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.std_ops <- "info"
attr="[keyid:$pa].oset:std_ops <- [string:'info']"
name=PA_stdops__info_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.std_ops <- "instantiate"
attr="[keyid:$pa].oset:std_ops <- [string:'instantiate']"
name=PA_stdops__instantiate_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.std_ops <- "stop"
attr="[keyid:$pa].oset:std_ops <- [string:'stop']"
name=PA_stdops__stop_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.memberQ_(?P:PA.standard, ?Priv:PA.std_ops) <- PA.member_(?P)
attr="[keyid:$pa].role:memberQ_([string:?P[keyid:$pa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$pa].role:member_([string:?P])"
name=PA_memberQDel_qP_std_qPRIV_stdops__memberDel_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls_(?S:SA.standard) <- (SA.delegate_controls_(?S)).controls_(?S)
attr="[keyid:$sa].role:controls_([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:delegate_controls_([string:?S]).role:controls_([string:?S])"
name=SA_ctrlsDel_std__delctrlsDel_qS_ctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.delegate_controls_(?S:SA.standard) <- (SA.owner(?S)).delegate_controls_(?S)
attr="[keyid:$sa].role:delegate_controls_([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:owner([string:?S]).role:delegate_controls_([string:?S])"
name=SA_delctrlsDel_std__owner_qS_delctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls_(?S:SA.standard) <- (SA.owner(?S)).controls_(?S)
attr="[keyid:$sa].role:controls_([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:owner([string:?S]).role:controls_([string:?S])"
name=SA_ctrlsDel_std__owner_qS_ctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls(?S:SA.standard) <- SA.owner(?S)
attr="[keyid:$sa].role:controls([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:owner([string:?S])"
name=SA_ctrls_std__owner_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls_(?S:SA.standard) <- SA.owner(?S)
attr="[keyid:$sa].role:controls_([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:owner([string:?S])"
name=SA_ctrlsDel_std__owner_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls(?S:SA.standard) <- (SA.owner(?S)).controls(?S)
attr="[keyid:$sa].role:controls([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:owner([string:?S]).role:controls([string:?S])"
name=SA_ctrls_std__owner_qS_ctrls_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls(?S:SA.standard) <- (SA.controls_(?S)).controls(?S)
attr="[keyid:$sa].role:controls([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:controls_([string:?S]).role:controls([string:?S])"
name=SA_ctrls_std__ctrlsDel_qS_ctrls_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls(?S:SA.standard) <- SA.controls_(?S)
attr="[keyid:$sa].role:controls([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:controls_([string:?S])"
name=SA_ctrls_qS_std__ctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controls(?S:SA.standard) <- SA.delegate_controls_(?S)
attr="[keyid:$sa].role:controls([string:?S[keyid:$sa].oset:standard]) <- [keyid:$sa].role:delegate_controls_([string:?S])"
name=SA_ctrls_qS_std__delctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.delegate_controlsQ_(?S, ?Priv)).controlsQ_(?S, ?Priv)
attr="[keyid:$sa].role:controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:delegate_controlsQ_([string:?S],[string:?Priv]).role:controlsQ_([string:?S],[string:?Priv])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__delctrlsQDel_qS_qPRIV_stdops_ctrlsQDel_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.delegate_controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.owner(?S)).delegate_controlsQ_(?S, ?Priv)
attr="[keyid:$sa].role:delegate_controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:owner([string:?S]).role:delegate_controlsQ_([string:?S],[string:?Priv])"
name=SA_delctrlsQDel_qS_std_qPRIV_stdops__owner_qS_delctrlsQDel_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.owner(?S)).controlsQ_(?S, ?Priv)
attr="[keyid:$sa].role:controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:owner([string:?S]).role:controlsQ_([string:?S],[string:?Priv])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__owner_qS_ctrlsQDel_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- SA.delegate_controls_(?S)
attr="[keyid:$sa].role:controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:delegate_controls_([string:?S])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__delctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- SA.controls_(?S)
attr="[keyid:$sa].role:controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:controls_([string:?S])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__ctrlsDel_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ_(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.delegate_controlsQ_(?S, ?Priv))
attr="[keyid:$sa].role:controlsQ_([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:delegate_controlsQ_([string:?S],[string:?Priv])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__ctrlsQDel_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.controlsQ_(?S, ?Priv)).controlsQ(?S, ?Priv)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:controlsQ_([string:?S],[string:?Priv]).role:controlsQ([string:?S],[string:?Priv])"
name=SA_ctrlsQDel_qS_std_qPRIV_stdops__ctrlsQDel_qS_qPRIV_stdops_ctrlsQ_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, ?Priv:PA.std_ops) <- (SA.owner(?S)).controlsQ(?S, ?Priv)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:owner([string:?S]).role:controlsQ([string:?S],[string:?Priv])"
name=SA_ctrlsQ_qS_std_qPRIV_stdops__owners_qS_ctrlsQ_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, ?Priv:PA.std_ops) <- SA.controlsQ_(?S, ?Priv)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:controlsQ_([string:?S],[string:?Priv])"
name=SA_ctrlsQ_qS_std_qPRIV_stdops__ctrlsQDel_qS_qPRIV_stdops_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, ?Priv:PA.std_ops) <- SA.controls(?S)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard],[string:?Priv[keyid:$pa].oset:std_ops]) <- [keyid:$sa].role:controls([string:?S])"
name=SA_ctrlsQ_qS_std_qPRIV_stdops__ctrls_qS_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## PA.createRoot <- PA.GeniPI
attr="[keyid:$pa].role:createRoot <- [keyid:$pa].role:geniPI"
name=PA_createRoot__geniPI_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.createSlice(?P:SA.qualifiedProject) <- SA.geniUser & (SA.projectAuthority).memberQ(?P, "instantiate")
attr="[keyid:$sa].role:createSlice([string:?P[keyid:$sa].oset:qualifiedProject]) <- [keyid:$sa].role:geniUser & [keyid:$sa].role:projectAuthority.role:memberQ([string:?P],[string:'instantiate'])"
name=SA_createSlice_qP_qualProject__geniUser_projAthority_memberQ_instantiate_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.inStdProject(?P), "info") <- (SA.projectAuthority).memberQ(?P, "info")
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:inStdProject([string:?P])],[string:'info']) <- [keyid:$sa].role:projectAuthority.role:memberQ([string:?P],[string:'info'])" 
name=SA_ctrlsQ_qS_inStdProj_qP_info__projAuthority_memberQ_qP_info_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.inStdProject(?P), "stop") <- (SA.projectAuthority).owner(?P)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:inStdProject([string:?P])], [string:'stop']) <- [keyid:$sa].role:projectAuthority.role:owner([string:?P])"
name=SA_ctrlsQ_qS_inStdProject_qP_stop__projAuthority_owner_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.inStdProject(?P), "info") <- (SA.projectAuthority).owner(?P)
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:inStdProject([string:?P])], [string:'info']) <- [keyid:$sa].role:projectAuthority.role:owner([string:?P])"
name=SA_ctrlsQ_qS_inStdProject_qP_info__projAuthority_owner_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, "stop") <- SA.gmoc
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard], [string:'stop']) <- [keyid:$sa].role:gmoc"
name=SA_ctrlsQ_qS_std_stop__gmoc_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.controlsQ(?S:SA.standard, "info") <- SA.gmoc
attr="[keyid:$sa].role:controlsQ([string:?S[keyid:$sa].oset:standard], [string:'info']) <- [keyid:$sa].role:gmoc"
name=SA_ctrlsQ_qS_std_info__gmoc_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.inStdProject(?P:PA.standard) <- SA.inProjet(?P) & SA.standard
attr="[keyid:$sa].oset:inStdProject([string:?P[keyid:$pa].oset:standard]) <- [keyid:$sa].oset:inProject([string:?P]) & [keyid:$sa].oset:standard"
name=SA_inStdProject_qP_std__inProject_qP_std_qP_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace

## SA.createSlice(?P:SA.qualifiedProject) <- SA.geniProxy &
##         SA.speaksFor(?C:(SA.projectAuthority).memberQ(?P, "instantiate"))
attr="[keyid:$sa].role:createSlice([string:?P[keyid:$sa].oset:qualifiedProject]) <- [keyid:$sa].role:geniProxy & [keyid:$sa].role:speaksFor([principal:?C[keyid:$sa].role:projectAuthority.role:memberQ([string:?P],[string:'instantiate'])])"
name=SA_createSlice_qP_qualProject__geniProxy_speaksFor_qC_projAuthority_memberQ_qP_instantiate_attr.der
creddy --attrnow --string "$attr" --out $name --out_prolog $pname --namespace $namespace


