# $Id: transplant.ttl,v 1.12 2014-09-23 09:11:34 eric Exp $
#
# Transplant function

# ericP at the keyboard

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

@prefix dt: <http://www.hl7.org/owl/iso-dt-2.0#> .
@prefix bridg: <http://www.bridgmodel.org/owl#> .
#@prefix fma: <http://sig.uw.edu/fma#> .

@prefix : <http://www.w3.org/2013/12/FDA-TA/transplant#> .
#@prefix ucum: <http://unitsofmeasure.org/ucum-essence.xml#> .
@prefix core: <http://www.w3.org/2013/12/FDA-TA/core#> .
@prefix data: <http://www.w3.org/2013/12/FDA-TA/datatypes#> .


<http://www.w3.org/2013/12/FDA-TA/transplant> a owl:Ontology ;
    owl:imports <http://www.w3.org/2013/12/FDA-TA/core> .

:TransplantProcedure rdfs:subClassOf core:TherapeuticProcedure .

:DonorCriteria rdfs:subClassOf core:AdministrativeObservation .

:StandardCriteriaDonor rdfs:subClassOf :DonorCriteria ;
    skos:definition "A donor who has suffered brain death (i.e., is not a donor after cardiac death) and who is not an expanded criteria kidney donor." .

:ExpandedCriteriaDonor rdfs:subClassOf :DonorCriteria ;
    skos:definition "A kidney donated for transplantation from any brain dead donor over the age of 60 years; or from a donor over the age of 50 years with two of the following: a history of hypertension, the most recent serum creatinine greater than or equal to 1.5 mg/dl, or death resulting from a cerebral vascular accident (stroke). This definition applies to the allocation of deceased donor kidneys." .

:DonorAfterCirculatoryDeath rdfs:subClassOf :DonorCriteria ;
    skos:definition "@@missing" .

:organ rdfs:domain :TransplantProcedure ; rdfs:range bridg:Biologic .
# @@SPIN rules to create BRIDG structure
# PREFIX bridg: <http://www.bridgmodel.org/owl#>
# PREFIX bridg999: <http://a.example/ns/bridg999#>
# PREFIX xplant: <http://www.w3.org/2013/12/FDA-TA/transplant#>
# CONSTRUCT {
# _:TP1extractAdmin a bridg:SubstanceExtractionAdministrationRelationship ;
#     bridg:SubstanceExtractionAdministrationRelationship.producingPerformedSubstanceExtraction ?extraction ;
#     bridg:SubstanceExtractionAdministrationRelationship.usingPerformedSubstanceAdministration ?administration .
# 
# _:TP1pcrExtract a bridg:PerformedCompositionRelationship ;
#     bridg:PerformedCompositionRelationship.componentPerformedActivity ?transplant ;
#     bridg:PerformedCompositionRelationship.compositePerformedActivity ?extraction .
# 
# _:TP1pcrAdmin a bridg:PerformedCompositionRelationship ;
#     bridg:PerformedCompositionRelationship.componentPerformedActivity ?transplant ;
#     bridg:PerformedCompositionRelationship.compositePerformedActivity ?administration .
# } WHERE {
#     ?transplant xplant:organ ?organ .
#     ?extraction bridg:PerformedSubstanceExtraction.producedBiologic ?organ .
#     ?administration bridg999:PerformedSubstanceExtraction.usedBiologic ?organ .
# }

# Observations and results
:HLA-Panel 
    rdfs:subClassOf 
        core:SingleOutcomeAssessment .#,
#        [ owl:onProperty bridg:PerformedObservation.resultedPerformedObservationResult ;
#          owl:allValuesFrom :HLA-PanelResult 
#        ] .
:HLA-PanelResult rdfs:subClassOf bridg:PerformedObservationResult .
:HLA-DR2-Result rdfs:subClassOf :HLA-PanelResult .
:HLA-DR1-Result rdfs:subClassOf :HLA-PanelResult .
:HLA-B2-Result  rdfs:subClassOf :HLA-PanelResult .
:HLA-B1-Result  rdfs:subClassOf :HLA-PanelResult .
:HLA-A2-Result  rdfs:subClassOf :HLA-PanelResult .
:HLA-A1-Result  rdfs:subClassOf :HLA-PanelResult .

