{-# LANGUAGE PostfixOperators #-}
module Drasil.Sections.TraceabilityMandGs (
generateTraceTable, traceMatAssumpAssump, traceMatAssumpOther,
traceMatRefinement, traceMatOtherReq, traceMatStandard,
tvAssumps, tvDataDefns, tvGenDefns, tvTheoryModels,
tvInsModels, tvGoals, tvReqs, tvChanges
) where
import Drasil.DocumentLanguage.Core (TraceConfig(TraceConfig))
import Drasil.DocumentLanguage.TraceabilityMatrix (generateTraceTableView,
traceMReferrers, traceView, traceViewCC, TraceViewCat)
import Data.Drasil.Concepts.Documentation (assumption, assumpDom, chgProbDom,
goalStmt, goalStmtDom, requirement, reqDom, item, section_, likelyChg,
unlikelyChg)
import qualified Data.Drasil.TheoryConcepts as Doc (genDefn, dataDefn, inModel, thModel)
import Database.Drasil
import SysInfo.Drasil
import Language.Drasil
import Language.Drasil.Chunk.Concept.NamedCombinators as NC
import Language.Drasil.Sentence.Combinators as S
generateTraceTable :: SystemInformation -> LabelledContent
generateTraceTable :: SystemInformation -> LabelledContent
generateTraceTable = UID
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> SystemInformation
-> LabelledContent
generateTraceTableView (String -> UID
mkUid String
"Tracey")
(forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
item Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"of Different" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
section_) [TraceViewCat
tvEverything] [TraceViewCat
tvEverything]
tvEverything :: TraceViewCat
tvEverything :: TraceViewCat
tvEverything = forall a b c. (a -> b -> c) -> b -> a -> c
flip (forall a b. a -> b -> a
const forall a. a -> a
id)
tvAssumps :: TraceViewCat
tvAssumps :: TraceViewCat
tvAssumps = forall c. Concept c => c -> TraceViewCat
traceViewCC ConceptChunk
assumpDom
tvDataDefns :: TraceViewCat
tvDataDefns :: TraceViewCat
tvDataDefns = forall a.
HasUID a =>
Getting (UMap a) ChunkDB (UMap a) -> TraceViewCat
traceView Lens' ChunkDB (UMap DataDefinition)
dataDefnTable
tvGenDefns :: TraceViewCat
tvGenDefns :: TraceViewCat
tvGenDefns = forall a.
HasUID a =>
Getting (UMap a) ChunkDB (UMap a) -> TraceViewCat
traceView Lens' ChunkDB (UMap GenDefn)
gendefTable
tvTheoryModels :: TraceViewCat
tvTheoryModels :: TraceViewCat
tvTheoryModels = forall a.
HasUID a =>
Getting (UMap a) ChunkDB (UMap a) -> TraceViewCat
traceView Lens' ChunkDB (UMap TheoryModel)
theoryModelTable
tvInsModels :: TraceViewCat
tvInsModels :: TraceViewCat
tvInsModels = forall a.
HasUID a =>
Getting (UMap a) ChunkDB (UMap a) -> TraceViewCat
traceView Lens' ChunkDB (UMap InstanceModel)
insmodelTable
tvGoals :: TraceViewCat
tvGoals :: TraceViewCat
tvGoals = forall c. Concept c => c -> TraceViewCat
traceViewCC ConceptChunk
goalStmtDom
tvReqs :: TraceViewCat
tvReqs :: TraceViewCat
tvReqs = forall c. Concept c => c -> TraceViewCat
traceViewCC ConceptChunk
reqDom
tvChanges :: TraceViewCat
tvChanges :: TraceViewCat
tvChanges = forall c. Concept c => c -> TraceViewCat
traceViewCC ConceptChunk
chgProbDom
traceMatAssumpAssump :: TraceConfig
traceMatAssumpAssump :: TraceConfig
traceMatAssumpAssump = UID
-> [Sentence]
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> TraceConfig
TraceConfig (String -> UID
mkUid String
"TraceMatAvsA") [forall n. NamedIdea n => n -> Sentence
plural CI
assumption
Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"on each other"] (forall n. NamedIdea n => n -> Sentence
titleize' CI
assumption Sentence -> Sentence -> Sentence
+:+
String -> Sentence
S String
"and Other" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
titleize' CI
assumption ) [TraceViewCat
tvAssumps] [TraceViewCat
tvAssumps]
traceMatAssumpOther :: TraceConfig
traceMatAssumpOther :: TraceConfig
traceMatAssumpOther = UID
-> [Sentence]
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> TraceConfig
TraceConfig (String -> UID
mkUid String
"TraceMatAvsAll") [forall n. NamedIdea n => n -> Sentence
plural CI
Doc.dataDefn,
forall n. NamedIdea n => n -> Sentence
plural CI
Doc.thModel, forall n. NamedIdea n => n -> Sentence
plural CI
Doc.genDefn, forall n. NamedIdea n => n -> Sentence
plural CI
Doc.inModel, forall n. NamedIdea n => n -> Sentence
plural CI
requirement,
forall n. NamedIdea n => n -> Sentence
plural CI
likelyChg, forall n. NounPhrase n => n -> Sentence
pluralNP (CI
unlikelyChg forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`NC.onThePP` CI
assumption)]
(forall n. NamedIdea n => n -> Sentence
titleize' CI
assumption Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"and Other" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
item) [TraceViewCat
tvAssumps]
[TraceViewCat
tvDataDefns, TraceViewCat
tvTheoryModels, TraceViewCat
tvGenDefns, TraceViewCat
tvInsModels, TraceViewCat
tvReqs, TraceViewCat
tvChanges]
traceMatRefinement :: TraceConfig
traceMatRefinement :: TraceConfig
traceMatRefinement = UID
-> [Sentence]
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> TraceConfig
TraceConfig (String -> UID
mkUid String
"TraceMatRefvsRef") [forall n. NamedIdea n => n -> Sentence
plural CI
Doc.dataDefn,
forall n. NamedIdea n => n -> Sentence
plural CI
Doc.thModel, forall n. NamedIdea n => n -> Sentence
plural CI
Doc.genDefn, forall n. NamedIdea n => n -> Sentence
plural CI
Doc.inModel Sentence -> Sentence -> Sentence
+:+
String -> Sentence
S String
"on each other"] (forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
item Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"and Other" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
section_)
[TraceViewCat
tvDataDefns, TraceViewCat
tvTheoryModels, TraceViewCat
tvGenDefns, TraceViewCat
tvInsModels]
[TraceViewCat
tvDataDefns, TraceViewCat
tvTheoryModels, TraceViewCat
tvGenDefns, TraceViewCat
tvInsModels]
traceMatOtherReq :: SystemInformation -> TraceConfig
traceMatOtherReq :: SystemInformation -> TraceConfig
traceMatOtherReq SystemInformation
si = UID
-> [Sentence]
-> Sentence
-> [TraceViewCat]
-> [TraceViewCat]
-> TraceConfig
TraceConfig (String -> UID
mkUid String
"TraceMatAllvsR") [forall n. NamedIdea n => n -> Sentence
plural CI
requirement
Sentence -> Sentence -> Sentence
`S.and_` forall n. NounPhrase n => n -> Sentence
pluralNP (CI
goalStmt forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`NC.onThePP` CI
Doc.dataDefn), forall n. NamedIdea n => n -> Sentence
plural CI
Doc.thModel,
forall n. NamedIdea n => n -> Sentence
plural CI
Doc.genDefn, forall n. NamedIdea n => n -> Sentence
plural CI
Doc.inModel] ((CI -> Sentence) -> Sentence
x forall n. NamedIdea n => n -> Sentence
titleize' Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"and Other" Sentence -> Sentence -> Sentence
+:+
forall n. NamedIdea n => n -> Sentence
titleize' IdeaDict
item) [TraceViewCat
tvDataDefns, TraceViewCat
tvTheoryModels, TraceViewCat
tvGenDefns, TraceViewCat
tvInsModels, TraceViewCat
tvReqs]
[TraceViewCat
tvGoals, TraceViewCat
tvReqs] where
x :: (CI -> Sentence) -> Sentence
x CI -> Sentence
g = forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl (\Sentence
a (TraceViewCat
f,CI
t) -> Sentence
a Sentence -> Sentence -> Sentence
`sC'` case ([UID] -> [UID]) -> ChunkDB -> [UID]
traceMReferrers (forall a b c. (a -> b -> c) -> b -> a -> c
flip TraceViewCat
f forall a b. (a -> b) -> a -> b
$ SystemInformation -> ChunkDB
_sysinfodb SystemInformation
si) forall a b. (a -> b) -> a -> b
$
SystemInformation -> ChunkDB
_sysinfodb SystemInformation
si of
[] -> forall a. Monoid a => a
mempty
[UID]
_ -> CI -> Sentence
g CI
t) forall a. Monoid a => a
mempty [(TraceViewCat
tvReqs, CI
requirement), (TraceViewCat
tvGoals, CI
goalStmt)]
sC' :: Sentence -> Sentence -> Sentence
sC' Sentence
EmptyS Sentence
b = Sentence
b
sC' Sentence
a Sentence
EmptyS = Sentence
a
sC' Sentence
a Sentence
b = Sentence -> Sentence -> Sentence
sC Sentence
a Sentence
b
traceMatStandard :: SystemInformation -> [TraceConfig]
traceMatStandard :: SystemInformation -> [TraceConfig]
traceMatStandard SystemInformation
s = forall a b. (a -> b) -> [a] -> [b]
map (forall a b. (a -> b) -> a -> b
$ SystemInformation
s) [forall a b. a -> b -> a
const TraceConfig
traceMatAssumpAssump, forall a b. a -> b -> a
const TraceConfig
traceMatAssumpOther, forall a b. a -> b -> a
const TraceConfig
traceMatRefinement,
SystemInformation -> TraceConfig
traceMatOtherReq]