Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
952a528
clean auto abbrv extraction code
Sep 7, 2025
6de9dc5
stable
Sep 7, 2025
04fd9af
deleted abbreviationsList
Sep 7, 2025
a3d111d
fixed code errors
Sep 7, 2025
d49a098
deleted acronyms def
Sep 7, 2025
d45194d
fixed unused imports errors
Sep 7, 2025
30d057a
capitalize long abbreviation forms in the TAandA
Sep 8, 2025
d07b293
added missing abbrvs with an additional paragraph in the Org of Docum…
Sep 8, 2025
41f6823
missing abrv displayed
Sep 8, 2025
4ae1045
removed all occurences of collectDocAbbrv from examples body.hs
Sep 8, 2025
c072676
removed unecessary modules exposure
Sep 8, 2025
0d78660
line up fix
Sep 9, 2025
f08e6e8
restored deleted comments
Sep 9, 2025
0a8ece9
moved select to SearchTools file
Sep 9, 2025
dc1f995
stable
Sep 9, 2025
621dd63
mkSRS declaration fixed
Sep 9, 2025
63be539
Merge branch 'main' into tableAccAbbS
balacij Sep 10, 2025
9671d48
move extra paragraph in dblpend (for adding abbreviation declarations…
balacij Sep 10, 2025
fb244cc
remove 'select' function and adjust comment on 'tableAbbAccGen'
balacij Sep 10, 2025
4af33a2
dig deeper when looking for abbreviations
balacij Sep 10, 2025
0ec56d8
dig even deeper when looking for abbreviations
balacij Sep 11, 2025
b61d696
force more usage of refBy (CI)
balacij Sep 11, 2025
3239231
must dig even deeper when looking for abbreviations
balacij Sep 11, 2025
2ac256d
comment on getDocDesc
balacij Sep 11, 2025
ee80178
space removal, a minor code touch-up, and commentary
balacij Sep 11, 2025
f90609d
Remove grabbing too many UIDs when looking only for UIDs for chunks w…
balacij Sep 12, 2025
cecbd9d
Move to 2 layer document section rendering
balacij Sep 13, 2025
6a1e11f
closing in on what's going awry
balacij Sep 15, 2025
344298a
debugging getUIDshort
balacij Sep 15, 2025
3c8b565
remove 'trace'-based debugging code
balacij Sep 16, 2025
8d80f11
remove unrelated code changes
balacij Sep 16, 2025
2f77800
introduce (un)likely changes abbreviation
balacij Sep 16, 2025
1c23862
remove double periods in abbreviation/acronym intruction paragraph
balacij Sep 16, 2025
a6c3611
Use introduceAbbPlrl to introduce abbreviations
balacij Sep 16, 2025
d517a94
glassbr: use load duration factor short form
balacij Sep 16, 2025
3268f3d
pdcontroller: fix a few missing short form uses
balacij Sep 16, 2025
79d6863
Remove table of abbreviations abb/abb filtration based on abb/acc equ…
balacij Sep 19, 2025
e040350
Merge branch 'main' into tableAccAbbS
balacij Sep 22, 2025
77b87ea
Merge branch 'main' into rmPDConDervCI
balacij Sep 22, 2025
7639a88
Merge branch 'rmPDConDervCI' into tableAccAbbS
balacij Sep 22, 2025
7e22c99
Merge branch 'main' into tableAccAbbS
balacij Sep 23, 2025
b4c4c73
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Oct 27, 2025
e8defbd
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Oct 27, 2025
dda29d9
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Oct 27, 2025
f73fb86
Add a cheap hack for injecting Refname in the Tab. of A. and A.s
balacij Oct 28, 2025
951208d
Avoid pattern matching on `EmptyS`.
balacij Oct 28, 2025
2c0c928
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Nov 3, 2025
e249f93
Fix 'typical uncertainties' plural form capture and clean up Sentence…
balacij Nov 3, 2025
d2ed561
Fix ambiguous imports in Projectile
balacij Nov 3, 2025
a6dccc7
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Nov 4, 2025
4b811fa
Remove ununecessary no-unused-top-binds pragma
balacij Nov 5, 2025
17f6cd0
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Nov 5, 2025
b362518
Add labelledContent back to SWHSNoPCM's ChunkDB.
balacij Nov 5, 2025
78a9845
Add comments to new utils and avoid ++ in splitAtAll
balacij Nov 5, 2025
f5b45e7
Remove duplicated comment
balacij Nov 5, 2025
9c40fb2
Remove trailing whitespace again...
balacij Nov 5, 2025
248e342
Remove commented out code
balacij Nov 5, 2025
d022a3c
Minimize diff to load duration factor
balacij Nov 5, 2025
c6b93fb
Merge branch 'main' of github.com:JacquesCarette/Drasil into tableAcc…
balacij Jan 28, 2026
f0a0bb5
Clean up leftover code in merge.
balacij Jan 28, 2026
c832dc2
Add RefBy to rnHACK to get 'Referenced by' acronym in TabAccAbb
balacij Jan 28, 2026
8f2b731
Hopefully fix build by removing duplicate export.
balacij Jan 28, 2026
7d7aa62
Remove paragraph used to force in acronym gathering for TabAbbAcc
balacij Jan 28, 2026
ea0ecb4
Only titleize nouns on abbreviation/acronym introduction for proper
balacij Jan 28, 2026
e21e16f
Merge branch 'introduceAbb' of github.com:JacquesCarette/Drasil into …
balacij Jan 28, 2026
b76a720
Fix introduceAbbPlrl + stabilize
balacij Jan 28, 2026
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
6 changes: 3 additions & 3 deletions code/drasil-data/lib/Data/Drasil/Concepts/Documentation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ doccon = [abbAcc, abbreviation, acronym, analysis, appendix, aspect, body,
-- | Collects all documentation-related common ideas (like a concept, but with no definition).
doccon' :: [CI]
doccon' = [assumption, dataConst, dataDefn, desSpec, genDefn, goalStmt, inModel,
likelyChg, learnObj, mg, mis, notebook, physSyst, requirement, srs, thModel, typUnc,
unlikelyChg]
likelyChg, learnObj, mg, mis, physSyst, requirement, srs, thModel, typUnc,
unlikelyChg, notebook, refBy, refName]

