# The planconditions pattern in use: a garage's timing-belt service. The plan says what must
# be true before the job starts - the car on the lift with the old belt still fitted - and what
# the job is meant to leave behind: a new belt tensioned and the engine run up to temperature.
# That second situation is the one the actual Thursday service ran up to, and it gathers what
# the run consisted of; the manufacturer's schedule is satisfied by it.

@prefix agentrole: <http://www.ontologydesignpatterns.org/cp/owl/agentrole.owl#> .
@prefix basicplan: <http://www.ontologydesignpatterns.org/cp/owl/basicplan.owl#> .
@prefix basicplandescription: <http://www.ontologydesignpatterns.org/cp/owl/basicplandescription.owl#> .
@prefix basicplanexecution: <http://www.ontologydesignpatterns.org/cp/owl/basicplanexecution.owl#> .
@prefix classification: <http://www.ontologydesignpatterns.org/cp/owl/classification.owl#> .
@prefix description: <http://www.ontologydesignpatterns.org/cp/owl/description.owl#> .
@prefix objectrole: <http://www.ontologydesignpatterns.org/cp/owl/objectrole.owl#> .
@prefix parameter: <http://www.ontologydesignpatterns.org/cp/owl/parameter.owl#> .
@prefix participation: <http://www.ontologydesignpatterns.org/cp/owl/participation.owl#> .
@prefix region: <http://www.ontologydesignpatterns.org/cp/owl/region.owl#> .
@prefix sequence: <http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#> .
@prefix situation: <http://www.ontologydesignpatterns.org/cp/owl/situation.owl#> .
@prefix taskrole: <http://www.ontologydesignpatterns.org/cp/owl/taskrole.owl#> .
@prefix ex: <https://w3id.org/ontoboard/example/planconditions#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

ex:TimingBeltPlan a owl:NamedIndividual , basicplandescription:Plan ;
    rdfs:label "the garage's plan for the 120 000 km timing-belt service" ;
    <http://www.ontologydesignpatterns.org/cp/owl/planconditions.owl#hasPrecondition> ex:CarOnTheLiftOldBeltFitted ;
    <http://www.ontologydesignpatterns.org/cp/owl/planconditions.owl#hasPostcondition> ex:NewBeltTensionedEngineRunUp .

ex:CarOnTheLiftOldBeltFitted a owl:NamedIndividual , situation:Situation ;
    rdfs:label "the car is on the lift, engine cold, old belt still fitted" .

ex:ThursdayBeltService a owl:NamedIndividual , basicplanexecution:PlanExecution ;
    rdfs:label "the timing-belt service as carried out on Thursday 4 June 2026" ;
    <http://www.ontologydesignpatterns.org/cp/owl/planconditions.owl#followsPrecondition> ex:CarOnTheLiftOldBeltFitted .

ex:NewBeltTensionedEngineRunUp a owl:NamedIndividual , situation:Situation ;
    rdfs:label "the new belt is fitted and tensioned and the engine has been run up to temperature" ;
    <http://www.ontologydesignpatterns.org/cp/owl/planconditions.owl#isPostconditionPrecededBy> ex:ThursdayBeltService ;
    basicplanexecution:includesAction ex:TensioningTheNewBelt ;
    basicplanexecution:includesAgent ex:DervlaQuinn ;
    basicplanexecution:includesObject ex:TheNewTimingBelt ;
    basicplanexecution:includesRegion ex:CamshaftBoltTorque .

ex:ServiceSchedule a owl:NamedIndividual , description:Description ;
    rdfs:label "the manufacturer's service schedule for this engine" ;
    basicplan:isSatisfiedBy ex:NewBeltTensionedEngineRunUp .

ex:DervlaQuinn a owl:NamedIndividual , agentrole:Agent , basicplanexecution:Agent ;
    rdfs:label "Dervla Quinn, the mechanic on the job" ;
    basicplan:conceptualizes ex:TimingBeltPlan .

ex:TensioningTheNewBelt a owl:NamedIndividual , basicplanexecution:Action ;
    rdfs:label "tensioning the new belt and torquing the camshaft bolt" ;
    basicplan:executesTask ex:TensionTheBeltToSpecification ;
    basicplanexecution:actionHasParticipant ex:TheNewTimingBelt .

ex:TensionTheBeltToSpecification a owl:NamedIndividual , taskrole:Task ;
    rdfs:label "tension the new belt to the figure in the schedule" .

ex:TheNewTimingBelt a owl:NamedIndividual , objectrole:Object ;
    rdfs:label "the replacement timing belt and tensioner kit" ;
    objectrole:hasRole ex:PartBeingFitted .

ex:PartBeingFitted a owl:NamedIndividual , objectrole:Role ;
    rdfs:label "the part being fitted" .

ex:CamshaftBoltTorque a owl:NamedIndividual , region:Region ;
    rdfs:label "95 N m, the torque the camshaft bolt was tightened to" ;
    basicplan:isParametrizedBy ex:SpecifiedBoltTorque ;
    region:hasRegionDataValue "95" .

ex:SpecifiedBoltTorque a owl:NamedIndividual , parameter:Parameter ;
    rdfs:label "the camshaft bolt torque the schedule specifies" .

ex:FittingTheNewBelt a owl:NamedIndividual , classification:Entity , sequence:Entity ;
    rdfs:label "fitting the new belt over the pulleys" ;
    classification:isClassifiedBy ex:ScheduledServiceStep ;
    sequence:directlyFollows ex:RemovingTheOldBelt ;
    sequence:follows ex:RemovingTheOldBelt ;
    sequence:directlyPrecedes ex:RunningTheEngineUp ;
    sequence:precedes ex:RunningTheEngineUp .

ex:RemovingTheOldBelt a owl:NamedIndividual , sequence:Entity ;
    rdfs:label "removing the old belt and the worn tensioner" .

ex:RunningTheEngineUp a owl:NamedIndividual , sequence:Entity ;
    rdfs:label "running the engine up to temperature and rechecking the tension" .

ex:ScheduledServiceStep a owl:NamedIndividual , classification:Concept ;
    rdfs:label "scheduled service step" ;
    classification:classifies ex:FittingTheNewBelt .

# Only one direction of each inverse pair is asserted: actionHasParticipant/isParticipantInAction, conceptualizes/isConceptualizedBy, executesTask/isExecutedIn, followsPrecondition/isPreconditionFollowedBy, hasPostcondition/isPostconditionOf, hasPrecondition/isPreconditionOf, hasRegion/isRegionFor, hasRole/isRoleOf, includesAction/isActionIncludedIn, includesAgent/isAgentIncludedIn, includesObject/isObjectIncludedIn, includesRegion/isRegionIncludedIn, isParametrizedBy/parametrizes, isPostconditionPrecededBy/precedesPostcondition, isSatisfiedBy/satisfies. A reasoner adds the other.
