Skip to content

Commit 5c526b7

Browse files
committed
Fix glassbr Body.hs: update fillcdbSRS usage, fix FReqsSub, add toSent conversions, fix mkSystem call
1 parent b370ca5 commit 5c526b7

File tree

1 file changed

+25
-24
lines changed
  • code/drasil-example/glassbr/lib/Drasil/GlassBR

1 file changed

+25
-24
lines changed

code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ module Drasil.GlassBR.Body where
33

44
import Control.Lens ((^.))
55
import Language.Drasil hiding (organization, section, variable)
6+
import Language.Drasil.Development (toSent)
67
import Drasil.Metadata as M (dataDefn, inModel, thModel)
78
import Drasil.SRSDocument
89
import Drasil.Generator (cdb)
9-
import Drasil.DocLang (auxSpecSent, termDefnF')
10+
import Drasil.DocLang (auxSpecSent, termDefnF', fillcdbSRS, DocDesc, ReqsSub(..))
1011
import qualified Drasil.DocLang.SRS as SRS (reference, assumpt, inModel)
1112
import Language.Drasil.Chunk.Concept.NamedCombinators
1213
import qualified Language.Drasil.Sentence.Combinators as S
@@ -51,11 +52,11 @@ import Drasil.GlassBR.Unitals (blast, blastTy, bomb, explosion, constants,
5152
srs :: Document
5253
srs = mkDoc mkSRS (S.forGen titleize phrase) fullSI
5354

54-
fullSI :: System
55+
fullSI :: (System, DocDesc)
5556
fullSI = fillcdbSRS mkSRS si
5657

5758
printSetting :: PrintingInformation
58-
printSetting = piSys (fullSI ^. systemdb) Equational defaultConfiguration
59+
printSetting = piSys (fst fullSI) Equational defaultConfiguration
5960

6061
si :: System
6162
si = mkSystem progName Specification
@@ -64,7 +65,7 @@ si = mkSystem progName Specification
6465
tMods [] GB.dataDefs iMods
6566
configFp
6667
inputs outputs constrained constants
67-
symbMap
68+
symbMap allRefs
6869

6970
mkSRS :: SRSDecl
7071
mkSRS = [TableOfContents,
@@ -78,7 +79,7 @@ mkSRS = [TableOfContents,
7879
IOrgSec M.dataDefn (SRS.inModel [] []) (Just orgOfDocIntroEnd)],
7980
StkhldrSec $
8081
StkhldrProg
81-
[Client progName $ phraseNP (a_ company)
82+
[Client progName $ toSent (phraseNP (a_ company))
8283
+:+. S "named Entuitive" +:+ S "It is developed by Dr." +:+ S (name mCampidelli),
8384
Cstmr progName],
8485
GSDSec $ GSDProg [SysCntxt [sysCtxIntro, LlC sysCtxFig, sysCtxDesc, sysCtxList],
@@ -99,7 +100,7 @@ mkSRS = [TableOfContents,
99100
]
100101
],
101102
ReqrmntSec $ ReqsProg [
102-
FReqsSub inReqDesc funcReqsTables,
103+
FReqsSub funcReqsTables,
103104
NonFReqsSub
104105
],
105106
LCsSec,
@@ -136,7 +137,7 @@ conceptChunks =
136137

137138
symbMap :: ChunkDB
138139
symbMap = cdb thisSymbols ideaDicts conceptChunks ([] :: [UnitDefn])
139-
GB.dataDefs iMods [] tMods concIns labCon allRefs citations
140+
GB.dataDefs iMods [] tMods concIns citations labCon
140141

141142
-- | Holds all references and links used in the document.
142143
allRefs :: [Reference]
@@ -208,7 +209,7 @@ externalLinkRef = makeURI "glassBRSRSLink"
208209

209210
undIR, appStanddIR :: [Sentence]
210211
undIR = [phrase scndYrCalculus, phrase structuralMechanics, phrase glBreakage,
211-
phrase blastRisk, pluralNP (computerApp `in_PS` Edu.civilEng)]
212+
phrase blastRisk, toSent (pluralNP (computerApp `in_PS` Edu.civilEng))]
212213
appStanddIR = [S "applicable" +:+ plural standard +:+
213214
S "for constructions using glass from" +:+ foldlList Comma List
214215
(map refS [astm2009, astm2012, astm2016]) `S.in_`
@@ -227,7 +228,7 @@ scope = foldlSent_ [S "determining the safety" `S.ofA` phrase glaSlab,
227228
{--Organization of Document--}
228229

229230
orgOfDocIntroEnd :: Sentence
230-
orgOfDocIntroEnd = foldlSent [atStartNP' (the dataDefn) `S.are`
231+
orgOfDocIntroEnd = foldlSent [toSent (atStartNP' (the dataDefn)) `S.are`
231232
S "used to support", plural definition `S.the_ofThe` S "different", plural model]
232233

233234
{--STAKEHOLDERS--}
@@ -243,32 +244,32 @@ sysCtxIntro :: Contents
243244
sysCtxIntro = foldlSP
244245
[refS sysCtxFig +:+ S "shows the" +:+. phrase sysCont,
245246
S "A circle represents an external entity outside the" +:+ phrase software
246-
`sC` phraseNP (the user), S "in this case. A rectangle represents the",
247+
`sC` toSent (phraseNP (the user)), S "in this case. A rectangle represents the",
247248
phrase softwareSys, S "itself", (sParen (short progName) !.),
248-
S "Arrows are used to show the data flow between the" +:+ phraseNP (system
249-
`andIts` environment)]
249+
S "Arrows are used to show the data flow between the" +:+ toSent (phraseNP (system
250+
`andIts` environment))]
250251

251252
sysCtxDesc :: Contents
252253
sysCtxDesc = foldlSPCol
253-
[S "The interaction between the", phraseNP (product_ `andThe` user),
254+
[S "The interaction between the", toSent (phraseNP (product_ `andThe` user)),
254255
S "is through a user" +:+. phrase interface,
255-
S "The responsibilities" `S.ofThe` phraseNP (user `andThe` system),
256+
S "The responsibilities" `S.ofThe` toSent (phraseNP (user `andThe` system)),
256257
S "are as follows"]
257258

258259
sysCtxUsrResp :: [Sentence]
259260
sysCtxUsrResp = [S "Provide the" +:+ plural inDatum +:+ S "related to the" +:+
260-
phraseNP (glaSlab `and_` blastTy) `sC` S "ensuring no errors" `S.inThe` plural datum +:+. S "entry",
261-
S "Ensure that consistent units are used for" +:+. pluralNP (combineNINI input_ variable),
261+
toSent (phraseNP (glaSlab `and_` blastTy)) `sC` S "ensuring no errors" `S.inThe` plural datum +:+. S "entry",
262+
S "Ensure that consistent units are used for" +:+. toSent (pluralNP (combineNINI input_ variable)),
262263
S "Ensure required" +:+
263-
namedRef (SRS.assumpt [] []) (pluralNP (combineNINI software assumption))
264+
namedRef (SRS.assumpt [] []) (toSent (pluralNP (combineNINI software assumption)))
264265
+:+ S "are appropriate for any particular" +:+
265266
phrase problem +:+ S "input to the" +:+. phrase software]
266267

267268
sysCtxSysResp :: [Sentence]
268269
sysCtxSysResp = [S "Detect data type mismatch, such as a string of characters" +:+
269270
phrase input_ +:+. S "instead of a floating point number",
270271
S "Determine if the" +:+ plural input_ +:+ S "satisfy the required" +:+.
271-
pluralNP (physical `and_` softwareConstraint),
272+
toSent (pluralNP (physical `and_` softwareConstraint)),
272273
S "Predict whether the" +:+ phrase glaSlab +:+. S "is safe or not"]
273274

274275
sysCtxResp :: [Sentence]
@@ -308,16 +309,16 @@ termsAndDesc = termDefnF' (Just (S "All of the" +:+ plural term_ +:+
308309
{--Physical System Description--}
309310

310311
physSystParts :: [Sentence]
311-
physSystParts = [(atStartNP (the glaSlab)!.),
312-
foldlSent [(atStartNP (the ptOfExplsn) !.), S "Where the", phrase bomb `sC`
313-
S "or", (blast ^. defn) `sC` (S "is located" !.), atStartNP (the sD) `S.isThe`
314-
phrase distance, S "between the", phrase ptOfExplsn `S.and_` phraseNP (the glass)]]
312+
physSystParts = [((toSent (atStartNP (the glaSlab)))!.),
313+
foldlSent [((toSent (atStartNP (the ptOfExplsn))) !.), S "Where the", phrase bomb `sC`
314+
S "or", (blast ^. defn) `sC` (S "is located" !.), (toSent (atStartNP (the sD))) `S.isThe`
315+
phrase distance, S "between the", phrase ptOfExplsn `S.and_` toSent (phraseNP (the glass))]]
315316

316317
{--Goal Statements--}
317318

318319
goalInputs :: [Sentence]
319-
goalInputs = [pluralNP (dimension `the_ofThePS` glaPlane), phraseNP (the glassTy),
320-
pluralNP (characteristic `the_ofThePS` explosion), phraseNP (the pbTol)]
320+
goalInputs = [toSent (pluralNP (dimension `the_ofThePS` glaPlane)), toSent (phraseNP (the glassTy)),
321+
toSent (pluralNP (characteristic `the_ofThePS` explosion)), toSent (phraseNP (the pbTol))]
321322

322323
{--SOLUTION CHARACTERISTICS SPECIFICATION--}
323324

0 commit comments

Comments
 (0)