assumption, desSpec, goalStmt, dataConst, likelyChg, learnObj, unlikelyChg, physSyst,
mg, mis, typUnc, sec, refBy, refName :: CI
Expand All @@ -74,7 +74,7 @@ unlikelyChg = commonIdeaWithDict "unlikelyChg" (cn' "unlikely change")
physSyst = commonIdeaWithDict "physSyst" (combineNINI physicalSystem description) "PS" [softEng]
mis = commonIdeaWithDict "mis" (fterms compoundPhrase moduleInterface specification) "MIS" [softEng]
mg = commonIdeaWithDict "mg" (fterms compoundPhrase module_ guide) "MG" [softEng]
typUnc = commonIdeaWithDict "typUnc" (cn' "typical uncertainty") "Uncert." [softEng]
typUnc = commonIdeaWithDict "typUnc" (cnIES "typical uncertainty") "Uncert." [softEng]
sec = commonIdeaWithDict "section" (cn' "section") "Sec" [documentc]
refBy = commonIdeaWithDict "refBy" (cn "referenced by") "RefBy" [documentc]
refName = commonIdeaWithDict "refName" (cn' "reference name") "Refname" [documentc]
Expand Down
68 changes: 50 additions & 18 deletions code/drasil-docLang/lib/Drasil/DocumentLanguage.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# Language TupleSections #-}
{-# Language TupleSections, LambdaCase #-}
---------------------------------------------------------------------------
-- | Start the process of moving away from Document as the main internal
-- representation of information, to something more informative.
Expand All @@ -10,7 +10,7 @@ module Drasil.DocumentLanguage (mkDoc, findAllRefs) where
import Control.Lens ((^.), set)
import Data.Function (on)
import Data.List (nub, sortBy)
import Data.Maybe (maybeToList, mapMaybe)
import Data.Maybe (maybeToList, mapMaybe, isJust)
import qualified Data.Map as Map (keys)

import Drasil.DocDecl (SRSDecl, mkDocDesc)
Expand All @@ -25,15 +25,17 @@ import Drasil.DocumentLanguage.Core (AppndxSec(..), AuxConstntSec(..),
import Drasil.DocumentLanguage.Definitions (ddefn, derivation, instanceModel,
gdefn, tmodel)
import Drasil.Document.Contents(mkEnumSimpleD, foldlSP)
import Drasil.ExtractDocDesc (getDocDesc, egetDocDesc)
import Drasil.ExtractDocDesc (getDocDesc, egetDocDesc, getSec)
import Drasil.TraceTable (generateTraceMap)

import Language.Drasil
import Language.Drasil.Display (compsy)
import Utils.Drasil (splitAtAll, mergeAll)

import Drasil.Database (findOrErr, ChunkDB, insertAll, UID, HasUID(..), invert)
import Drasil.Database.SearchTools (findAllDataDefns, findAllGenDefns,
findAllInstMods, findAllTheoryMods, findAllConcInsts, findAllLabelledContent)
findAllInstMods, findAllTheoryMods, findAllConcInsts, TermAbbr, shortForm,
termResolve', findAllLabelledContent)

import Drasil.System (System(SI), whatsTheBigIdea, _systemdb, HasSystem(..))
import Drasil.GetChunks (ccss, ccss', citeDB)
Expand Down Expand Up @@ -66,11 +68,12 @@ import Drasil.DocumentLanguage.TraceabilityGraph (traceyGraphGetRefs, genTraceGr
import Drasil.Sections.TraceabilityMandGs (traceMatStandard)
import Drasil.Sections.ReferenceMaterial (emptySectSentPlu)

import Drasil.Metadata as Doc (software)
import qualified Data.Drasil.Concepts.Documentation as Doc (likelyChg, section_,
unlikelyChg)
import Drasil.Metadata (software, dataDefn, genDefn, inModel, thModel, requirement)
import Data.Drasil.Concepts.Documentation (likelyChg, section_, unlikelyChg, assumption, goalStmt, refName, refBy)
import qualified Data.Map.Strict as M

import Language.Drasil.Development (shortdep)

-- * Main Function

-- | Creates a document from a 'System', a document description ('SRSDecl'), and
Expand Down Expand Up @@ -177,11 +180,27 @@ getUnitLup m c = getUnit (findOrErr (c ^. uid) m :: DefinedQuantityDict)

-- | Helper for creating the different document sections.
mkSections :: System -> DocDesc -> [Section]
mkSections si dd = map doit dd
mkSections si dd =
let
splitByTAandA :: [[DocSection]]
Copy link
Owner

Choose a reason for hiding this comment

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

I think this code should be refactored into even more generic kit. What you are doing is creating a 'view' (in this case, zooming in to RefSec), mapping onto one side of that view, and then putting everything back together.

A more refined way to do this would take a function (a -> Either b c) instead of a predicate, then two functions (b -> d) and (c -> d) for each side, then you could unEither. In the case below, it would actually be (a -> Either b a) and the function on the False stuff would be id.

refSecPlans :: [DocSection]
(splitByTAandA, refSecPlans) = splitAtAll (\case {RefSec _ -> True; _ -> False}) dd

splitSecs :: [[Section]]
splitSecs = map (map doit) splitByTAandA

refSecs :: [Section]
refSecs = map
(\case {
RefSec rs -> mkRefSec si dd rs $ concat splitSecs;
_ -> error "A non-RefSec got captured in the RefSecs list!"})
refSecPlans
in
mergeAll splitSecs refSecs
where
doit :: DocSection -> Section
doit TableOfContents = mkToC dd
doit (RefSec rs) = mkRefSec si dd rs
doit (RefSec _) = error "RefSecs should have been filtered out!"
doit (IntroSec is) = mkIntroSec si is
doit (StkhldrSec sts) = mkStkhldrSec sts
doit (SSDSec ss) = mkSSDSec si ss
Expand All @@ -207,8 +226,8 @@ mkToC dd = SRS.tOfCont [intro, UlC $ ulcc $ Enumeration $ Bullet $ map ((, Nothi

-- | Helper for creating the reference section and subsections.
-- Includes Table of Symbols, Units and Abbreviations and Acronyms.
mkRefSec :: System -> DocDesc -> RefSec -> Section
mkRefSec si dd (RefProg c l) = SRS.refMat [c] (map (mkSubRef si) l)
mkRefSec :: System -> DocDesc -> RefSec -> [Section] -> Section
mkRefSec si dd (RefProg c l) renderedSecs = SRS.refMat [c] (map (mkSubRef si) l)
where
mkSubRef :: System -> RefTab -> Section
mkSubRef si' TUnits = mkSubRef si' $ TUnits' defaultTUI tOfUnitSIName
Expand All @@ -224,11 +243,24 @@ mkRefSec si dd (RefProg c l) = SRS.refMat [c] (map (mkSubRef si) l)
mkSubRef SI {_systemdb = cdb} (TSymb' f con) =
mkTSymb (ccss (getDocDesc dd) (egetDocDesc dd) cdb) f con

mkSubRef _ (TAandA ideas) =
mkSubRef SI {_systemdb = cdb} TAandA =
SRS.tOfAbbAcc
[LlC $ tableAbbAccGen $ nub ideas]
[LlC $ tableAbbAccGen $ collectDocumentAbbreviations renderedSecs cdb]
[]

collectDocumentAbbreviations :: [Section] -> ChunkDB -> [TermAbbr]
collectDocumentAbbreviations renderedSecs cdb =
filter (isJust . shortForm) allTerms
where
-- Terms found in the document using the list of `Sentence`s extracted from
-- the sections.
foundInDoc = concatMap shortdep $ concatMap getSec renderedSecs
-- Terms that could not be found in `Sentence`s, but are important to
-- include in the table of abbreviations and acronyms.
missingFromDocHACK = map (^. uid) [assumption, dataDefn, genDefn, goalStmt,
inModel, requirement, thModel, refName, refBy]
allTerms = map (termResolve' cdb) $ nub (foundInDoc ++ missingFromDocHACK)

-- | Helper for creating the table of symbols.
mkTSymb :: (Quantity e, Concept e, Eq e, MayHaveUnit e) =>
[e] -> LFunc -> [TSIntro] -> Section
Expand Down Expand Up @@ -344,19 +376,19 @@ mkReqrmntSec (ReqsProg l) = R.reqF $ map mkSubs l

-- | Helper for making the Likely Changes section.
mkLCsSec :: LCsSec -> Section
mkLCsSec (LCsProg c) = SRS.likeChg (introChgs Doc.likelyChg c: mkEnumSimpleD c) []
mkLCsSec (LCsProg c) = SRS.likeChg (introChgs likelyChg c: mkEnumSimpleD c) []

-- ** Unlikely Changes

-- | Helper for making the Unikely Changes section.
mkUCsSec :: UCsSec -> Section
mkUCsSec (UCsProg c) = SRS.unlikeChg (introChgs Doc.unlikelyChg c : mkEnumSimpleD c) []
mkUCsSec (UCsProg c) = SRS.unlikeChg (introChgs unlikelyChg c : mkEnumSimpleD c) []

-- | Intro paragraph for likely and unlikely changes
introChgs :: NamedIdea n => n -> [ConceptInstance] -> Contents
introChgs :: Idea n => n -> [ConceptInstance] -> Contents
introChgs xs [] = mkParagraph $ emptySectSentPlu [xs]
introChgs xs _ = foldlSP [S "This", phrase Doc.section_, S "lists the",
plural xs, S "to be made to the", phrase Doc.software]
introChgs xs _ = foldlSP [S "This", phrase section_, S "lists the",
introduceAbbPlrl xs, S "to be made to the", phrase software]

-- ** Traceability

Expand Down
4 changes: 2 additions & 2 deletions code/drasil-docLang/lib/Drasil/DocumentLanguage/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ data RefTab where
-- | Allows Lens functions in addition to an introduction for a table of symbols.
TSymb' :: LFunc -> [TSIntro] -> RefTab
-- | Default.
TAandA :: [IdeaDict] -> RefTab
TAandA :: RefTab
-- add more here

-- | For creating a table of symbols introduction
Expand Down Expand Up @@ -113,7 +113,7 @@ data IntroSub where
-- | Describes characteristics of the system.
IChar :: [Sentence] -> [Sentence] -> [Sentence] -> IntroSub
-- | Organises the section.
IOrgSec :: CI -> Section -> Sentence -> IntroSub
IOrgSec :: CI -> Section -> Maybe Sentence -> IntroSub

-- ** Stakeholders Section

Expand Down
68 changes: 47 additions & 21 deletions code/drasil-docLang/lib/Drasil/ExtractDocDesc.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{-# LANGUAGE LambdaCase, Rank2Types #-}
-- | Defines functions to extract certain kinds of information from a document.
-- Mainly used to pull the 'UID's of chunks out of 'Sentence's and 'Expr's.
module Drasil.ExtractDocDesc (getDocDesc, egetDocDesc, sentencePlate) where
module Drasil.ExtractDocDesc (
getDocDesc, egetDocDesc,
sentencePlate,
getSec
) where

import Control.Lens((^.))
import Data.Functor.Constant (Constant(Constant))
import Data.Generics.Multiplate (appendPlate, foldFor, purePlate, preorderFold)

import Drasil.DocumentLanguage.Core
import Drasil.Sections.SpecificSystemDescription (inDataConstTbl, outDataConstTbl)
import Language.Drasil hiding (Manual, Verb)
import Theory.Drasil

import Data.Functor.Constant (Constant(Constant))
import Data.Generics.Multiplate (appendPlate, foldFor, purePlate, preorderFold)
import Data.Maybe (maybeToList)

-- | Creates a section contents plate that contains diferrent system subsections.
secConPlate :: Monoid b => (forall a. HasContents a => [a] -> b) ->
Expand All @@ -20,8 +25,6 @@ secConPlate mCon mSec = preorderFold $ purePlate {
introSub = Constant <$> \case
(IOrgSec _ s _) -> mSec [s]
_ -> mempty,
--gsdSec = Constant <$> \case
-- (GSDProg _) -> mempty,
gsdSub = Constant <$> \case
(SysCntxt c) -> mCon c
(UsrChars c) -> mCon c
Expand Down Expand Up @@ -100,33 +103,33 @@ egetCon _ = []
sentencePlate :: Monoid a => ([Sentence] -> a) -> DLPlate (Constant a)
sentencePlate f = appendPlate (secConPlate (f . concatMap getCon') $ f . concatMap getSec) $
preorderFold $ purePlate {
introSec = Constant . f <$> \(IntroProg s1 s2 _) -> [s1, s2],
introSec = Constant . f <$> \(IntroProg s1 s2 s3) -> [s1, s2] ++ concatMap getIntroSub s3,
Copy link
Collaborator

Choose a reason for hiding this comment

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

sentencePlate collects "all" sentences that a renderer would project from a DocDesc (a document description). What sentencePlate is really here for, is for us to check that for all Sentences in a document, we can scan them for the references chunks (notably, symbols, units, and abbreviations) to make sure that they're all either registered already and unique (i.e., the symbols and units) or just to plainly query for them (i.e., this PR, the abbreviations). The problem with this approach is that some Sentence production happens 'too late' -- i.e., it happens in the renderer code. Any of the _s that I've left in the pattern matches of sentencePlate indicate something that contains things that would go into Sentences that we cannot look into. The majority of them are CIs (i.e., things known to have abbreviations!), but I will comment when this is not the case.

introSub = Constant . f <$> \case
(IPurpose s) -> s
(IScope s) -> [s]
(IChar s1 s2 s3) -> concat [s1, s2, s3]
(IOrgSec _ _ s1) -> [s1],
(IOrgSec _ s1 s2) -> maybeToList s2 ++ getSec s1,
stkSub = Constant . f <$> \case
(Client _ s) -> [s]
(Cstmr _) -> [],
pdSec = Constant . f <$> \(PDProg s _ _) -> [s],
pdSec = Constant . f <$> \(PDProg s secs pds) -> s : concatMap getSec secs ++ concatMap getPDSub pds,
pdSub = Constant . f <$> \case
(TermsAndDefs Nothing cs) -> def cs
(TermsAndDefs (Just s) cs) -> s : def cs
(PhySysDesc _ s _ _) -> s
(PhySysDesc _ s lc cs) -> s ++ getLC lc ++ getC cs
(Goals s c) -> s ++ def c,
scsSub = Constant . f <$> \case
(Assumptions c) -> def c
(TMs s _ t) -> let r = (<>) s . concatMap (\x -> def (x ^. operations) ++
def (x ^. defined_quant) ++ notes [x] ++
r (x ^. valid_context)) in r t
(DDs s _ d _) -> s ++ der d ++ notes d
(GDs s _ d _) -> def d ++ s ++ der d ++ notes d
(GDs s _ d _) -> s ++ def d ++ der d ++ notes d
(IMs s _ d _) -> s ++ der d ++ notes d
Copy link
Collaborator

Choose a reason for hiding this comment

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

For lines 122 - 127, the first _ indicates Field:

-- | Fields that should be displayed in definitions.
data Field = Label
| Symbol
| Units
| DefiningEquation
| Description Verbosity InclUnits
| Input
| Output
| InConstraints
| OutConstraints
| Notes
| Source -- I think using attribute makes most sense, as sources can and
-- will be modified across applications; the underlying knowledge won't.
| RefBy --TODO: Fill in the field.

The problem with Field is that they're not tied to a CI or IdeaDict. They're rendered through a Show instance:

mkTMField t m l@RefBy fs = (show l, [mkParagraph $ helperRefs t m]) : fs --FIXME: fill this in

-- | Defines 'Field's as 'String's.
instance Show Field where
show Label = "Label"
show Symbol = "Symbol"
show Units = "Units"
show RefBy = "RefBy"
show Source = "Source"
show Input = "Input"
show Output = "Output"
show InConstraints = "Input Constraints"
show OutConstraints = "Output Constraints"
show DefiningEquation = "Equation"
show (Description _ _) = "Description"
show Notes = "Notes"

So, even if we wanted to scan the generated tables for sentences or UIDs of chunks we input into sentences, we wouldn't have a UID to scan for. This results in at least Refname being impossible to scan for (because it is not related to a chunk we scan for):

Scanning for "Refname" in the codebase shows we just use the string raw, mostly, except for the one CI:

 ~/Programming/Drasil/code/ tableAccAbbS rg "Refname" -ths
drasil-data/lib/Data/Drasil/Concepts/Documentation.hs
87:refName     = commonIdeaWithDict "refName"     (cn' "reference name")                                "Refname" [documentc]

drasil-printers/lib/Language/Drasil/JSON/Print.hs
253:  (tr (nbformat (th (text "Refname")) $$ td (nbformat(bold l))) $$ makeDRows ps)

drasil-printers/lib/Language/Drasil/HTML/Print.hs
299:  (tr (th (text "Refname") $$ td (bold l)) $$ makeDRows ps)

drasil-printers/lib/Language/Drasil/TeX/Print.hs
344:  command0 "toprule " <> bold (pure $ text "Refname") <> pure (text " & ") <> bold l, --shortname instead of refname?

drasil-printers/lib/Language/Drasil/Markdown/Print.hs
224:  makeHeaderCols [text "Refname", l] size $$ 

Scanning for the CI shows we just add it to our ChunkDBs without using it really.

λ ~/Programming/Drasil/code/ tableAccAbbS rg "refName" -ths
drasil-data/lib/Data/Drasil/Concepts/Documentation.hs
57:  unlikelyChg, notebook, refBy, refName]
60:  mg, mis, notApp, srs, typUnc, sec, notebook, refBy, refName :: CI
87:refName     = commonIdeaWithDict "refName"     (cn' "reference name")                                "Refname" [documentc]
331:  likeChgDom, unlikeChgDom, refByDom, refNameDom :: ConceptChunk
341:refNameDom    = ccs (mkIdea "refNameDom"    (refName ^. term)                  $ Just "RefName")  EmptyS [srsDom]
346:  assumpDom, chgProbDom, likeChgDom, unlikeChgDom, refByDom, refNameDom]

drasil-example/swhs/lib/Drasil/SWHS/Concepts.hs
8:  likelyChg, physSyst, requirement, refBy, refName, srs, typUnc, unlikelyChg)
20:  physSyst, requirement, refBy, refName, srs, thModel, typUnc, unlikelyChg]

drasil-example/glassbr/lib/Drasil/GlassBR/Concepts.hs
7:  notApp, physSyst, response, requirement, refBy, refName, srs, type_, typUnc, 
29:  refBy, refName, stdOffDist, srs, thModel, typUnc, unlikelyChg]

drasil-example/ssp/lib/Drasil/SSP/Defs.hs
10:  likelyChg, physSyst, property, requirement, refBy, refName, safety, srs, typUnc, 
21:  physSyst, requirement, refBy, refName, srs, thModel, typUnc, unlikelyChg]

drasil-example/gamephysics/lib/Drasil/GamePhysics/Concepts.hs
8:  requirement, refBy, refName, srs, typUnc, unlikelyChg)
19:  likelyChg, ode, requirement, refBy, refName, srs, thModel, threeD, twoD, typUnc, unlikelyChg]

drasil-example/dblpend/lib/Drasil/DblPend/Unitals.hs
12:  requirement, refBy, refName, srs, typUnc)
31:  physSyst, requirement, refBy, refName, srs, thModel, typUnc]

drasil-example/pdcontroller/lib/Drasil/PDController/Concepts.hs
7:       (assumption, goalStmt, physSyst, requirement, refBy, refName, srs, typUnc)
12:     refName, srs, thModel, typUnc, pdControllerCI, proportionalCI, derivativeCI,
λ ~/Programming/Drasil/Drasil/code/ tableAccAbbS 

Similarly, because of this, RefBy is unable to be picked up by the extractor. Hence, RefBy is also impossible to be picked up.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Switching from String here to something that the extractor could pick up is a good idea (i.e., moving from show ls to something with a UID), but what should that new type be? Sentence is awkward because it would contain few-word sentences (abusing Sentence). NP? Unfortunately those don't contain UIDs. TypedUIDs is probably most appropriate, but our infrastructure really isn't ready for that change (yet).

Copy link
Owner

Choose a reason for hiding this comment

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

This definitely shows the problem with Show instances for us: it internalizes some knowledge into the Haskell part of Drasil too much. That information should be in 'data' (probably chunks, but I don't want to presume that.) We should definitely de-embed this knowledge.

My first instinct would be to create a new chunk (FieldLabel ?) with a uid and a label.

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, this part is still not addressed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think this will need to be moved to a new issue. This work is a bit more involved, similar to the work for Refname: #4363 (comment)

Copy link
Owner

Choose a reason for hiding this comment

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

I agree that it should be handled separately. But should it block this PR?

(Constraints s _) -> [s]
(CorrSolnPpties _ _) -> [],
(CorrSolnPpties _ cs) -> getC cs,
reqSub = Constant . f <$> \case
(FReqsSub c _) -> def c
(FReqsSub c lcs) -> def c ++ concatMap getLC lcs
(NonFReqsSub c) -> def c,
lcsSec = Constant . f <$> \(LCsProg c) -> def c,
ucsSec = Constant . f <$> \(UCsProg c) -> def c,
Expand All @@ -136,17 +139,41 @@ sentencePlate f = appendPlate (secConPlate (f . concatMap getCon') $ f . concatM
} where
def :: Definition a => [a] -> [Sentence]
def = map (^. defn)

getIntroSub :: IntroSub -> [Sentence]
getIntroSub (IPurpose ss) = ss
getIntroSub (IScope s) = [s]
getIntroSub (IChar s1 s2 s3) = s1 ++ s2 ++ s3
getIntroSub (IOrgSec _ s1 s2) = maybeToList s2 ++ getSec s1

der :: MayHaveDerivation a => [a] -> [Sentence]
der = concatMap (getDerivSent . (^. derivations))

getDerivSent :: Maybe Derivation -> [Sentence]
getDerivSent Nothing = []
getDerivSent (Just (Derivation h s)) = h : s

notes :: HasAdditionalNotes a => [a] -> [Sentence]
notes = concatMap (^. getNotes)

getPDSub :: PDSub -> [Sentence]
getPDSub (TermsAndDefs ms c) = def c ++ maybe [] pure ms
getPDSub (PhySysDesc _ s lc cs) = s ++ getLC lc ++ getC cs
getPDSub (Goals s c) = s ++ def c

getC :: [Contents] -> [Sentence]
getC = concatMap getCon'

getLC :: LabelledContent -> [Sentence]
getLC = getCon . (^. accessContents)

-- | Extracts 'Sentence's from a document description.
getDocDesc :: DocDesc -> [Sentence]
getDocDesc = fmGetDocDesc (sentencePlate id)
-- ^ FIXME: We want all Sentences from a document (not necessarily a document
-- description), so we use this function. But 'sentencePlate' does not include
-- all 'Sentence's! Some only appear when rendering (at least, after
-- `mkSections` is used on a `DocDesc` to create `[Section]`).

-- | Extracts 'Sentence's from a 'Section'.
getSec :: Section -> [Sentence]
Expand All @@ -171,10 +198,9 @@ getCon (DerivBlock h d) = h : concatMap getCon d
getCon (Enumeration lst) = getLT lst
getCon (Figure l _ _ _) = [l]
getCon (Bib bref) = getBib bref
getCon (Graph [(s1, s2)] _ _ l) = [s1, s2, l]
getCon Graph{} = []
getCon (Defini _ []) = []
getCon (Defini dt (hd:fs)) = concatMap getCon' (snd hd) ++ getCon (Defini dt fs)
getCon (Graph sss _ _ l) = let (ls, rs) = unzip sss
in l : ls ++ rs
getCon (Defini _ ics) = concatMap (concatMap getCon' . snd) ics

-- | Get the bibliography from something that has a field.
getBib :: (HasFields c) => [c] -> [Sentence]
Expand Down Expand Up @@ -206,10 +232,10 @@ getField Year{} = EmptyS

-- | Translates different types of lists into a 'Sentence' form.
getLT :: ListType -> [Sentence]
getLT (Bullet it) = concatMap (getIL . fst) it
getLT (Numeric it) = concatMap (getIL . fst) it
getLT (Simple lp) = concatMap getLP lp
getLT (Desc lp) = concatMap getLP lp
getLT (Bullet it) = concatMap (getIL . fst) it
getLT (Numeric it) = concatMap (getIL . fst) it
getLT (Simple lp) = concatMap getLP lp
getLT (Desc lp) = concatMap getLP lp
getLT (Definitions lp) = concatMap getLP lp

-- | Translates a 'ListTuple' into 'Sentence's.
Expand Down
Loading