Skip to content

Remaining 'chunk overwriting' warnings: Remove fillReqs & fullReqs #4450

@balacij

Description

@balacij

Relevant prior PR and discussion: #4351 and #4352

The goal of this issue is to deal with the remaining 'chunk overwriting' errors that currently pop up when you run any of Drasil's case studies. For example, Projectile:

WARNING! Overwriting `instance:verifyInVals` :: ConceptInstance
WARNING! Overwriting `instance:calcValues` :: ConceptInstance
WARNING! Overwriting `instance:outputValues` :: ConceptInstance

These occur because these chunks are already added to the ChunkDB but fillReqs adds them again:

-- | Fills in the requirements section of the system information using the document description.
fillReqs :: DocDesc -> System -> System
fillReqs [] si = si
fillReqs (ReqrmntSec (ReqsProg x):_) si@SI{_systemdb = db} = genReqs x -- This causes overwrites in the ChunkDB for all requirements.
where
genReqs [] = si
genReqs (FReqsSub c _:_) = si { _systemdb = insertAll (nub c) db }
genReqs (_:xs) = genReqs xs
fillReqs (_:xs) si = fillReqs xs si

This function is needed because for some of our examples, we generate the "input-values" functional requirement by passing a non-empty "input-values" FR description to FReqsSub in the SRSDecl:

ReqrmntSec $ ReqsProg [
FReqsSub inReqDesc funcReqsTables,
NonFReqsSub
],

reqSec :: ReqsSub -> DL.ReqsSub
reqSec (FReqsSub d t) = DL.FReqsSub (fullReqs is d $ fromConcInsDB funcReqDom) (fullTables is t)
reqSec (FReqsSub' t) = DL.FReqsSub' (fromConcInsDB funcReqDom) t
reqSec NonFReqsSub = DL.NonFReqsSub $ fromConcInsDB nonFuncReqDom

-- | Prepends a 'ConceptInstance' referencing an input-value table to a list of other 'ConceptInstance's.
-- For listing input requirements.
fullReqs :: (Quantity i, MayHaveUnit i) => [i] -> Sentence -> [ConceptInstance] -> [ConceptInstance]
fullReqs [] _ _ = []
fullReqs i d r = inReq (inReqDesc (mkInputPropsTable i) d) : r -- ++ [outReq (outReqDesc outTable)]

Objective

Generating input-values FRs is a good idea, but not in this route that heavily ties drasil-docLang to ICO problems. #4352 can be used for figuring out how to do this 'correctly', but, for now, the goal of this issue is just to undo some of this generation in favour of doing it 'better' later. It is more important to not have chunk overwrites.

Prospective Solution

  1. Creating an "input-values" FR for each of the case studies. This doesn't mean copy/pasting the same code everywhere, it could just mean importing the same common FR chunk from elsewhere.
  2. Registering said chunk and disabling the automated input-values FR generation.
  3. Removing fillReqs and fullReqs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions