Drasil
Drasil copied to clipboard
Investigate the use of the `abrv` method from class `CommonIdea`
Not so interested in who defines it but rather, where is it used? We need to know what code relies on abbreviations existing for certain (like getA
, which is fine). This will also include uses of getAcc
, getAccStr
and prependAbrv
since those effectively to the same thing.
The results of this investigation will tell us how to move forward on implementation.
Now that #3473 has been merged, this Issue is now blocking wrt moving forward on this project.
getAcc
is used in examples in order to obtain the acronym of a CommonIdea
and returns it in the form of a Sentence
.
The examples that use this are:
DblPendulum
, GamePhysics
, GlassBR
, Projectile
, SSP
, and SWHS
.
The following code snippet showcases the exact locations of where this function is utilized and defined.
drasil-docLang/lib/Drasil/Sections/Introduction.hs: S "follows the", phrase template, S "for an", getAcc Doc.srs, S "for",
drasil-example/dblpendulum/lib/Drasil/DblPendulum/Assumptions.hs:twoDMotionDesc = atStartNP (the pendMotion) `S.is` phrase twoD +:+. sParen (getAcc twoD)
drasil-example/dblpendulum/lib/Drasil/DblPendulum/Body.hs: sParen (getAcc twoD), phrase pendMotion, phrase problem,
drasil-example/gamephysics/lib/Drasil/GamePhysics/Assumptions.hs:assumpODDesc = allObject (getAcc twoD)
drasil-example/gamephysics/lib/Drasil/GamePhysics/Assumptions.hs:{-assumptions_list = enumSimple 1 (getAcc assumption) $ map (foldlSent)
drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs:purp = foldlSent_ [S "simulate", getAcc twoD, phrase CP.rigidBody,
drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs:scope = foldlSent_ [phraseNP (the physicalSim) `S.of_` getAcc twoD,
drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs: plural physLib, S "Similar", getAcc twoD, plural physLib, S "are"]
drasil-example/gamephysics/lib/Drasil/GamePhysics/Body.hs: getAcc threeD, phrase game, plural physLib, S "include:"]
drasil-example/gamephysics/lib/Drasil/GamePhysics/Changes.hs:likelyChangesStmt1 = (S "internal" +:+ getAcc CM.ode :+:
drasil-example/gamephysics/lib/Drasil/GamePhysics/IMods.hs: S "over time that satisfy the", getAcc ode `S.for` phraseNP (the acceleration) `sC`
drasil-example/gamephysics/lib/Drasil/GamePhysics/Requirements.hs:requirementS a b = requirementTemplate (plural a) (plural b) (getAcc twoD
drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs:glaTyFacEq = incompleteCase (zipWith glaTyFacHelper glassTypeFactors $ map (getAccStr . snd) glassType)
drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs:anGlass = getAcc annealed `S.is` phrase annealed +:+. phrase glass
drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs:ftGlass = getAcc fullyT `S.is` phrase fullyT +:+. phrase glass
drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs:hsGlass = getAcc heatS `S.is` phrase heatS +:+. phrase glass
drasil-example/glassbr/lib/Drasil/GlassBR/Figures.hs: sParen (ch demand) `S.versus` atStart sD +:+ sParen (getAcc stdOffDist)
drasil-example/glassbr/lib/Drasil/GlassBR/Figures.hs: `S.versus` titleize aspectRatio +:+ sParen (getAcc aR)
drasil-example/glassbr/lib/Drasil/GlassBR/Requirements.hs: plural traceyMatrix `S.inThe` getAcc srs `S.and_` phrase mg]) "Maintainable" nonFuncReqDom
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: [{- TODO: add back constraint: EnumeratedStr Software $ map (getAccStr . snd) glassType -}]
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: (foldlSent_ [S "a multiplying factor for adjusting the", getAcc lResistance,
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: `sC` S "in monolithic glass" `sC` getAcc lGlass, sParen (titleize lGlass) `sC`
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: S "or", getAcc iGlass, sParen (titleize iGlass), S "constructions"])
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: S "layered behaviour of", getAcc lGlass, S "under long duration",
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: S "loads), in a sealed", getAcc iGlass, S "unit"])
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: S "per 1000 for monolithic", getAcc annealed, S "glass"])
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs:glassTypeAbbrs = map (getAcc . snd) glassType
drasil-example/projectile/lib/Drasil/Projectile/Assumptions.hs:twoDMotionDesc = atStartNP (NP.the (projMotion `is` twoD)) +:+. sParen (getAcc twoD)
drasil-example/projectile/lib/Drasil/Projectile/Body.hs: sParen (getAcc twoD), phraseNP (combineNINI projectile motion), phrase problem, S "with",
drasil-example/projectile/lib/Drasil/Projectile/Concepts.hs:projSpeed = dccWDS "projSpeed" (nounPhraseSP "1D speed") (getAcc oneD +:+ phrase speed +:+ S "under" +:+ phrase constant +:+ phrase acceleration)
drasil-example/projectile/lib/Drasil/Projectile/Concepts.hs:projPos = dccWDS "projPos" (nounPhraseSP "1D position") (getAcc oneD +:+ phrase position +:+ S "under" +:+ phrase constant +:+ phrase speed)
drasil-example/projectile/lib/Drasil/Projectile/GenDefs.hs: [atStart rectilinear, sParen $ getAcc oneD, phrase velocity,
drasil-example/projectile/lib/Drasil/Projectile/GenDefs.hs: [atStart rectilinear, sParen $ getAcc oneD, phrase position,
drasil-example/projectile/lib/Drasil/Projectile/GenDefs.hs: getAcc twoD, S "motion under", phrase QP.constAccel]) E.velVecExpr
drasil-example/projectile/lib/Drasil/Projectile/GenDefs.hs: getAcc twoD, S "motion under", phrase QP.constAccel])
drasil-example/projectile/lib/Drasil/Projectile/Requirements.hs: plural traceyMatrix, S "in the", getAcc srs `S.and_` phrase mg]) "Maintainable" nonFuncReqDom
drasil-example/ssp/lib/Drasil/SSP/Body.hs:scope = foldlSent_ [phraseNP (stabAnalysis `ofA` twoD), sParen (getAcc twoD),
drasil-example/ssp/lib/Drasil/SSP/Requirements.hs: plural traceyMatrix `S.inThe` getAcc srs `S.and_` phrase mg]) "Maintainable" nonFuncReqDom
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: [S "The initial", plural condition, S "for the", getAcc ode `S.are`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: [S "The", getAcc ode, S "applies as long as the", phrase water `S.is` EmptyS `S.in_`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: getAcc phsChgMtrl, S "as", ch htFluxP, sParen (refS htFluxPCMFromWater)]
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: ch pcmSA `sC` S "since", phrase temp `S.the_ofThe` getAcc phsChgMtrl `S.isThe`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "we are left with the governing", getAcc ode `S.for` refS eBalanceOnWtr]
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: getAcc phsChgMtrl `sC` S "as given" `S.in_` sParen (refS heatEInPCM)],
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: [S "The initial", plural condition, S "for the", getAcc ode `S.are`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: phrase energy, S "balance on the" +:+. getAcc phsChgMtrl, S "The", phrase vol,
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "The derivation that follows is initially for the solid" +:+. getAcc phsChgMtrl,
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: ch pcmSA `sC` S "since", phrase temp `S.the_ofThe` getAcc phsChgMtrl `S.isThe`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "There is no", phrase htFlux, phrase output_, S "from the" +:+. getAcc phsChgMtrl,
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: eqN 4, S "applies for the", phrase solid +:+. getAcc phsChgMtrl, S "In the case where all of the",
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: getAcc phsChgMtrl `S.is` S "melted" `sC` S "the same derivation applies" `sC` S "except that",
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "this is not included" `sC` S "since the", phrase vol, S "change of the", getAcc phsChgMtrl,
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "In the case where", eS' eq6_1 `S.and_` S "not all of the", getAcc phsChgMtrl `S.is`
drasil-example/swhs/lib/Drasil/SWHS/IMods.hs: S "This derivation does not consider", phrase boiling `S.the_ofThe` getAcc phsChgMtrl `sC`
drasil-example/swhs/lib/Drasil/SWHS/Requirements.hs: plural traceyMatrix, S "in the", getAcc srs `S.and_` phrase mg]) "Maintainable" nonFuncReqDom
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs: getAcc, getAccStr, prependAbrv) where
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:getAcc :: CI -> Sentence
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:getAcc = S . abrv
drasil-lang/lib/Language/Drasil.hs: , CI, commonIdea, getAcc, getAccStr, commonIdeaWithDict, prependAbrv
getAccStr
is used only two times, both times within the GlassBR
example. It is used to obtain the abbreviation of a CommonIdea
and returns it as a String
.
The following code snippet showcases the exact location where this function is used and defined:
drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs:glaTyFacEq = incompleteCase (zipWith glaTyFacHelper glassTypeFactors $ map (getAccStr . snd) glassType)
drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs: [{- TODO: add back constraint: EnumeratedStr Software $ map (getAccStr . snd) glassType -}]
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs: getAcc, getAccStr, prependAbrv) where
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:getAccStr :: CI -> String
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:getAccStr = abrv
drasil-lang/lib/Language/Drasil.hs: , CI, commonIdea, getAcc, getAccStr, commonIdeaWithDict, prependAbrv
prependAbrv
is used in drasil-theory
and obtains the abbreviation of a CommonIdea
and returns it as a String
. It also prepends the abbreviation to the provided String
.
It is mainly used in the DataDefinition
, GenDefn
, InstanceModel
, and Theory
files.
For each of the above mentioned files, prependAbrv
is used in the smart constructors of data definitions, general definitions, instance models and theory models.
The following code snippet showcases the exact locations of where the function was used and defined.
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs: getAcc, getAccStr, prependAbrv) where
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:prependAbrv :: CommonIdea c => c -> String -> String
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:prependAbrv c s = abrv c ++ (':' : repUnd s)
drasil-lang/lib/Language/Drasil.hs: , CI, commonIdea, getAcc, getAccStr, commonIdeaWithDict, prependAbrv
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:ddE q refs der sn = DDE q . DDPkt Global refs der (shortname' $ S sn) (prependAbrv dataDefn sn)
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:ddENoRefs q der sn = DDE q . DDPkt Global [] der (shortname' $ S sn) (prependAbrv dataDefn sn)
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:ddME q refs der sn = DDME q . DDPkt Global refs der (shortname' $ S sn) (prependAbrv dataDefn sn)
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:ddMENoRefs q der sn = DDME q . DDPkt Global [] der (shortname' $ S sn) (prependAbrv dataDefn sn)
drasil-theory/lib/Theory/Drasil/GenDefn.hs: GD mkind (fmap unitWrapper u) derivs refs (shortname' $ S sn_) (prependAbrv genDefn sn_)
drasil-theory/lib/Theory/Drasil/GenDefn.hs: GD mkind (fmap unitWrapper u) derivs [] (shortname' $ S sn_) (prependAbrv genDefn sn_)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs: IM mkind i (o, oc) r der (shortname' $ S sn) (prependAbrv inModel sn)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs: IM mkind i (o, oc) r Nothing (shortname' $ S sn) (prependAbrv inModel sn)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs: IM mkind i (o, oc) [] der (shortname' $ S sn) (prependAbrv inModel sn)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs: IM mkind i (o, oc) [] Nothing (shortname' $ S sn) (prependAbrv inModel sn)
drasil-theory/lib/Theory/Drasil/Theory.hs: (prependAbrv thModel lbe)
drasil-theory/lib/Theory/Drasil/Theory.hs: (prependAbrv thModel lbe)
Thanks!
What about abrv
, is it ever used directly?
For the uses above, can you further analyze which ones are 'fundamental' (like the first use of getAcc
where the construction assumes that "SRS" exists) or incidental (where the sentence would still make sense if the full phrase was used instead.) I am expecting you to likely come up with a split into 3 (fundamental, incidental, unknown). Hmm, you might need to split it further, since sometimes it's used for text (getAcc
and getAccStr
) and sometimes for "name formation" (prependAbrv
).
Certainly abbreviations are used in non-trivial ways!
I will look into the usage of abrv
, to see where and how it is used. I will investigate and classify them and will put the report here.
getA
is mostly used to obtain the idea contained in a pre-existing type used to make another type.
For example, one instance where this occurs is in the NamedArgument.hs
where it is used as follows:
-- | Finds the idea contained in the 'QuantityDict' used to make the 'NamedArgument'.
instance Idea NamedArgument where getA = getA . view qtd
The following code snippet showcases where the function was used and defined.
drasil-code/lib/Data/Drasil/ExternalLibraries/ODELibraries.hs: (compoundPhrase (nounPhraseSP "change in") (c ^. term)) (getA c) (c ^. typ)
drasil-code/lib/Language/Drasil/Chunk/CodeDefinition.hs:instance Idea CodeDefinition where getA = getA . view cchunk
drasil-code/lib/Language/Drasil/Chunk/NamedArgument.hs:instance Idea NamedArgument where getA = getA . view qtd
drasil-code/lib/Language/Drasil/Chunk/Parameter.hs:instance Idea ParameterChunk where getA = getA . view pcc
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. conceptinsTable) = fromMaybe "" $ getA $ defResolve s $ sDom $ cdom x
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. conceptinsTable) = fromMaybe "" (getA $ defResolve s $ sDom $ cdom x) ++ ":" ++ getAdd (getRefAdd x)
drasil-docLang/lib/Drasil/Sections/TableOfAbbAndAcronyms.hs:select (x:xs) = case getA x of
drasil-lang/lib/Language/Drasil/Chunk/CodeBase.hs:instance Idea CodeChunk where getA = getA . view qc
drasil-lang/lib/Language/Drasil/Chunk/CodeBase.hs:instance Idea CodeVarChunk where getA = getA . view ccv
drasil-lang/lib/Language/Drasil/Chunk/CodeBase.hs:instance Idea CodeFuncChunk where getA = getA . view ccf
drasil-lang/lib/Language/Drasil/Chunk/CodeBase.hs: (c ^. term) (getA c) (Array t) (symbol c Implementation) (getUnit c))
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:instance Idea CI where getA = Just . view ab
drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs:instance Idea ConceptChunk where getA = getA . view idea
drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs:instance Idea CommonConcept where getA = getA . view comm
drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs:instance Idea ConceptInstance where getA = getA . view (cc . idea)
drasil-lang/lib/Language/Drasil/Chunk/Constrained.hs:instance Idea ConstrainedChunk where getA = getA . view qd
drasil-lang/lib/Language/Drasil/Chunk/Constrained.hs:instance Idea ConstrConcept where getA = getA . view defq
drasil-lang/lib/Language/Drasil/Chunk/DefinedQuantity.hs:instance Idea DefinedQuantityDict where getA = getA . view con
drasil-lang/lib/Language/Drasil/Chunk/DifferentialModel.hs:instance Idea DifferentialModel where getA = getA . view dmconc
drasil-lang/lib/Language/Drasil/Chunk/Eq.hs:instance Idea (QDefinition e) where getA = getA . (^. qdQua)
drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs: getA :: c -> Maybe String
drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs:instance Idea IdeaDict where getA = mabbr
drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs:nw c = IdeaDict (c ^. uid) (c ^. term) (getA c)
drasil-lang/lib/Language/Drasil/Chunk/Quantity.hs:instance Idea QuantityDict where getA qd = getA (qd ^. id')
drasil-lang/lib/Language/Drasil/Chunk/Relation.hs:instance Idea RelationConcept where getA = getA . view conc
drasil-lang/lib/Language/Drasil/Chunk/UncertainQuantity.hs:instance Idea UncertainChunk where getA (UCh n _) = getA n
drasil-lang/lib/Language/Drasil/Chunk/UncertainQuantity.hs:instance Idea UncertQ where getA (UQ q _) = getA q
drasil-lang/lib/Language/Drasil/Chunk/Unital.hs:instance Idea UnitalChunk where getA (UC qc _) = getA qc
drasil-lang/lib/Language/Drasil/Chunk/Unitary.hs:instance Idea UnitaryChunk where getA uc = getA $ uc ^. quant
drasil-lang/lib/Language/Drasil/Chunk/UnitDefn.hs:instance Idea UnitDefn where getA c = getA (c ^. vc)
drasil-printers/lib/Language/Drasil/Printing/Import/Helpers.hs:lookupS sm c sCap = maybe (resolveCapT sCap $ l ^. term) S $ getA l >>= capHelper sCap
drasil-printers/lib/Language/Drasil/Printing/Import/Sentence.hs: getA $ defResolve ctx u --Need defResolve instead of refResolve since only ConceptInstance
drasil-theory/lib/Theory/Drasil/ConstraintSet.hs:instance Idea (ConstraintSet e) where getA = getA . (^. con)
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:instance Idea DataDefinition where getA = either getA getA . qdFromDD
drasil-theory/lib/Theory/Drasil/GenDefn.hs:instance Idea GenDefn where getA = getA . (^. mk)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs:instance Idea InstanceModel where getA = getA . (^. mk)
drasil-theory/lib/Theory/Drasil/ModelKinds.hs:instance Idea (ModelKinds e) where getA = elimMk (to getA) (to getA) (to getA) (to getA) (to getA)
drasil-theory/lib/Theory/Drasil/ModelKinds.hs:instance Idea (ModelKind e) where getA = getA . (^. mk)
drasil-theory/lib/Theory/Drasil/MultiDefn.hs:instance Idea (MultiDefn e) where getA = getA . (^. qd)
drasil-theory/lib/Theory/Drasil/Theory.hs:instance Idea TheoryModel where getA = getA . view mk
abrv
is used to obtain the string abbreviation of a CommonIdea.
abrv
is only used once in the examples, and it is for the projectile
example. It is used in the location where the Choices
where the location of the projectile was being constructed.
The code snippet below shows exactly how abrv
is used in projectile
:
genCodeWithChoices :: [Choices] -> IO ()
genCodeWithChoices [] = return ()
genCodeWithChoices (c:cs) = let dir = map toLower $ codedDirName (getSysName fullSI) c
getSysName SI{_sys = sysName} = abrv sysName
in do
workingDir <- getCurrentDirectory
createDirectoryIfMissing False dir
setCurrentDirectory dir
genCode c (codeSpec fullSI c [])
setCurrentDirectory workingDir
genCodeWithChoices cs
Although it is only used once in drasil-example
, it is very frequently used in drasil-docLang
, drasil-gen
, drasil-theory
, and drasil-website
.
It is used to help carry out a wide range of functions such as finding reference addresses, obtaining types etc. An example of this is the following snippet from drasil-theory/lib/Theory/Drasil/DataDefinition.hs
:
-- | Finds the reference address of a 'DataDefinition where'.
instance HasRefAddress DataDefinition where getRefAdd l = RP (prepend $ abrv l) (l ^. ddPkt pktS)
-- | Finds the domain of the 'QDefinition' used to make the 'DataDefinition where'.
instance ConceptDomain DataDefinition where cdom _ = cdom dataDefn
-- | Finds the idea of a 'DataDefinition where' (abbreviation).
instance CommonIdea DataDefinition where abrv _ = abrv dataDefn
-- | Finds the reference address of a 'DataDefinition where'.
instance Referable DataDefinition where
refAdd = (^. ddPkt pktS)
renderRef l = RP (prepend $ abrv l) (refAdd l)
I am in the process of analyzing all these occurrences and will be able to provide a better idea of the uses of abrv
once I am done.
The following code snippet showcases the locations where the function was used and defined:
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. dataDefnTable) = abrv x
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. insmodelTable) = abrv x
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. gendefTable) = abrv x
drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs: | Just (x, _) <- Map.lookup t (s ^. theoryModelTable) = abrv x
drasil-docLang/lib/Drasil/DocumentLanguage.hs: ++ traceyGraphGetRefs (filter (not.isSpace) $ abrv sys) ++ map ref cites
drasil-docLang/lib/Drasil/DocumentLanguage.hs: (map LlC trace) (filter (not.isSpace) $ abrv sys) []
drasil-example/projectile/lib/Drasil/Projectile/Choices.hs: getSysName SI{_sys = sysName} = abrv sysName
drasil-gen/lib/Language/Drasil/Generate.hs: createDirectoryIfMissing True $ "../../debug/" ++ filter (not.isSpace) (abrv sysName) ++ "/SRSlogs"
drasil-gen/lib/Language/Drasil/Generate.hs: setCurrentDirectory $ "../../debug/" ++ filter (not.isSpace) (abrv sysName) ++ "/SRSlogs"
drasil-gen/lib/Language/Drasil/Generate.hs: handle <- openFile (filter (not.isSpace) (abrv sysName) ++ "_SRS.log") WriteMode
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:instance CommonIdea CI where abrv = view ab
drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs:prependAbrv c s = abrv c ++ (':' : repUnd s)
drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs:instance CommonIdea CommonConcept where abrv = abrv . view comm
drasil-lang/lib/Language/Drasil/Classes.hs: -- | Introduces abrv which necessarily provides an abbreviation.
drasil-lang/lib/Language/Drasil/Classes.hs: abrv :: c -> String
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:instance HasRefAddress DataDefinition where getRefAdd l = RP (prepend $ abrv l) (l ^. ddPkt pktS)
drasil-theory/lib/Theory/Drasil/DataDefinition.hs:instance CommonIdea DataDefinition where abrv _ = abrv dataDefn
drasil-theory/lib/Theory/Drasil/DataDefinition.hs: renderRef l = RP (prepend $ abrv l) (refAdd l)
drasil-theory/lib/Theory/Drasil/GenDefn.hs:instance HasRefAddress GenDefn where getRefAdd l = RP (prepend $ abrv l) (view ra l)
drasil-theory/lib/Theory/Drasil/GenDefn.hs:instance CommonIdea GenDefn where abrv _ = abrv genDefn
drasil-theory/lib/Theory/Drasil/GenDefn.hs: renderRef l = RP (prepend $ abrv l) (refAdd l)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs:instance HasRefAddress InstanceModel where getRefAdd l = RP (prepend $ abrv l) (ra l)
drasil-theory/lib/Theory/Drasil/InstanceModel.hs:instance CommonIdea InstanceModel where abrv _ = abrv inModel
drasil-theory/lib/Theory/Drasil/InstanceModel.hs: renderRef l = RP (prepend $ abrv l) (refAdd l)
drasil-theory/lib/Theory/Drasil/Theory.hs:instance HasRefAddress TheoryModel where getRefAdd l = RP (prepend $ abrv l) (ra l)
drasil-theory/lib/Theory/Drasil/Theory.hs:instance CommonIdea TheoryModel where abrv _ = abrv thModel
drasil-theory/lib/Theory/Drasil/Theory.hs: renderRef l = RP (prepend $ abrv l) (refAdd l)
drasil-website/lib/Drasil/Website/CaseStudy.hs:mkCaseStudy E{sysInfoE = si@SI{_sys = sys}, choicesE = [x]} = [CS{sysInfoCS = si, progName = S $ abrv sys, choicesCS = x}]
drasil-website/lib/Drasil/Website/CaseStudy.hs:mkCaseStudy E{sysInfoE = si@SI{_sys = sys}, choicesE = xs} = map (\x -> CS{sysInfoCS = si, progName = S $ Projectile.codedDirName (abrv sys) x, choicesCS = x}) xs
drasil-website/lib/Drasil/Website/Example.hs: nameAndDesc E{sysInfoE = SI{_sys = sys}, descE = desc} = S (abrv sys) +:+ desc
drasil-website/lib/Drasil/Website/Example.hs: [Flat $ S (abrv sys ++ "_SRS") +:+ namedRef (getSRSRef srsP "html" $ abrv sys) (S "[HTML]") +:+ namedRef (getSRSRef srsP "pdf" $ abrv sys) (S "[PDF]")]
drasil-website/lib/Drasil/Website/Example.hs: [Flat $ S (abrv sys ++ "_SRS") +:+ namedRef (getSRSRef srsP "html" $ abrv sys) (S "[HTML]") +:+ namedRef (getSRSRef srsP "pdf" $ abrv sys) (S "[PDF]"),
drasil-website/lib/Drasil/Website/Example.hs: [_] -> abrv sys
drasil-website/lib/Drasil/Website/Example.hs: _ -> Projectile.codedDirName (abrv sys) chc
drasil-website/lib/Drasil/Website/Example.hs: [_] -> map toLower $ filter (not.isSpace) $ abrv sys
drasil-website/lib/Drasil/Website/Example.hs: _ -> map toLower (filter (not.isSpace) $ abrv sys) ++ "/" ++ verName
drasil-website/lib/Drasil/Website/Example.hs: sysName = filter (not.isSpace) $ abrv sys
drasil-website/lib/Drasil/Website/Example.hs:getAbrv E{sysInfoE = SI{_sys=sys}} = abrv sys
@JacquesCarette
I have now completed the investigation. There are 141 lines of code where the getAcc
, getAccStr
, prependAbrv
, getA
, and abrv
functions are used.
After the investigation, I can conclude that getAcc
, getAccStr
, and abrv
functions can easily be merged.
getAccStr
and abrv
perform the exact same function. getAccStr
is defined as the following:
https://github.com/JacquesCarette/Drasil/blob/d5a8ce9274f0399de0d0e1bbfad69d45d8501c0e/code/drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs#L55-L56
Since both abrv
and getAccStr
perform the same function and are of the same type, we can merge them.
Also, although the console locations show 6 locations, getAccStr
is only used in 1 of those locations as 4/6 are either references to importing or exporting getAccStr
and its definition. One of them is also a comment, which leaves just one location where getAccStr
is used.
In addition, getAcc
is only the Sentence
version of getAccStr
and hence a Sentence
version of abrv
.
getAcc
is defined as the following:
https://github.com/JacquesCarette/Drasil/blob/d5a8ce9274f0399de0d0e1bbfad69d45d8501c0e/code/drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs#L51-L52
For reference, abrv
is defined as the following:
https://github.com/JacquesCarette/Drasil/blob/d5a8ce9274f0399de0d0e1bbfad69d45d8501c0e/code/drasil-lang/lib/Language/Drasil/Classes.hs#L72-L76
getAcc
is used much more extensively than getAccStr
and is used in 52 locations.
Although prependAbrv
is very similar to getAcc
and getAccStr
, it does act as a helper function to form names. It does prevent a lot of redundancy in code and thus in my opinion should not be merged.
It is used in 12 different lines of code.
getA
has a type of Maybe String
and acts as getAccStr
or abrv
when an abbreviation/acronym is present, however, returns Nothing
when there is no abbreviation/acronym.
https://github.com/JacquesCarette/Drasil/blob/d5a8ce9274f0399de0d0e1bbfad69d45d8501c0e/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs#L25-L29
We should look into potentially implementing the structure that getA
has as the main structure for all the abbreviations used throughout Drasil as that way we would not have to assume that an acronym/abbreviation is present for the ones that we use in the SRS at least.
The detailed report where you will be able to find the categorization of each of the uses of these functions can be found here.
Thanks - there is a lot to digest here. I've added an explicit task to my 'to do' list for that.
@JacquesCarette I have now done a deeper investigation into the abbreviation functions. The details of the investigation are as follows.
abrv
abrv
is used to define getAcc
, getAccStr
, and prependAbrv
. They are defined as the following:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs#L50-L60
The main difference between the usages is that abrv
is sometimes used to create instances to obtain CommonIdea
and HasReferenceAddress
. Here our code depends on the object having an abbreviation. However, it is also sometimes used to just obtain abbreviations. All the locations where abrv
is used require an abbreviation, i.e., the code is dependent on obtaining the abbreviation to function properly. Mostly, abrv
is used to obtain the abbreviation of System Information or System. However, there are some other instances where it is used to obtain general abbreviation. abrv
is also used to define the getAcc
, getAccStr
and prependAbrv
.
getAccStr
getAccStr
is only used in one place.
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-example/glassbr/lib/Drasil/GlassBR/DataDefs.hs#L117-L118
I am unsure as to whether it is a requirement for an abbreviation to be used. I believe it is, but I do not understand that aspect of the code entirely to come to a strong conclusion. Since getAccStr
is equal to abrv
and performs the same function as abrv
, it can easily be replaced by abrv
. Here, we are assuming that an acronym/abbreviation exists for the second tuple of the glassType
list. For reference, the glassType
list is as follows:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs#L434-L435
getAcc
getAcc
is only used in areas where we require an abbreviation in a sentence format. We could potentially rewrite the code as S abrv <insert variable>
. We again assume that an abbreviation exists. These all functions are CommonIdea
s. In cases marked as “Incidental” in the attached Excel sheet, we can use the full form and the sentence would still make sense. However, for cases marked as “Fundamental”, we need to use the abbreviations as the sentence would not make sense if the full form was used in that case. While the code is not dependent on us using abbreviations, in places where we use getAcc
, the locations marked as “Fundamental” indicate that it is imperative that we use the abbreviation from a documentation point of view.
The following summarizes the differences between CommonIdea
, NamedIdea
, Idea
, and IdeaDict
.
-
NamedIdea
: An element that is aCommonIdea
or anIdea
must first be aNamedIdea
.Named Idea
acts as a constraint for those elements.NamedIdea
however does not have an abbreviation. -
CommonIdea
must have an abbreviation -
Idea
may have an abbreviation -
IdeaDict
may have an abbreviation. However, it differs fromIdea
in the manner thatIdea
is a type class whereasIdeaDict
is a datatype. Furthermore,IdeaDict
has aUID
,NP
(NounPhrase), andMaybe String
which is the type for the abbreviation it may have.
The way the four are defined can be viewed below: https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs#L21-L29
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs#L51-L55
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Classes.hs#L72-L76
prependAbrv
prependAbrv
performs a similar function to getAccStr
and abrv
, but instead of solely obtaining the acronym, it prepends it to another String
. It is often used in the reference name formation of various items such as General Definitions, Data Definitions, Theory Models and Instance Models. These are then used as links to multiple tables and locations within the SRS. An example of it being used is the following:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L63-L68
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-example/gamephysics/lib/Drasil/GamePhysics/GenDefs.hs#L64-L66
While it is not required for those references to be abbreviations, it does help in ensuring an equal row/column width of the traceability matrices. It also looks much better from a visual point of view in the SRS.
However, if we were to merge this, this would require a lot more change as the prependAbrv
does include syntax to prepend the abbreviation in front of another string.
getA
getA
is different from others in the sense that it is the only function of the others that does not require you to assume that an abbreviation exists. It is defined such that an abbreviation may or may not exist.
getA
is defined as the following:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Chunk/NamedIdea.hs#L27-L29
getA
is mostly used to create instances of Idea, where Drasil is obtaining the Idea out of another type such as CodeChunk
, NamedArgument
, etc. I am yet to determine how we could potentially make this better.
However, I have determined that these instances do not require an abbreviation to be present as they are using getA
, which will return Nothing
if there is no abbreviation present. It is further used in functions that are used in Domain Formation / Reference Formation. An example of each can be viewed below:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs#L111-L117
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs#L125-L132
It also is used to just purely obtain the acronym of a word in functions that perform a multitude of functions. An example of this can be viewed below:
https://github.com/JacquesCarette/Drasil/blob/2fa75082389442d317e0c63ad92d9d3879121a33/code/drasil-lang/lib/Language/Drasil/Chunk/CodeBase.hs#L114-L121
In all the locations where getA
is used, the code does not seem dependent on the abbreviation being present as it would work fine if the abbreviation was not present at all. It would, however, prefer if an abbreviation is available.
Issue #3536 is a first spin-off from this analysis. Discussion of 'display names' is another.
Issues #3537 and #3538 are also spawned from this.
I have finished re-analyzing the use of abrv
. The detailed summary for each occurrence is available on the excel sheet linked here.
There are about 3-4 occurrences only of abrv
that I could not figure out as to why or how the code is being affected. Those occurrences have been marked in red in the excel sheet.
A lot of the usage of abrv
is to obtain the abbreviation of sys
. sys
is just referring to the name of the examples. An alternate function that we could use in many of these cases is programName
which would convert the code from abrv sys
to programName sys
. This would allow us to obtain the original program name of these examples. However, the reason why abrv
is used as opposed to programName
is because of the examples of Game Physics
and PD Controller
. If we use programName
instead of abrv
, the names of these examples get converted from pdcontroller
to pd_controller
and gamephysics to game_physics
, or PD Controller
to PD_Controller
and Game Physics
to Game_Physics
depending on the circumstance.
For some of the examples, we may prefer to keep abrv
because it is used on the main website of Drasil and it may look better to avoid the underscore rather than keeping it. However, for others instances, we should consider moving towards using programName
instead of abrv
as I believe that it would be more representative of the function that we are trying to carry out. Alternatively, we could also look into modifying the way the project names are defined and potentially modify those. So that for the program name, we do not have any underscores and for the abbreviation, we truly do have an abbreviation. The reason I make this comment is because for all examples other than PD Controller
and Game Physics
, the programName is the exact same as the abbreviation for these examples, which in my opinion defeats the purpose for programName
and abrv
for being two separate functions.
I will now resume my analysis for the usages of prependAbrv
.
You definitely put a lot of work into this @harmanpreet-sagar. It sounds like the most important abbreviation is the program name. This makes sense, since program names are often abbreviations and the program name appears everywhere. There are programs that aren't named by abbreviations, so we don't want to conflate these ideas. It feels like many of the instances of abbreviations should really be program names. We can discuss this further during our meeting tomorrow.
I'm fine with changing the program names or abbreviations to make things more consistent. However, we want to make sure that we are general enough to accommodate future cases, not just the current case studies.
Looks like all the ones you couldn't figure out have already been changed in #3545 !
Could you please update the analysis in view of that PR? [I'm assuming that basically means deleting a lot of lines that don't use abrv
anymore].
Sure! I will remove the lines that do not use abrv
anymore!
I have finished re-analyzing the use of prependAbrv
. The detailed summary for each occurrence is available on the Excel sheet linked here.
All of the cases of prependAbrv
occur in the following four files: DataDefintion.hs
, GenDefn.hs
, InstanceModel.hs
, and Theory.hs
.
In all cases, prependAbrv
is used to create labels for the Data Definitions, General Definitions, Instance Models, and Theory Models elements. The functions in which they are used to create the said Data Definitions, General Definitions, Instance and Theory Models in the examples.
An example of a place where prependAbrv
is used is the following:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L70-L74
Usage of the function in which prependAbrv
is used in an example is the following:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-example/dblpend/lib/Drasil/DblPend/GenDefs.hs#L33-L34
sn_
is just a String
that takes in the name of the General Definition element. If sn_
is replaced with any other string, then the output on the SRS documents will reflect that. However, that would only impact RefName
. It would not impact the RefBy
sections. This is because we obtain the RefBy
by obtaining the UID
from within the RefBy
table and then obtain the reference from there.
The following image showcases the effect of when I change sn_
to "Hello"
.
The above refers to GD:velocityX1
.
However, when this appears in RefBy
, it appears as the following:
The following code block showcases how we obtain the references from the RefBy
:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-database/lib/Database/Drasil/ChunkDB.hs#L220-L226
The way references are formed is as follows:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L51-L61
For forming references, it uses the getRefAdd
function which first obtains the abbreviation and then uses the prepend
function to prepend that abbreviation to its name which is obtained by view ra l
.
The prepend
is defined as the following:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-lang/lib/Language/Drasil/Label/Type.hs#L67-L69
Since the abbreviation of any General Definition element is GD
, GD
is prepended to the name. Thus, RefBy
is not affected by this. Refname
is affected because it is just a title and not a referable link.
Similar instances have been defined for Data Definitions, Instance Models and Theory Models as well. Similar to General Definitions, all elements of Data Definitions, Instance Models, and Theory Models have the abbreviation of DD, IM, and TM respectively.
Another thing that I noticed when investigating prependAbrv
is that renderRef
is the same as getRefAdd
. Maybe we should consider changing renderRef
to renderRef = getRefAdd
as is the case in the following instances:
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-lang/lib/Language/Drasil/Document/Core.hs#L103-L121
https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-lang/lib/Language/Drasil/Chunk/Concept/Core.hs#L74-L79
I know this is a bit long but the gist is that prependAbrv
is only used for label-making in the Data Definition, General Definition, Instance Model, and Theory Model and if any change is made on the definition level to the functions in which prependAbrv
is used, then only RefName
is changed and RefBy
will not be affected.
Amusingly, this is all because of "de-embedding gone sideways" ! The strings "GD", "DD", etc used to be in many places in the Drasil code base. That was bad. So we removed them all and put them in some 'concepts' and had to code retrieve them from there. Turns out, it was only a partial improvement! (A warning to @balacij that abstracting some patterns can go awry).
This seems to be another abuse of "abbreviation". I think the root is that Data Definition (and friends) is not just a mere concept, but a "Drasil-internal concept" for which we require more.
I think the design forward for this part:
- create a
DrasilMeta
chunk type, which contains a concept. Its domain should contain at least Drasil itself. - create a class
HasPrefix
with aprefix
method. Make sureDrasilMeta
implements it. - change the chunks for Data Definition (etc) to be
DrasilMeta
- delete
prependAbrv
and useprefix
instead.
Note that I am expecting DrasilMeta
to be renamed later, once we figure out which other ones we have / need.
Also: the above design should end up on the wiki somewhere (with a back link to here) so this information doesn't get lost.
Thank you for that analysis! I will create a wiki and document this entire investigation now!
I have created a wiki for this investigation. Kindly let me know if there are any changes to be made to that wiki.
The wiki is good. Though it would be nice to have a summary of the findings at the top. Some of the 'detailed discussion' should be put here directly - it is much more informative than some of the details that are currently on this page.
Now we should follow-up with (more) actions:
- get rid of
getAccStr
- what are the remaining examples of uses of
abrv
? - my comment should become an issue
- what are the patterns of use of
getAcc
?
I will modify the wiki to have a summary of findings on the top and the detailed discussion will be referenced here.
The issue to get rid of getAccStr
is #3623 and the PR resolving the issue is #3624. Once the PR is merged, I will remove that usage from the excel file.
I have also created issue #3626 based on the design suggested in your comment.
getAcc
is primarily used in obtaining the Sentence
abbreviation of the variable on which it is applied. Most of its regular uses are Incidental, i.e., the sentence would still make sense if the full phrase was used instead of the abbreviation in the SRS. For some of its uses, I have characterized them as Fundamental, i.e., we need an acronym in that position and it cannot be replaced with the full word in the SRS. For each of the specific occurrences, the sentence that corresponds to it is available in the excel sheet.
However, for two of the functions, it is used in creating a ConceptChunk
by using the dccWDS
helper function. getAcc
is used to obtain the acronym of oneD
to help in creating the definitions of projSpeed
and projPos
. These definitions do not appear anywhere in the SRS. The following code block showcases the manner in which they are used.
https://github.com/JacquesCarette/Drasil/blob/e5b8ec6aec5969648bd87466290577e8f6d829c0/code/drasil-example/projectile/lib/Drasil/Projectile/Concepts.hs#L42-L43
If we would like to eliminate getAcc
, the change would be very straightforward as we would have to replace getAcc
with S . abrv
as it is defined as such.
https://github.com/JacquesCarette/Drasil/blob/e5b8ec6aec5969648bd87466290577e8f6d829c0/code/drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs#L50-L52
If we decide on keeping this function, I feel that the name of getAcc
should potentially be modified for it to be more descriptive so that it is clearly indicated that it is used to obtain acronyms in the Sentence
form. A potential name idea that I can think of is getAccSent
.
There are 21 remaining examples of abrv
and they are as follows:
-
In 2 examples
abrv
is currently used to create reference links. Changing the usage fromabrv
toprogramName
would change the name ofpdcontroller
topd_controller
in reference links (would cause a stable change). https://github.com/JacquesCarette/Drasil/blob/582fc89bb78b53d7ad06a1940894718edb394dce/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs#L179-L185 https://github.com/JacquesCarette/Drasil/blob/582fc89bb78b53d7ad06a1940894718edb394dce/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs#L424-L434 -
In 3 different places,
abrv
is used to define other functions,getAcc
,prependAbrv
, andprogramName
. https://github.com/JacquesCarette/Drasil/blob/582fc89bb78b53d7ad06a1940894718edb394dce/code/drasil-lang/lib/Language/Drasil/Chunk/CommonIdea.hs#L50-L56 https://github.com/JacquesCarette/Drasil/blob/582fc89bb78b53d7ad06a1940894718edb394dce/code/drasil-lang/lib/Language/Drasil/Chunk/CodeVar.hs#L33-L35 -
It is used in 4 different places to help create
CommonIdea
instances forDataDefinition
,TheoryModel
,InstanceModel
, andGenDefn
. It basically creates the functionality that the abbreviation of any of the examples of the aforementioned types would equal the abbreviation of these types. For example, the abbreviation of an example that has the typeDataDefinition
would be DD. https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L56-L57 -
In 4 different places,
abrv
is used to createHasRefAddress
instances forDataDefinition
,TheoryModel
,InstanceModel
, andGenDefn
. It is basically used to create references andRefBy
for the SRS. Changing / Modifying this function would only affect theRefBy
in each case and would not affect theRefName
. https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L50-L51 -
In 4 different places,
abrv
is used to createReferable
instances forDataDefinition
,TheoryModel
,InstanceModel
, andGenDefn
. It is used in therenderRef
functions that do not appear to cause any visual change in the SRS. Furthermore,renderRef
is defined in the same manner as that ofgetRefAdd
in theHasRefAddress
instance. TherenderRef
can be changed torenderRef = getRefAdd
in theReferable
instances forDataDefinition
,TheoryModel
,InstanceModel
, andGenDefn
. https://github.com/JacquesCarette/Drasil/blob/8d5e8f8088bb87cd351d07f4104faae7fd49111f/code/drasil-theory/lib/Theory/Drasil/GenDefn.hs#L50-L61 -
In 4 different examples, it checks whether the UID of a certain
DataDefinition
,TheoryModel
,InstanceModel
, andGenDefn
is present in theSystemInformation
database. If it is, it prepends the abbreviation of that type to the name of the example for labelling in the Traceability Graphs. https://github.com/JacquesCarette/Drasil/blob/582fc89bb78b53d7ad06a1940894718edb394dce/code/drasil-docLang/lib/Drasil/DocumentLanguage/TraceabilityGraph.hs#L110-L116
Re: getAcc
- there is no point in replacing it with S . abbrv
as the intent is to remove uses where there is a required abbreviation. That code change would not change that. For oneD
, I think that it would be fine if the code was 'conditional', i.e. used the abbreviation if it was there and the full term otherwise. That would let us change oneD
to not requiring an abbreviation, just having one.
I think that, to deal with DataDefinition
, TheoryModel
, InstanceModel
, and GenDefn
we need a DrasilConcept
chunk. This one could have a required abbreviation, because it is meant to be internal to Drasil itself.
So, just to make sure I am understanding it properly, we need to change getAcc
to a function that returns an abbreviation if there is one. The concepts that don't have the type of DataDefinition
, InstanceModel
, TheoryModel
, and GenDefn
would have the option of including an abbreviation. However, for the types of DataDefinition
, InstanceModel
, TheoryModel
, and GenDefn
we are creating a DrasilMeta
/ DrasilConcept
chunk that would have an abbreviation.
Yes, exactly.
Okay makes sense. So I will create an issue to change the functionality of the getAcc
function. #3626 deals with the creation of DrasilMeta
. I will update that to include this design as well.