:HLAmatchAssessment 
    rdfs:subClassOf core:SingleOutcomeAssessment ,
        [ owl:onProperty core:onObservation ; owl:allValuesFrom :HLA-Panel ] ,
        [ owl:onProperty core:hasResultValue ;
          owl:hasValue [ owl:onProperty core:hasResultValue ;
                         owl:allValuesFrom xsd:boolean ] ] .

:ViralScreen-Panel 
    rdfs:subClassOf 
        core:SingleOutcomeAssessment ,
        [ owl:onProperty bridg:PerformedObservation.resultedPerformedObservationResult ;
          owl:allValuesFrom :ViralScreen-PanelResult ] .
:ViralScreen-PanelResult 
    rdfs:subClassOf 
        bridg:PerformedObservationResult ,
        [ owl:onProperty data:value ;
          owl:allValuesFrom core:ScreenValue ] .
:ViralScreen-CytomegaloVirus-Result  rdfs:subClassOf :ViralScreen-PanelResult .
:ViralScreen-HepatitisB-Result  rdfs:subClassOf :ViralScreen-PanelResult .
:ViralScreen-HepatitisC-Result  rdfs:subClassOf :ViralScreen-PanelResult .
:ViralScreen-EpsteinBarr-Result  rdfs:subClassOf :ViralScreen-PanelResult .

:ViralScreenAssessment 
    rdfs:subClassOf core:SingleOutcomeAssessment ,
        [ owl:onProperty core:onObservation ; owl:allValuesFrom :ViralScreen-Panel ] ,
        [ owl:onProperty core:hasResultValue ;
          owl:hasValue [ owl:onProperty core:hasResultValue ;
                         owl:allValuesFrom xsd:boolean ] ] .

:coldIschimeiaTime a owl:ObjectProperty ; rdfs:domain bridg:Biologic ; rdfs:range dt:PQ.TIME ;
    skos:definition "An apparatus for forcing a gas or liquid from or to any part. In organ preservation, pump is a reference to the mechanical perfusion pump that is used to continuously perfuse a recovered organ with a chilled preservation solution." .
:wasPumped a owl:DatatypeProperty ; rdfs:domain bridg:Biologic ; rdfs:range xsd:boolean ;
    skos:definition "In surgery, the time between the chilling of a tissue, organ, or body part after its blood supply has been reduced or cut off and the time it is warmed by having its blood supply restored. This can occur while the organ is still in the body or after it is removed from the body if the organ is to be used for transplantation." .

# assessements

:GraftViability 
    rdfs:subClassOf core:SingleOutcomeAssessmentValue ;
    owl:oneOf (:NonFunctioningGraft :SemiFunctioningGraft :NormalFunctioningGraft) .

:TransplantBiopsyReport # peculiar to allograft transplantation or does this go near core?
    rdfs:subClassOf 
        core:PathologyReport ,
        [ owl:onProperty core:hasClassification ;
          owl:someValuesFrom :RejectionClassification ] ,
        [ owl:onProperty core:hasPathologyFinding ;
          owl:someValuesFrom :BanffGrade ] .

:RejectionClassification rdfs:subClassOf data:ValueSetValue ;
    owl:oneOf ( :ChronicRejection :AntibodyMediatedRejection :TCellMediatedRejection ) .

:ChronicRejection a :RejectionClassification ;
    skos:definition "@@empty" .
:AntibodyMediatedRejection a :RejectionClassification ;
    skos:definition "@@empty" .
:TCellMediatedRejection a :RejectionClassification ;
    skos:definition "@@empty" .


:BanffGrade rdfs:subClassOf data:ValueSetValue ;
    skos:definition "The BANFF Classification of renal allograph pathology is standard classification scheme developed to assist in the interpretation of allograph biopsies." ;
    owl:oneOf ( :BanffIA :BanffIB :BanffIIA :BanffIIB :BanffIII ) .
