Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d3c5451
gather chunk refs from Reference metadata
Xinlu-Y Oct 28, 2025
f930e6b
HasChunkRefs for IdeaDict
Xinlu-Y Oct 28, 2025
32f3c04
HasChunkRefs for Citation
Xinlu-Y Oct 28, 2025
e9e0038
HasChunkRefs for `UnitDefn`
Xinlu-Y Oct 28, 2025
d28cafb
collect chunk references from concept metadata
Xinlu-Y Nov 4, 2025
5719827
seed basis citations and filter duplicates
Xinlu-Y Nov 4, 2025
8875f1f
feat(glassbr): track input references
Xinlu-Y Nov 4, 2025
631eec3
feat(dblpend): surface input properties requirement
Xinlu-Y Nov 4, 2025
fd37057
feat(pdcontroller): capture controller input table
Xinlu-Y Nov 4, 2025
3cd0f38
feat(projectile): capture launch inputs and tidy assumptions
Xinlu-Y Nov 4, 2025
b926a6a
feat(gamephysics): expose section reference citations
Xinlu-Y Nov 4, 2025
fdd1c54
feat(projectile): capture launch inputs and tidy assumptions
Xinlu-Y Nov 4, 2025
517ff62
feat(ssp): treat input table as explicit requirement
Xinlu-Y Nov 4, 2025
97212b7
expose input requirement sentence builder
Xinlu-Y Nov 4, 2025
a56504d
feat(swhs): register input table and clean metadata
Xinlu-Y Nov 4, 2025
f9eda18
feat(swhsnopcm): wire input table into requirement trace
Xinlu-Y Nov 4, 2025
9db8448
feat(sglpend): surface pendulum input requirement
Xinlu-Y Nov 4, 2025
288381d
revert the inlined PCM
Xinlu-Y Nov 11, 2025
5ba7073
add comments about reordering the assumptions
Xinlu-Y Nov 11, 2025
21e5fde
add comments about reordering the units
Xinlu-Y Nov 11, 2025
65cc135
Register `phsChgMtrl` before program name entries to fix dependency o…
Xinlu-Y Nov 11, 2025
d82f5c4
regenerate stable reference sections with shared citations
Xinlu-Y Nov 11, 2025
ea3a593
resequence assumptions and trace artifacts after chunk reorder
Xinlu-Y Nov 11, 2025
2d418fa
Merge remote-tracking branch 'origin/main' into fill-chunk-refs
Xinlu-Y Nov 11, 2025
30a1152
fix chunk ref collection for new `NPStruct`
Xinlu-Y Nov 11, 2025
9840d37
tidy imports
Xinlu-Y Nov 11, 2025
a3891b4
stabilizes
Xinlu-Y Nov 11, 2025
b860ab6
Switch to out-of-order-permitted chunk insertion when creating `Chunk…
balacij Nov 11, 2025
c2ce1aa
Re-order cdb arguments to shorten cdb definition
balacij Nov 11, 2025
b4dea08
insertAllOutOfOrder12: Only need to check that inserted chunks aren't…
balacij Nov 12, 2025
7128107
insertAllOutOfOrder12: Add more comments for clarity.
balacij Nov 12, 2025
2330c83
insertAllOutOfOrder12: Add dependancy checks for LablledContents and …
balacij Nov 12, 2025
f2186c5
insertAllOutOfOrder12: Fix logical bug in hardLookup. invert will not…
balacij Nov 12, 2025
7d410dc
Merge remote-tracking branch 'origin/cdbInsertOutOfOrder12' into fill…
Xinlu-Y Nov 13, 2025
40a86f6
cleaned up the unused citation imports
Xinlu-Y Nov 13, 2025
ec610c9
rewrite fillReqs to skip registered requirements
Xinlu-Y Nov 13, 2025
e70066f
remove unital symbols and add `loadDur` as a defined quantity.
Xinlu-Y Nov 13, 2025
b8a2991
stabilized outputs (trace table reordering due to updated chunk inser…
Xinlu-Y Nov 13, 2025
1b11b06
Merge remote-tracking branch 'origin' into fill-chunk-refs
Xinlu-Y Nov 13, 2025
3028ab6
fix name shadowing in `DefinedQuantity` chunkRefs
Xinlu-Y Nov 13, 2025
e3b3de0
remove redundant import
Xinlu-Y Nov 13, 2025
647c79b
Merge remote-tracking branch 'origin/main' into fill-chunk-refs
Xinlu-Y Nov 18, 2025
84e07b2
remove unused `chunks` from `ChunkDB`
Xinlu-Y Nov 18, 2025
5e39b6b
align examples with `inReqWTab` API
Xinlu-Y Nov 18, 2025
2b0c445
fix trailing whitespace
Xinlu-Y Nov 18, 2025
f59b91a
stabilize
Xinlu-Y Nov 18, 2025
4068616
remove deprecated multilingual field from mdBook config
Xinlu-Y Nov 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions code/drasil-data/lib/Data/Drasil/SI_Units.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import Language.Drasil.ShortHands (cOmega)

-- * Lists of Units

-- Keep fundamentals alphabetical.
fundamentals :: [UnitDefn]
fundamentals = [metre, kilogram, second, kelvin, mole, ampere, candela]
fundamentals = [ampere, candela, kelvin, kilogram, metre, mole, second]

-- Derived units must be inserted after every unit they depend on
-- so that `insert0` (Database.Drasil.ChunkDB) can resolve their references.
-- Within each dependency level we keep alphabetical order to make the list easy to audit.
derived :: [UnitDefn]
derived = [becquerel, calorie, centigrade, coulomb, farad, gray, henry, hertz, joule,
katal, kilopascal, kilowatt, litre, lumen, lux, millimetre, newton, ohm,
pascal, radian, siemens, sievert, steradian, tesla, volt, watt, weber]
derived = [becquerel, centigrade, coulomb, hertz, joule, katal, litre,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have these changed order? We should make such changes unless there is a good reason to. Previous were in strict alphabetical order.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this change ensures every derived unit is inserted after the units it depends on.
For example, pascal precedes kilopascal, volt precedes farad/ohm, and weber precedes tesla/henry.

-- | Internal function to insert a chunk into the 'ChunkDB'. This function
-- assumes that the chunk is not already registered in the database, and quietly
-- break table synchronicity if it is.
insert0 :: IsChunk a => ChunkDB -> a -> ChunkDB
checks that all referenced units already exist when a new unit is inserted. The old order triggered missing-dependency errors.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent reason, thank you! You should put in a comment to that effect. I would make sure that the base units are in alphabetical order, and then by dependency (+alphabetical) order after that.

millimetre, newton, pascal, radian, steradian, watt, kilowatt, volt, weber,
tesla, henry, calorie, gray, sievert, kilopascal, lumen, lux, farad, ohm,
siemens]

common :: [UnitDefn]
common = [s_2, m_2, m_3]
Expand Down
9 changes: 7 additions & 2 deletions code/drasil-database/lib/Database/Drasil/ChunkDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,13 @@ insertAllOutOfOrder12 strtr as bs cs ds es fs gs hs is js lcs rs =
fs', gs', hs', is', js']
calt = concat altogether

-- Calculate what chunks are depended on (i.e., UID -> Dependants)
chDpdts = invert $ M.fromList $ map (\c -> (c ^. uid, S.toList $ chunkRefs c)) calt
-- Calculate what chunks are depended on (i.e., UID -> Dependants), but only
-- keep dependencies that correspond to chunks we are actually inserting or
-- that already exist in the chunk table. References/LabelledContent live in
-- separate tables and are handled elsewhere.
allowedDeps = S.fromList (M.keys (chunkTable strtr) ++ map (^. uid) calt)
chDpdts = invert $ M.fromList $
map (\c -> (c ^. uid, S.toList $ S.filter (`S.member` allowedDeps) (chunkRefs c))) calt
Comment on lines +264 to +270
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure I'm understanding this change. Does it not make it so that any chunk dependancy that is neither already in the ChunkDB nor in the list of chunks being added, is ignored? I think this would mean that we can insert chunks into the ChunkDB that have unsatisfied dependencies?


-- Insert all incoming chunks with the existing chunk table, asserting that
-- none of the inserted chunks were already inserted.
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-example/dblpend/lib/Drasil/DblPend/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ symbMap = cdb (map (^. output) iMods ++ symbolsAll) ideaDicts conceptChunks []

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef]
allRefs = externalLinkRef : SRS.sectionReferences ++ map ref (labelledContent ++ funcReqsTables)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this really needed? The fillcdbSRS function should be doing this already for any LabelledContent registered in the ChunkDB. (I'm not saying it should be doing that, only that it currently does that.)


stdFields :: Fields
stdFields = [DefiningEquation, Description Verbose IncludeUnits, Notes, Source, RefBy]
Expand Down
6 changes: 3 additions & 3 deletions code/drasil-example/dblpend/lib/Drasil/DblPend/DataDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import qualified Language.Drasil.Sentence.Combinators as S
import Theory.Drasil (DataDefinition, ddENoRefs, ddMENoRefs)

import Drasil.DblPend.LabelledContent (figMotion)
import Drasil.DblPend.Unitals (pendDisAngle_1, pendDisAngle_2, lenRod_1, lenRod_2, xPos_1, yPos_1, xPos_2, yPos_2)
import Drasil.DblPend.Unitals (forceVec, pendDisAngle_1, pendDisAngle_2, lenRod_1, lenRod_2, xPos_1, yPos_1, xPos_2, yPos_2)
import Drasil.DblPend.Concepts (horizontalPos, verticalPos)
import Data.Drasil.Quantities.Physics (velocity, position, time, acceleration, force)
import Data.Drasil.Quantities.Physics (velocity, position, time, acceleration)
import Data.Drasil.Quantities.PhysicalProperties (mass)

dataDefs :: [DataDefinition]
Expand Down Expand Up @@ -120,7 +120,7 @@ forceGDD :: DataDefinition
forceGDD = ddENoRefs forceGQD Nothing "forceGDD" []

forceGQD :: SimpleQDef
forceGQD = mkQuantDef force forceGEqn
forceGQD = mkQuantDef forceVec forceGEqn

forceGEqn :: PExpr
forceGEqn = vScale (sy mass) (sy acceleration)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module Drasil.DblPend.References (citations, koothoor2013,
smithEtAl2007, smithLai2005, smithKoothoor2016) where

import Language.Drasil
import Data.Drasil.Citations (cartesianWiki, accelerationWiki, velocityWiki,
import Data.Drasil.Citations (accelerationWiki, velocityWiki,
parnasClements1986, hibbeler2004, koothoor2013, smithEtAl2007, smithLai2005,
smithKoothoor2016)

citations :: BibRef
citations = [accelerationWiki, velocityWiki, hibbeler2004, cartesianWiki,
citations = [accelerationWiki, velocityWiki, hibbeler2004,
parnasClements1986, koothoor2013, smithEtAl2007, smithLai2005,
smithKoothoor2016]
9 changes: 7 additions & 2 deletions code/drasil-example/dblpend/lib/Drasil/DblPend/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ unitalChunks = [
lenRod_1, lenRod_2, massObj_1, massObj_2, angularVel_1, angularVel_2,
xVel_1, xVel_2, yVel_1, yVel_2, xPos_1, xPos_2, yPos_1, yPos_2, xAccel_1,
yAccel_1, xAccel_2, yAccel_2, angularAccel_1, angularAccel_2, tension_1,
tension_2, QPP.mass, QP.force, QP.gravitationalAccel, QP.tension, QP.acceleration,
tension_2, QPP.mass, QP.force, forceVec, QP.gravitationalAccel, QP.tension, QP.acceleration,
QP.time, QP.velocity, QP.position]

lenRod_1, lenRod_2, massObj_1, massObj_2, angularVel_1, angularVel_2,
pendDisAngle_1, pendDisAngle_2,
xPos_1, xPos_2, yPos_1, yPos_2, xVel_1, yVel_1, xVel_2, yVel_2, xAccel_1,
yAccel_1, xAccel_2, yAccel_2,
angularAccel_1, angularAccel_2, tension_1, tension_2 :: UnitalChunk
angularAccel_1, angularAccel_2, tension_1, tension_2, forceVec :: UnitalChunk

lenRod_1 = uc' "l_1" (len `ofThe` firstRod)
(D.toSent $ phraseNP (len `the_ofThe` firstRod)) -- Fix me, can have more information
Expand Down Expand Up @@ -186,3 +186,8 @@ pendDisAngle = cuc' "pendDisAngle"
"column vector of displacement of rods with its derivatives"
lTheta' radian (Vect Real)
[physRange $ UpFrom (Inc, exactDbl 0)] (exactDbl 0)

forceVec = uc' "forceVec"
(nounPhraseSP "force vector")
(phrase QP.force `S.ofThe` S "system in vector form")
(vec (prime cF)) (Vect Real) newton
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ abbreviationsList =

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef, pymunk] ++ uriReferences ++ offShelfSolRefs
allRefs = [externalLinkRef, pymunk] ++ SRS.sectionReferences ++ uriReferences ++ offShelfSolRefs

--FIXME: The SRS has been partly switched over to the new docLang, so some of
-- the sections below are now redundant. I have not removed them yet, because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ module Drasil.GamePhysics.References where

import Language.Drasil

import Data.Drasil.Citations (cartesianWiki, koothoor2013,
import Data.Drasil.Citations (koothoor2013,
parnasClements1986, smithEtAl2007, smithLai2005, smithKoothoor2016,
lineSource, pointSource, dampingSource)
dampingSource)
import Data.Drasil.People (bWaugh, cTitus, dParnas, daAruliah, epWhite, gWilson,
imMitchell, jBueche, kdHuff, mDavis, mdPlumblet, nChueHong, pWilson, rGuy, shdHaddock,
wikiAuthors)
Expand All @@ -15,7 +15,7 @@ chaslesWiki, jfBeucheIntro, parnas1978, sciComp2013 :: Citation
citations :: BibRef
citations = [parnas1978, sciComp2013, chaslesWiki, parnasClements1986,
koothoor2013, smithEtAl2007, smithLai2005, smithKoothoor2016, jfBeucheIntro,
cartesianWiki, lineSource, pointSource, dampingSource]
dampingSource]

--FIXME: check for references made within document

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Drasil.GlassBR.Assumptions (assumpGT, assumpGC, assumpES, assumpSV,
import Language.Drasil hiding (organization)
import qualified Language.Drasil.Development as D
import qualified Drasil.DocLang.SRS as SRS (valsOfAuxCons)
import Control.Lens (view)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.NounPhrase.Combinators as NP
import qualified Language.Drasil.Sentence.Combinators as S
Expand Down Expand Up @@ -68,7 +69,7 @@ standardValuesDesc :: UnitalChunk -> Sentence
standardValuesDesc mainIdea = foldlSent [D.toSent $ atStartNP' (the value), S "provided in",
refS $ SRS.valsOfAuxCons ([]::[Contents]) ([]::[Section]), S "are assumed for the", phrase mainIdea,
sParen (ch mainIdea) `sC` S "and the", plural materialProprty `S.of_`
foldlList Comma List (map ch (take 3 assumptionConstants))]
foldlList Comma List (map (ch . view defLhs) assumptionConstants)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take 3 was a hack, but I'm concerned that this will actually change stable?


glassLiteDesc :: Sentence
glassLiteDesc = foldlSent [atStart glass, S "under consideration is assumed to be a single",
Expand Down
16 changes: 10 additions & 6 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Drasil.Metadata as M (dataDefn, inModel, thModel)
import Drasil.SRSDocument
import Drasil.DocLang (auxSpecSent, termDefnF')
import Drasil.Generator (cdb)
import qualified Drasil.DocLang.SRS as SRS (reference, assumpt, inModel)
import qualified Drasil.DocLang.SRS as SRS (reference, assumpt, inModel, sectionReferences)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import Drasil.System (SystemKind(Specification), mkSystem)
Expand Down Expand Up @@ -114,10 +114,14 @@ background = foldlSent_ [phrase explosion, S "in downtown areas are dangerous fr

ideaDicts :: [IdeaDict]
ideaDicts =
-- IdeaDicts
[lateralLoad, materialProprty] ++ con' ++
-- CIs
map nw [progName, iGlass, lGlass] ++ map nw mathcon'
filter (\idc -> (idc ^. uid) `notElem` conceptChunkUIDs) baseIdeaDicts
where
baseIdeaDicts =
-- IdeaDicts
[lateralLoad, materialProprty] ++ con' ++
-- CIs
map nw [progName, iGlass, lGlass] ++ map nw mathcon'
conceptChunkUIDs = map (^. uid) conceptChunks

conceptChunks :: [ConceptChunk]
conceptChunks =
Expand All @@ -139,7 +143,7 @@ symbMap = cdb thisSymbols ideaDicts conceptChunks ([] :: [UnitDefn])

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef]
allRefs = externalLinkRef : SRS.sectionReferences ++ map ref (funcReqsTables ++ figures)

concIns :: [ConceptInstance]
concIns = assumptions ++ goals ++ likelyChgs ++ unlikelyChgs ++ funcReqs ++ nonfuncReqs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
module Drasil.GlassBR.References where
module Drasil.GlassBR.References (
citations,
astm2009, astm2012, astm2016, beasonEtAl1998
) where

import Language.Drasil

import Data.Drasil.Citations (campidelli, koothoor2013, smithEtAl2007,
smithLai2005, smithKoothoor2016, parnasClements1986)
import Data.Drasil.Citations (campidelli, koothoor2013,
smithEtAl2007, smithLai2005, smithKoothoor2016, parnasClements1986)
import Data.Drasil.People (jmBracci, tlKohutek, wlBeason)

astm2009, astm2016, astm2012, beasonEtAl1998 :: Citation
Expand Down
10 changes: 6 additions & 4 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Symbols.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module Drasil.GlassBR.Symbols where

import Language.Drasil (DefinedQuantityDict, dqdWr, cnstrw')
import Language.Drasil (DefinedQuantityDict, dqdWr, cnstrw', defLhs)
import Language.Drasil.Code (Mod(Mod), asVC)

import Drasil.GlassBR.ModuleDefs (allMods, implVars)
import Drasil.GlassBR.Assumptions (assumptionConstants)
import Drasil.GlassBR.Unitals (specParamVals, modElas,
tmSymbols, interps, derivedInputDataConstraints, unitless, probBr,
stressDistFac, nomThick, sdVector, inputsWUnitsUncrtn, inputsWUncrtn,
glassTypeCon, unitalSymbols)
glassTypeCon, unitalSymbols, loadDur)

import Data.List ((\\))
import Control.Lens (view)

symbolsForSymbolTable :: [DefinedQuantityDict]
symbolsForSymbolTable = symbolsForTermTable ++ map dqdWr unitalSymbols ++
Expand All @@ -18,8 +20,8 @@ symbolsForSymbolTable = symbolsForTermTable ++ map dqdWr unitalSymbols ++

symbolsForTermTable :: [DefinedQuantityDict]
symbolsForTermTable = map dqdWr inputsWUnitsUncrtn ++ map dqdWr inputsWUncrtn ++
map dqdWr sdVector ++ tmSymbols ++ map dqdWr specParamVals ++
[dqdWr modElas] ++ interps
map dqdWr sdVector ++ tmSymbols ++ dqdWr loadDur : map (view defLhs) specParamVals ++
map (view defLhs) assumptionConstants ++ [dqdWr modElas] ++ interps

-- include all module functions as symbols
thisSymbols :: [DefinedQuantityDict]
Expand Down
8 changes: 6 additions & 2 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ lFail = label "f"
lTol = label "tol"

concepts :: [ConceptChunk]
concepts = [glBreakage, lite, annealedGl, fTemperedGl, hStrengthGl, lateral,
concepts = [glBreakage, lite, annealedGl, laminatedGl, fTemperedGl, hStrengthGl, lateral,
specDeLoad, longDurLoad, glassWL, shortDurLoad, specA, blastResisGla, blast,
blastTy, glassGeo, safeMessage, notSafe, bomb, explosion]

aspectRatioCon, glBreakage, lite, glassTy, annealedGl, fTemperedGl, hStrengthGl,
aspectRatioCon, glBreakage, lite, glassTy, annealedGl, laminatedGl, fTemperedGl, hStrengthGl,
glTyFac, lateral, load, specDeLoad, loadDurFac, loadResis, longDurLoad, modE, nonFactoredL,
glassWL, shortDurLoad, loadShareFac, probBreak, specA, blastResisGla, eqTNTChar,
sD, blast, blastTy, glassGeo, capacity, demandq, safeMessage, notSafe, bomb,
Expand Down Expand Up @@ -343,6 +343,10 @@ fTemperedGl = cc' fullyT
S "been subjected to a special heat treatment process where the residual",
S "surface compression is not less than 69 MPa (10 000 psi) or the edge",
S "compression not less than 67 MPa (9700 psi), as defined in", refS astm2012])
laminatedGl = cc' lGlass
(foldlSent_ [S "glass composed of two or more plies bonded together with an interlayer",
S "to improve strength and safety characteristics, particularly for blast resistant",
S "applications"])
glassGeo = dccWDS "glassGeo" (cnIES "glass geometry")
(S "the glass geometry based inputs include the dimensions of the" +:+
foldlList Comma List [phrase glaPlane, phrase glassTy, phrase responseTy])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Language.Drasil
import Drasil.Metadata (dataDefn)
import Drasil.SRSDocument
import Drasil.Generator (cdb)
import qualified Drasil.DocLang.SRS as SRS (inModel)
import qualified Drasil.DocLang.SRS as SRS (inModel, sectionReferences)
import qualified Language.Drasil.Sentence.Combinators as S
import Drasil.System (SystemKind(Specification), mkSystem)

Expand Down Expand Up @@ -141,7 +141,7 @@ symbMap = cdb (map dqdWr physicscon ++ symbolsAll ++ [dqdWr mass, dqdWr posInf,

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef]
allRefs = externalLinkRef : SRS.sectionReferences ++ map ref (labelledContent ++ funcReqsTables)

abbreviationsList :: [IdeaDict]
abbreviationsList =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import Data.Drasil.Concepts.Physics (acceleration, collision, distance, gravity,
import Drasil.Projectile.Concepts (launcher, projectile, target, projMotion)

assumptions :: [ConceptInstance]
assumptions = [twoDMotion, cartSyst, yAxisGravity, launchOrigin, targetXAxis,
posXDirection, constAccel, accelXZero, accelYGravity, neglectDrag, pointMass,
freeFlight, neglectCurv, timeStartZero, gravAccelValue]
-- Order matters: each assumption appears after those it references so generated SRS links work.
assumptions = [twoDMotion, neglectCurv, cartSyst, yAxisGravity, accelYGravity,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the reorder?

Copy link
Collaborator Author

@Xinlu-Y Xinlu-Y Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reorder the assumptions so that each assumption appears after any other assumptions it refers to in its description.

In Assumptions.hs, some assumptions use fromSource or fromSources to refer to other assumptions.
These functions automatically create clickable links in the generated SRS document.
However, in the old order, some of those links pointed forward to assumptions that hadn’t been listed yet, so the links appeared but didn’t work when clicked.

The new order ensures that all referenced assumptions are introduced before they are linked.
For example:

  • neglectCurv now comes before cartSyst
  • accelXZero, accelYGravity, neglectDrag, and freeFlight now come before constAccel

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Please add a comment to that effect. (And everywhere else you did this.)

launchOrigin, targetXAxis, posXDirection, neglectDrag, pointMass,
freeFlight, accelXZero, constAccel, timeStartZero, gravAccelValue]

twoDMotion, cartSyst, yAxisGravity, launchOrigin, targetXAxis,
posXDirection, constAccel, accelXZero, accelYGravity, neglectDrag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ abbreviationsList =

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef]
allRefs = externalLinkRef : SRS.sectionReferences ++ map ref (labelledContent ++ funcReqsTables)

stdFields :: Fields
stdFields = [DefiningEquation, Description Verbose IncludeUnits, Notes, Source, RefBy]
Expand Down Expand Up @@ -293,4 +293,3 @@ constrained = [flightDur, landPos, launAngle, launSpeed, offset, targPos]
acronyms :: [CI]
acronyms = [oneD, twoD, assumption, dataDefn, genDefn, goalStmt, inModel,
physSyst, requirement, Doc.srs, refBy, refName, thModel, typUnc]

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Drasil.Projectile.References where

import Language.Drasil
import Data.Drasil.Citations (cartesianWiki, accelerationWiki, velocityWiki,
import Data.Drasil.Citations (accelerationWiki, velocityWiki,
hibbeler2004, parnasClements1986, koothoor2013, smithKoothoor2016, smithEtAl2007,
smithLai2005)

citations :: BibRef
citations = [accelerationWiki, velocityWiki, hibbeler2004, cartesianWiki,
citations = [accelerationWiki, velocityWiki, hibbeler2004,
parnasClements1986, koothoor2013, smithKoothoor2016, smithEtAl2007,
smithLai2005]
2 changes: 1 addition & 1 deletion code/drasil-example/sglpend/lib/Drasil/SglPend/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ symbMap = cdb (map (^. output) iMods ++ symbols) ideaDicts conceptChunks []

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef]
allRefs = externalLinkRef : SRS.sectionReferences ++ map ref (labelledContent ++ funcReqsTables)

concIns :: [ConceptInstance]
concIns = assumpSingle ++ goals ++ funcReqs ++ nonFuncReqs
Expand Down
15 changes: 9 additions & 6 deletions code/drasil-example/ssp/lib/Drasil/SSP/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import qualified Language.Drasil.Development as D
import Drasil.SRSDocument
import Drasil.Generator (cdb)
import qualified Drasil.DocLang.SRS as SRS (inModel, assumpt,
genDefn, dataDefn, datCon)
genDefn, dataDefn, datCon, sectionReferences)
import Drasil.Metadata (inModel)
import Drasil.System (SystemKind(Specification), mkSystem)

Expand Down Expand Up @@ -114,12 +114,15 @@ purp = foldlSent_ [S "evaluate the", phrase fs `S.ofA` phrasePoss slope,
S "as well as the", phrase intrslce, D.toSent (phraseNP (normForce `and_` shearForce)),
S "along the", phrase crtSlpSrf]

labeledWithReqs :: [LabelledContent]
labeledWithReqs = funcReqTables ++ figures

figures :: [LabelledContent]
figures = [sysCtxFig1, figPhysSyst, figIndexConv, figForceActing]

concIns :: [ConceptInstance]
concIns = goals ++ assumptions ++ funcReqs ++ nonFuncReqs ++ likelyChgs ++ unlikelyChgs

labCon :: [LabelledContent]
labCon = [figPhysSyst, figIndexConv, figForceActing, sysCtxFig1] ++ funcReqTables

stdFields :: Fields
stdFields = [DefiningEquation, Description Verbose IncludeUnits, Notes, Source, RefBy]

Expand All @@ -142,7 +145,7 @@ conceptChunks =

symbMap :: ChunkDB
symbMap = cdb symbols ideaDicts conceptChunks
[degree] dataDefs iMods generalDefinitions tMods concIns citations labCon allRefs
[degree] dataDefs iMods generalDefinitions tMods concIns citations labeledWithReqs allRefs

abbreviationsList :: [IdeaDict]
abbreviationsList =
Expand All @@ -155,7 +158,7 @@ abbreviationsList =

-- | Holds all references and links used in the document.
allRefs :: [Reference]
allRefs = [externalLinkRef, weightSrc, hsPressureSrc]
allRefs = externalLinkRef : weightSrc : hsPressureSrc : SRS.sectionReferences ++ map ref labeledWithReqs

-- SECTION 1 --
--automatically generated in mkSRS -
Expand Down
3 changes: 2 additions & 1 deletion code/drasil-example/swhs/lib/Drasil/SWHS/Assumptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ import Drasil.SWHS.Unitals (wVol, volHtGen, tempC, tempInit, tempW,
-------------------------

assumptions :: [ConceptInstance]
-- Order matters: each assumption appears after those it references so generated SRS links work.
assumptions = [assumpTEO, assumpHTCC, assumpCWTAT, assumpTPCAV, assumpDWPCoV, assumpSHECoV,
assumpLCCCW, assumpTHCCoT, assumpTHCCoL, assumpLCCWP, assumpCTNOD, assumpSITWP,
assumpLCCCW, assumpTHCCoT, assumpTHCCoL, assumpLCCWP, assumpSITWP, assumpCTNOD,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-order?

assumpPIS, assumpWAL, assumpPIT, assumpNIHGBWP, assumpVCMPN, assumpNGSP,
assumpAPT, assumpVCN]

Expand Down
Loading