Skip to content

Commit

Permalink
Turn all references of AssumpChunk to use makeRef2.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoy148 committed Nov 20, 2018
1 parent 2a15246 commit bcce24c
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 40 deletions.
2 changes: 1 addition & 1 deletion code/drasil-data/Data/Drasil/SentenceStructures.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ tAndDOnly :: Concept s => s -> ItemType
tAndDOnly chunk = Flat $ ((at_start chunk) +:+ S "- ") :+: (chunk ^. defn)

followA :: Sentence -> AssumpChunk -> Sentence
preceding `followA` assumpt = preceding +:+ S "following" +:+ (Ref $ makeRef assumpt)
preceding `followA` assumpt = preceding +:+ S "following" +:+ (Ref2 $ makeRef2 assumpt)

-- | Used when you want to say a term followed by its symbol. ex. "...using the Force F in..."
getTandS :: (Quantity a, NamedIdea a) => a -> Sentence
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-example/Drasil/GlassBR/Assumptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ responseTypeDesc = foldlSent [S "The", phrase responseTy, S "considered in",

ldfConstantDesc :: QDefinition -> Sentence
ldfConstantDesc mainConcept = foldlSent [S "With", phrase reference, S "to",
makeRefS standardValues `sC` S "the", phrase value `sOf`
makeRef2S standardValues `sC` S "the", phrase value `sOf`
phrase mainConcept, sParen (ch mainConcept), S "is a", phrase constant,
S "in", short gLassBR]
12 changes: 6 additions & 6 deletions code/drasil-example/Drasil/GlassBR/Changes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@ considerMoreThanFlexGlass = cic "considerMoreThanFlexGlass" considerMoreThanFlex
calcInternalBlastRiskDesc :: NamedChunk -> Sentence
varValsOfmkEDesc, accMoreThanSingleLiteDesc, accMoreBoundaryConditionsDesc, considerMoreThanFlexGlassDesc :: Sentence

calcInternalBlastRiskDesc mainConcept = foldlSent [(makeRefS explainScenario) +:+ S "- The",
calcInternalBlastRiskDesc mainConcept = foldlSent [(makeRef2S explainScenario) +:+ S "- The",
phrase system, S "currently only calculates for external" +:+.
phrase mainConcept, S "In the future,", plural calculation,
S "can be added for the internal", phrase mainConcept]

varValsOfmkEDesc = foldlSent [(makeRefS standardValues) `sC` ((makeRefS ldfConstant) +:+
varValsOfmkEDesc = foldlSent [(makeRef2S standardValues) `sC` ((makeRef2S ldfConstant) +:+
S "- Currently, the"), plural value, S "for",
foldlList Comma List (map ch (take 3 assumptionConstants)),
S "are assumed to be the same for all" +:+. phrase glass,
S "In the future, these", plural value, S "can be changed to",
phrase variable, plural input_]

accMoreThanSingleLiteDesc = foldlSent [(makeRefS glassLite) +:+ S "- The", phrase software,
accMoreThanSingleLiteDesc = foldlSent [(makeRef2S glassLite) +:+ S "- The", phrase software,
S "may be changed to accommodate more than a single", phrase lite]

accMoreBoundaryConditionsDesc = foldlSent [(makeRefS boundaryConditions) :+: S "- The", phrase software,
accMoreBoundaryConditionsDesc = foldlSent [(makeRef2S boundaryConditions) :+: S "- The", phrase software,
S "may be changed to accommodate more boundary", plural condition,
S "than 4-sided support"]

considerMoreThanFlexGlassDesc = foldlSent [(makeRefS responseType) +:+ S "- The", phrase software,
considerMoreThanFlexGlassDesc = foldlSent [(makeRef2S responseType) +:+ S "- The", phrase software,
S "may be changed to consider more than just", phrase flexure,
S "of the glass"]

Expand All @@ -81,6 +81,6 @@ predictWithstandOfCertDegDesc = foldlSent [phrase goal `ofThe'` phrase system,
S "is to predict whether the", phrase glaSlab, S "under consideration can",
S "withstand an", phrase explosion, S "of a certain degree"]

accAlteredGlassDesc = foldlSent [makeRefS glassCondition, S "requires that the", phrase glass +:+.
accAlteredGlassDesc = foldlSent [makeRef2S glassCondition, S "requires that the", phrase glass +:+.
S "is not altered in any way", S "Therefore, this cannot be used on altered",
phrase glass]
14 changes: 7 additions & 7 deletions code/drasil-example/Drasil/GlassBR/DataDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Data.Drasil.Concepts.PhysicalProperties (dimension)
import Data.Drasil.Citations (campidelli)
import Data.Drasil.SentenceStructures (sAnd, sOf)

import Drasil.GlassBR.Assumptions (standardValues, ldfConstant)
import Drasil.GlassBR.Assumptions (standardValues, ldfConstant, glassLite)
import Drasil.GlassBR.Concepts (annealed, fullyT, heatS)
import Drasil.GlassBR.Labels (calOfDemandL, glassLiteL)
import Drasil.GlassBR.References (astm2009, beasonEtAl1998)
Expand Down Expand Up @@ -77,8 +77,8 @@ loadDFQD :: QDefinition
loadDFQD = mkQuantDef lDurFac loadDF_eq

loadDF :: DataDefinition
loadDF = mkDD loadDFQD [makeRef astm2009] [{-derivation-}] "loadDurFactor" [makeRefS standardValues,
makeRefS ldfConstant]
loadDF = mkDD loadDFQD [makeRef astm2009] [{-derivation-}] "loadDurFactor" [makeRef2S standardValues,
makeRef2S ldfConstant]

--DD4--

Expand All @@ -105,7 +105,7 @@ nonFLQD = mkQuantDef nonFactorL nonFL_eq

nonFL :: DataDefinition
nonFL = mkDD nonFLQD [makeRef astm2009] [{-derivation-}] "nFL"
(aGrtrThanB : hRef : qHtTlTolRef : [makeRefS standardValues])
(aGrtrThanB : hRef : qHtTlTolRef : [makeRef2S standardValues])

--DD6--

Expand Down Expand Up @@ -133,7 +133,7 @@ dimLLQD = mkQuantDef dimlessLoad dimLL_eq

dimLL :: DataDefinition
dimLL = mkDD dimLLQD [makeRef astm2009, makeRef campidelli {- +:+ sParen (S "Eq. 7") -}] [{-derivation-}] "dimlessLoad"
(qRef : aGrtrThanB : hRef : gtfRef : glassLiteRef : [makeRefS standardValues])
(qRef : aGrtrThanB : hRef : gtfRef : glassLiteRef : [makeRef2S standardValues])

--DD8--

Expand Down Expand Up @@ -161,7 +161,7 @@ tolStrDisFacQD = mkQuantDef sdf_tol tolStrDisFac_eq

tolStrDisFac :: DataDefinition
tolStrDisFac = mkDD tolStrDisFacQD [makeRef astm2009] [{-derivation-}] "sdf_tol"
(jtolRelToPbtol : aGrtrThanB : hRef : ldfRef : pbTolUsr : [makeRefS standardValues])
(jtolRelToPbtol : aGrtrThanB : hRef : ldfRef : pbTolUsr : [makeRef2S standardValues])

--DD10--

Expand Down Expand Up @@ -251,4 +251,4 @@ jtolRelToPbtol :: Sentence
jtolRelToPbtol = (ch sdf_tol +:+ S " is calculated with reference to " +:+. ch pb_tol)

glassLiteRef :: Sentence
glassLiteRef = (ch dimlessLoad +:+ S "is calculated with reference to" +:+. makeRefS glassLiteL)
glassLiteRef = (ch dimlessLoad +:+ S "is calculated with reference to" +:+. makeRef2S glassLite)
6 changes: 3 additions & 3 deletions code/drasil-example/Drasil/GlassBR/IMods.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ glassBRsymb = map dqdWr [plate_len, plate_width, char_weight, standOffDist] ++
probOfBreak :: InstanceModel
probOfBreak = im' probOfBreak_RC [qw risk]
[sy risk $> 0] (qw prob_br) [sy prob_br $> 0]
(map makeRef [astm2009, beasonEtAl1998]) probOfBreakL [makeRefS standardValues, makeRefS boundaryConditions,
makeRefS responseType, makeRefS risk]
(map makeRef [astm2009, beasonEtAl1998]) probOfBreakL [makeRef2S standardValues, makeRef2S boundaryConditions,
makeRef2S responseType, makeRefS risk]

{--}

Expand All @@ -56,7 +56,7 @@ calofCapacity_RC = makeRC "calofCapacity_RC" (nounPhraseSP "Calculation of Capac

calofCapacityDesc :: Sentence
calofCapacityDesc =
foldlSent [makeRefS glassLite, makeRefS glaTyFac, makeRefS nonFL]
foldlSent [makeRef2S glassLite, makeRefS glaTyFac, makeRefS nonFL]

{--}

Expand Down
5 changes: 3 additions & 2 deletions code/drasil-lang/Language/Drasil/Chunk/Theory.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Language.Drasil.Chunk.Eq (QDefinition)
import Language.Drasil.Chunk.Quantity (QuantityDict, qw)
import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), Quantity,
Definition(defn), ConceptDomain(cdom), Concept, HasReference(getReferences),
HasAdditionalNotes(getNotes), HasLabel(getLabel), HasShortName(shortname))
HasAdditionalNotes(getNotes), HasLabel(getLabel), HasShortName(shortname), CommonIdea(abrv))
import Language.Drasil.Development.Unit (MayHaveUnit)
import Language.Drasil.Expr (Relation)
import Language.Drasil.Label.Core (Label)
Expand Down Expand Up @@ -50,7 +50,7 @@ data TheoryModel = TM
, _ref :: [Reference]
, _lb :: Label
, _notes :: [Sentence]
, ci :: CI
, _ci :: CI
}
makeLenses ''TheoryModel

Expand All @@ -72,6 +72,7 @@ instance Theory TheoryModel where
defined_fun = dfun
instance HasLabel TheoryModel where getLabel = lb
instance HasShortName TheoryModel where shortname = lb . shortname
instance CommonIdea TheoryModel where abrv = abrv . view ci

softEng :: IdeaDict
softEng = mkIdea "softEng" (cn' "Software Engineering") (Just "SE")
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-lang/Language/Drasil/Reference.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ instance Referable Citation where
instance Referable TheoryModel where
refAdd t = getAdd ((t ^. getLabel) ^. getRefAdd)
rType _ = Def TM
rProg l = Name -- FIXME: Implement Ref2 for TheoryModel
rProg l = PrependDomain (l ^. uid) $ abrv l -- FIXME: Implement Ref2 for TheoryModel

instance Referable GenDefn where
refAdd g = getAdd ((g ^. getLabel) ^. getRefAdd)
Expand Down
38 changes: 19 additions & 19 deletions code/stable/glassbr/SRS/GlassBR_SRS.tex
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ \subsubsection{Assumptions}
\item[\refstepcounter{assumpnum}\atheassumpnum\label{A:responseType}:]The response type considered in GlassBR is flexural.
\end{description}
\begin{description}
\item[\refstepcounter{assumpnum}\atheassumpnum\label{A:ldfConstant}:]With reference to A\ref{A:standardValues}, the value of load duration factor ($LDF$) is a constant in GlassBR.
\item[\refstepcounter{assumpnum}\atheassumpnum\label{A:ldfConstant}:]With reference to \hyperref[A:standardValues]{A: standardValues}, the value of load duration factor ($LDF$) is a constant in GlassBR.
\end{description}
\subsubsection{Theoretical Models}
\label{Sec:TMs}
Expand Down Expand Up @@ -532,8 +532,8 @@ \subsubsection{Data Definitions}
\item{$m$ is the surface flaw parameter ($\frac{\text{m}^{12}}{\text{N}^{7}}$)}
\end{symbDescription}
\\ \midrule \\
Notes & A\ref{A:standardValues}
A\ref{A:ldfConstant}
Notes & \hyperref[A:standardValues]{A: standardValues}
\hyperref[A:ldfConstant]{A: ldfConstant}
\\ \midrule \\
Source & \cite{astm2009}
\\ \midrule \\
Expand Down Expand Up @@ -602,7 +602,7 @@ \subsubsection{Data Definitions}
Notes & $a$, $b$ are dimensions of the plate, where ($a\geq{}b$).
$h$ is the minimum thickness, which is based on the nominal thicknesses as shown in \hyperref[DD:min.thick]{Definition~DD:min.thick}.
${\hat{q}_{tol}}$ is the tolerable load defined in \hyperref[DD:tolLoad]{Definition~DD:tolLoad}.
A\ref{A:standardValues}
\hyperref[A:standardValues]{A: standardValues}
\\ \midrule \\
Source & \cite{astm2009}
\\ \midrule \\
Expand Down Expand Up @@ -675,8 +675,8 @@ \subsubsection{Data Definitions}
$a$, $b$ are dimensions of the plate, where ($a\geq{}b$).
$h$ is the minimum thickness, which is based on the nominal thicknesses as shown in \hyperref[DD:min.thick]{Definition~DD:min.thick}.
$GTF$ is the glass type factor, as given by \hyperref[DD:gTF]{Definition~DD:gTF}.
$\hat{q}$ is calculated with reference to A\ref{A:glassLite}.
A\ref{A:standardValues}
$\hat{q}$ is calculated with reference to \hyperref[A:glassLite]{A: glassLite}.
\hyperref[A:standardValues]{A: standardValues}
\\ \midrule \\
Source & \cite{astm2009} and \cite{campidelli}
\\ \midrule \\
Expand Down Expand Up @@ -749,7 +749,7 @@ \subsubsection{Data Definitions}
$h$ is the minimum thickness, which is based on the nominal thicknesses as shown in \hyperref[DD:min.thick]{Definition~DD:min.thick}.
$LDF$ is the load duration factor as defined by \hyperref[DD:loadDurFactor]{Definition~DD:loadDurFactor}.
${P_{btol}}$ is the tolerable probability entered by the user.
A\ref{A:standardValues}
\hyperref[A:standardValues]{A: standardValues}
\\ \midrule \\
Source & \cite{astm2009}
\\ \midrule \\
Expand Down Expand Up @@ -848,9 +848,9 @@ \subsubsection{Instance Models}
\item{$B$ is the risk of failure (Unitless)}
\end{symbDescription}
\\ \midrule \\
Notes & A\ref{A:standardValues}
A\ref{A:boundaryConditions}
A\ref{A:responseType}
Notes & \hyperref[A:standardValues]{A: standardValues}
\hyperref[A:boundaryConditions]{A: boundaryConditions}
\hyperref[A:responseType]{A: responseType}
\hyperref[DD:risk.fun]{Definition~DD:risk.fun}
\\ \midrule \\
Source & \cite{astm2009} and \cite{beasonEtAl1998}
Expand Down Expand Up @@ -894,7 +894,7 @@ \subsubsection{Instance Models}
\item{$LSF$ is the load share factor (Unitless)}
\end{symbDescription}
\\ \midrule \\
Notes & A\ref{A:glassLite} \hyperref[DD:gTF]{Definition~DD:gTF} \hyperref[DD:nFL]{Definition~DD:nFL}.
Notes & \hyperref[A:glassLite]{A: glassLite} \hyperref[DD:gTF]{Definition~DD:gTF} \hyperref[DD:nFL]{Definition~DD:nFL}.
\\ \midrule \\
Source & \cite{astm2009}
\\ \midrule \\
Expand Down Expand Up @@ -989,9 +989,9 @@ \subsection{Functional Requirements}
\item[Input-Glass-Props:\phantomsection\label{inputGlassProps}]Input the quantities from Table~\ref{Table:InputGlassPropsReqInputs}, which define the glass dimensions, type of glass, tolerable probability of failure, and the characteristics of the blast. Note: $a$ and $b$ will be input in terms of millimetres and will be converted to the equivalent value in metres.
\item[System-Set-Values-Following-Assumptions:\phantomsection\label{sysSetValsFollowingAssumps}]The system shall set the known values as follows:
\begin{itemize}
\item{$m$, $k$, $E$, and ${t_{d}}$ following A\ref{A:standardValues}}
\item{$m$, $k$, $E$, and ${t_{d}}$ following \hyperref[A:standardValues]{A: standardValues}}
\item{$LDF$ from \hyperref[DD:loadDurFactor]{Definition~DD:loadDurFactor}}
\item{LSF following A\ref{A:glassLite}}
\item{LSF following \hyperref[A:glassLite]{A: glassLite}}
\item{$h$ from \hyperref[DD:min.thick]{Definition~DD:min.thick}}
\item{$GTF$ from \hyperref[DD:gTF]{Definition~DD:gTF}}
\item{$SD$ from \hyperref[DD:standOffDist]{Definition~DD:standOffDist}}
Expand Down Expand Up @@ -1051,17 +1051,17 @@ \subsection{Non-Functional Requirements}
\section{Likely Changes}
\label{Sec:LCs}
\begin{itemize}
\item[Calculate-Internal-Blask-Risk:\phantomsection\label{calcInternalBlastRisk}]A\ref{A:explainScenario} - The system currently only calculates for external blast risk. In the future, calculations can be added for the internal blast risk.
\item[Variable-Values-of-m,k,E:\phantomsection\label{varValsOfmkE}]A\ref{A:standardValues}, A\ref{A:ldfConstant} - Currently, the values for $m$, $k$, and $E$ are assumed to be the same for all glass. In the future, these values can be changed to variable inputs.
\item[Accomodate-More-than-Single-Lite:\phantomsection\label{accMoreThanSingleLite}]A\ref{A:glassLite} - The software may be changed to accommodate more than a single lite.
\item[Accomodate-More-Boundary-Conditions:\phantomsection\label{accMoreBoundaryConditions}]A\ref{A:boundaryConditions}- The software may be changed to accommodate more boundary conditions than 4-sided support.
\item[Consider-More-than-Flexure-Glass:\phantomsection\label{considerMoreThanFlexGlass}]A\ref{A:responseType} - The software may be changed to consider more than just flexure of the glass.
\item[Calculate-Internal-Blask-Risk:\phantomsection\label{calcInternalBlastRisk}]\hyperref[A:explainScenario]{A: explainScenario} - The system currently only calculates for external blast risk. In the future, calculations can be added for the internal blast risk.
\item[Variable-Values-of-m,k,E:\phantomsection\label{varValsOfmkE}]\hyperref[A:standardValues]{A: standardValues}, \hyperref[A:ldfConstant]{A: ldfConstant} - Currently, the values for $m$, $k$, and $E$ are assumed to be the same for all glass. In the future, these values can be changed to variable inputs.
\item[Accomodate-More-than-Single-Lite:\phantomsection\label{accMoreThanSingleLite}]\hyperref[A:glassLite]{A: glassLite} - The software may be changed to accommodate more than a single lite.
\item[Accomodate-More-Boundary-Conditions:\phantomsection\label{accMoreBoundaryConditions}]\hyperref[A:boundaryConditions]{A: boundaryConditions}- The software may be changed to accommodate more boundary conditions than 4-sided support.
\item[Consider-More-than-Flexure-Glass:\phantomsection\label{considerMoreThanFlexGlass}]\hyperref[A:responseType]{A: responseType} - The software may be changed to consider more than just flexure of the glass.
\end{itemize}
\section{Unlikely Changes}
\label{Sec:UCs}
\begin{itemize}
\item[Predict-Withstanding-of-Certain-Degree:\phantomsection\label{predictWithstandOfCertDeg}]The goal of the system is to predict whether the glass slab under consideration can withstand an explosion of a certain degree.
\item[Accommodate-Altered-Glass:\phantomsection\label{accAlteredGlass}]A\ref{A:glassCondition} requires that the glass is not altered in any way. Therefore, this cannot be used on altered glass.
\item[Accommodate-Altered-Glass:\phantomsection\label{accAlteredGlass}]\hyperref[A:glassCondition]{A: glassCondition} requires that the glass is not altered in any way. Therefore, this cannot be used on altered glass.
\end{itemize}
\section{Traceability Matrices and Graphs}
\label{Sec:TraceMatrices}
Expand Down

1 comment on commit bcce24c

@JacquesCarette
Copy link
Owner

Choose a reason for hiding this comment

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

The nicest thing about this change is how all the references have improved to \hyperref without 'extra' work.

Please sign in to comment.