:BanffIA  a :BanffGrade ; skos:definition "BANFF Grade for Acute Rejection. Cases with significant interstitial infiltration (>25% of parenchyma affected) and foci of moderate tubulitis (>4 mononuclear cells/tubular cross section or group of 10 tubular cells)." .
:BanffIB  a :BanffGrade ; skos:definition "BANFF Grade for Acute Rejection. Cases with significant interstitial infiltration (>25% of parenchyma affected) and foci of severe tubulitis (>10 mononuclear cells/tubular cross section or group of 10 tubular cells)." .
:BanffIIA a :BanffGrade ; skos:definition "BANFF Grade for Acute Rejection. Cases with mild to moderate intimal arteritis (v1)." .
:BanffIIB a :BanffGrade ; skos:definition "BANFF Grade for Acute Rejection. Cases with severe intimal arteritis comprising > 25% of the luminal area (v2)." .
:BanffIII a :BanffGrade ; skos:definition "BANFF Grade for Acute Rejection. Cases with 'transmural' arteritis and/or arterial fibrinoid change and necrosis of medial smoth muscle cells (v3 with accompanying lymphoctic inflammation)." .

# Axiom: { ?x core:hasResultValue :NormalFunctioningGraft } => { ?x a core:PositiveOutcome }
:GraftSurvivalAssessment a owl:Class ; # rename to GraftWithNormalFunction ?
    rdfs:subClassOf core:PositiveOutcome ;
    owl:equivalentClass [ a owl:Restriction ;
                          owl:onProperty core:hasResultValue ;
                          owl:hasValue :NormalFunctioningGraft ] .

:GraftLossAssessment a owl:Class ; # rename to NonFunctioningGraft ?
    rdfs:subClassOf core:NegativeOutcome ;
    owl:equivalentClass [ a owl:Restriction ;
                          owl:onProperty core:hasResultValue ;
                          owl:hasValue :NonFunctioningGraft ] .

:GraftCSARAssessment a owl:Class ;
    skos:definition "A pathological event of transplant rejection requiring clinical evidence, which can include one or more of the following: 1) an unexplained rise of serum creatinine (SCr) >= 25% from baseline, 2) occurrence of one or more of the following:  an unexplained decreased urine output; fever and graft tenderness; a SCr that remained elevated within 14 days after transplantation and clinical suspicion of AR, and 3) a reason other than those listed above where the subject was treated for this episode." ;
    rdfs:subClassOf 
        core:FunctionOutcomeAssessment ,
        [ owl:onProperty core:hasResultValue ;
          owl:someValuesFrom [ owl:oneOf ( :NonFunctioningGraft  :SemiFunctioningGraft ) ]
        ] .

:GraftBPARAssessment a owl:Class ;      
    skos:definition "@@empty" ;
    rdfs:subClassOf 
        core:NegativeOutcome ,
        [ owl:onProperty core:confirms ; owl:minCardinality 0 ] ;
    owl:equivalentClass [
        a owl:Class ;
        owl:intersectionOf (
          [ a owl:Restriction ;
            owl:onProperty core:afterIntervention ;
            owl:someValuesFrom [
                a owl:Restriction ;
                owl:onProperty core:hasPathologyFinding ;
                owl:hasValue :BanffIII
            ]
          ]
          [ a owl:Restriction ;
            owl:onProperty core:hasResultValue ;
            owl:hasValue :NonFunctioningGraft
          ]
        )
    ]
.

:_endpoint_GraftSurvivalAssessment 
    rdfs:subClassOf core:InferrableDiagnosis ,
        [
            owl:onProperty core:hasDiagnosis ; # !! undefined (as of migration from hasOutome)
            owl:someValuesFrom [
                owl:onProperty core:hasResultValue ;
                owl:hasValue :NormalFunctioningGraft 
            ]
        ] ;
    # =     core:hasIntervention some :TransplantProcedure
    #   and core:hasOutcomeAssessment some (    core:OrganFunctionOutcomeAssessment
    #                                       and core:hasResultValue value renal:ImprovedToNormal)
    owl:equivalentClass [
        owl:intersectionOf (
            [ owl:onProperty core:hasIntervention ; owl:someValuesFrom :TransplantProcedure ]
            [ owl:onProperty core:hasOutcomeAssessment ;
                owl:someValuesFrom [
                   # produces error classes in Protégé:
                   #   rdfs:subClassOf core:OrganFunctionOutcomeAssessment ,
                   #       [ owl:onProperty core:hasResultValue ; owl:hasValue renal:ImprovedToNormal ]
                    owl:intersectionOf (
                        core:FunctionOutcomeAssessment 
                        [ owl:onProperty core:hasResultValue ; owl:hasValue :ImprovedToNormal ]
                    )
                ]
            ]
        )
    ] .

