# Rein engine with quoted Request
# Expects input to be a RequestFormula that contains a request. Request itself can be in N3, RDF, or OWL.
# Example : { [] a rein:Request; requester [ session:secret "judy-passwd" ];  rein:resource <http://demo.policyawareweb.org/images/group.jpg>. } a rein:RequestFormula
# Other input includes the policy that acts on the requested resource. Can be in RDF, N3, or OWL.
# Example :  <http://demo.policyawareweb.org/images/group.jpg>     :policy <http://dig.csail.mit.edu/2005/09/rein/examples/troop42-policy.n3> .

# $Date: 2006-07-10 17:46:12 -0400 (Mon, 10 Jul 2006) $
# $Revision: 1142 $
# $Author: lkagal $

@keywords a.

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix rein: <http://dig.csail.mit.edu/2005/09/rein/network#> .
@prefix session: <http://redfoot.net/2005/session#>.
@prefix : <http://dig.csail.mit.edu/2005/09/rein/engine#>.

# semantics of policy-language property
@forAll RESOURCE, POLICY, LANG, META.
{ RESOURCE rein:policy POLICY.
  POLICY.log:semantics log:includes { POLICY rein:policy-language LANG }
} => {  POLICY rein:policy-language LANG }.

# semantics of meta-policy property
{ POLICY rein:policy-language LANG.
  LANG.log:semantics log:includes { LANG rein:meta-policy META }
} => { LANG rein:meta-policy META }.

# if policy-lang does not have a meta-policy
# load policy, policy-language and check whether 
# it infers that (requester access resource) is true

@forAll RF, REQ, WHO, RESOURCE, POLICY, LANG, ACCESS, F, G.

{  RF a rein:RequestFormula.
   RF log:includes { REQ a rein:Request }. 
   RESOURCE rein:policy POLICY. # from server 
   POLICY rein:policy-language LANG. 
   LANG.log:semantics log:notIncludes { [] rein:meta-policy [] }.
   ( RF
     { RESOURCE rein:policy POLICY }
     { POLICY rein:policy-language LANG }
     POLICY.log:semantics
     LANG.log:semantics
     <http://www.agfa.com/w3c/euler/rpo-rules.n3>.log:semantics
   ) log:conjunction F.
} => { F a ReinInfo }.


# result is obtained after filtering thru filter.n3

#ends


