HCLS/ACPPTaskForce/LogicFramework

From W3C Wiki
Jump to: navigation, search

Logic Framework Rules for Inclusion/Exclusion Criteria

Suppose we have a list of URIs that contain triples derived from guidelines and protocols. Each URI (knowledge base) provides knowledge about diagnosis/management of a disease, with a set of inclusion/exclusion criteria.

Example of knowledge base (per guideline or protocol) P002.n3



: acpp:inclusionCriteria (kb:DDD kb:GGG kb:HHH);
  acpp:exclusionCriteria (rim:Patient kb:maxAge 16).


For a patient with a set of conditions, the following rules are used to check if the patient's condition meet all inclusion criteria specified in a registered knowledge base (URI), at the same time, non of the exclusion criteria are found in the patient condition.



@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix kb: <http://somesites/kb-rules#>.  # we need to find a host site for our test cases
@prefix var: <http://localhost/var#>.

kb:KnowledgeBase a rdfs:Class.
kb:CandidateKnowledgeBase a rdfs:Class.
kb:NotApplicableKnowledgeBase a rdfs:Class.
kb:ApplicableKnowledgeBase a rdfs:Class.

###########################################################
#Registered knowledge bases
###########################################################

<http://somesites/P002.n3> a  kb:KnowledgeBase.
<http://somesites/P003.n3> a  kb:KnowledgeBase.
<http://somesites/P004.n3> a  kb:KnowledgeBase.
<http://somesites/P005.n3> a  kb:KnowledgeBase.

#################################################
#Test inclusion criteria
#################################################

kb:inState a rdf:Property; rdfs:domain kb:Patient; rdfs:range acpp:Context.

:jane a kb:Patient;
      kb:inState (kb:A kb:B kb:C), (kb:DDD kb:GGG kb:HHH), (rim:Patient kb:maxAge 16), (kb:XX kb:YY kb:ZZ).


####################################################
#rules to find KBs that has this inclusion criteria
####################################################


@forAll var:A, var:B, var:C.
{?P a kb:Patient;
    cpi:inState ?S.
 ?U a kb:KnowledgeBase; 
  log:semantics ?F.
  ?F log:includes {: acpp:inclusionCriteria ?S}} => {?U a kb:CandidateKnowledgeBase}.

{?U a kb:KnowledgeBase;
     log:semantics ?X.
   ?X log:includes {:  acpp:inclusionCriteria (var:A var:B var:C)}.
  }
   => {?U kb:hasInclusion (var:A var:B var:C)}.

@forAll var:P, var:A, var:B, var:C.   
{ ?U kb:hasInclusion (var:A var:B var:C).
 <> log:semantics ?F.
 var:P a kb:Patient.
 ?F log:notIncludes {var:P kb:inState (var:A var:B var:C)}.
  }
   => {?U a kb:NotApplicableKnowledgeBase}.

{?U a kb:KnowledgeBase;
     log:semantics ?X.
   ?X log:includes {:  acpp:exclusionCriteria (var:A var:B var:C)}.
  }
   => {?U kb:hasExclusion (var:A var:B var:C)}.

@forAll var:P.
{ ?U kb:hasExclusion (var:A var:B var:C).
 <> log:semantics ?F.
 var:P a kb:Patient.
 ?F log:includes {var:P kb:inState (var:A var:B var:C)}.
  }
   => {?U a kb:NotApplicableKnowledgeBase}.   


{?U a kb:CandidateKnowledgeBase.
 ?SCOPE e:findall (?U {?U a kb:NotApplicableKnowledgeBase} ())}
 =>
 {?U a kb:ApplicableKnowledgeBase}.