From 39384995f7e3dc791c7a783558576520a9f8b9fb Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 09:23:47 -0400 Subject: [PATCH 1/7] Improved imports in Unit.hs --- code/drasil-lang/Language/Drasil/Development/Unit.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/drasil-lang/Language/Drasil/Development/Unit.hs b/code/drasil-lang/Language/Drasil/Development/Unit.hs index 4871cb0ec1..5c60bb4a8d 100644 --- a/code/drasil-lang/Language/Drasil/Development/Unit.hs +++ b/code/drasil-lang/Language/Drasil/Development/Unit.hs @@ -15,8 +15,9 @@ import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), Definition(defn), ConceptDomain(cdom), HasUnitSymbol(usymb), IsUnit, UnitEq(uniteq)) import Language.Drasil.Chunk.Concept (ConceptChunk, dcc, cc') -import Language.Drasil.Symbol -import Language.Drasil.Development.UnitLang +import Language.Drasil.Symbol (Symbol(Atomic)) +import Language.Drasil.Development.UnitLang (USymb(US), UDefn(UScale, USynonym, UShift), + comp_usymb, from_udefn) import Language.Drasil.NounPhrase (cn,cn',NP) From fb1f6182e1b3b003e5f08ac28117fe6764d4cc2c Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 11:21:32 -0400 Subject: [PATCH 2/7] Improved imports in Code.hs --- code/drasil-code/Language/Drasil/Code.hs | 46 ++++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/code/drasil-code/Language/Drasil/Code.hs b/code/drasil-code/Language/Drasil/Code.hs index a60a624a48..a74a8ceeda 100644 --- a/code/drasil-code/Language/Drasil/Code.hs +++ b/code/drasil-code/Language/Drasil/Code.hs @@ -34,12 +34,44 @@ module Language.Drasil.Code ( ) where import Prelude hiding (break, print, return, log, exp) -import Language.Drasil.Code.Imperative.AST +import Language.Drasil.Code.Imperative.AST (alwaysDel, neverDel, assign, at, binExpr, + break, cast, constDecDef, extends, for, + forEach, ifCond, ifExists, listDec, listDec', listDecValues, listOf, litBool, litChar, + litFloat, litInt, litObj, litObj', litString, noElse, noParent, objDecDef, oneLiner, param, + params, paramToVar, print, printLn, printStr, printStrLn, printFile, printFileLn, printFileStr, + openFileR, openFileW, closeFile, getInput, getFileInput, getFileInputAll, getFileInputLine, + printFileStrLn, return, returnVar, switch, throw, tryCatch, typ, varDec, varDecDef, + while, zipBlockWith, zipBlockWith4, addComments, comment, commentDelimit, + endCommentDelimit, prefixFirstBlock, getterName, setterName, convertToClass, + convertToMethod, bodyReplace, funcReplace, valListReplace, objDecNew, + objDecNewVoid, objDecNew', objDecNewVoid', + listSize, listAccess, listAppend, listSlice, stringSplit, + var, svToVar, objMethodCall, objMethodCallVoid, valStmt, funcApp, funcApp', func, continue, + toAbsCode, getClassName, buildModule, moduleName, + (?!), (?<), (?<=), (?>), (?>=), (?==), (?!=), (?&&), (?||), + (#~), (#/^), (#|), (#+), (#-), (#*), (#/), (#%), (#^), + (&=), (&.=), (&=.), (&+=), (&-=), (&++), (&~-), (&.+=), (&.-=), (&.++), (&.~-), + ($->), ($.), ($:), log, exp, + Body, Class, StateVar, Value, Parameter, Module, FunctionDecl, + Label, StateType, Library, Statement, + bool, int, float, char, string, infile, outfile, listT, obj, + arg, self, + methodType, methodTypeVoid, block, defaultValue, true, false, + pubClass, privClass, privMVar, pubMVar, pubGVar, privMethod, pubMethod, constructor, + mainMethod) + import Language.Drasil.Code.Imperative.LanguageRenderer (Options(..)) -import Language.Drasil.Code.Imperative.Parsers.ConfigParser -import Language.Drasil.Code.CodeGeneration + +import Language.Drasil.Code.Imperative.Parsers.ConfigParser (cSharpLabel, cppLabel, + goolLabel, javaLabel, objectiveCLabel, pythonLabel, luaLabel) + +import Language.Drasil.Code.CodeGeneration (makeCode, createCodeFiles) + import Language.Drasil.Code.DataDesc (Ind(..), junk, junkLine, listEntry, multiLine, repeated, singleLine, singleton) -import Language.Drasil.CodeSpec (($:=), Choices(..), CodeSpec, Comments(..), ConstraintBehaviour(..), Func, - FuncStmt(..), ImplementationType(..), Lang(..), Logging(..), Mod(Mod), Structure(..), asExpr, asVC, codeSpec, fdec, - ffor, funcData, funcDef, packmod, relToQD) -import Language.Drasil.Generate (gen, genCode) \ No newline at end of file + +import Language.Drasil.CodeSpec (($:=), Choices(..), CodeSpec, Comments(..), ConstraintBehaviour(..), + Func, FuncStmt(..), ImplementationType(..), Lang(..), Logging(..), Mod(Mod), Structure(..), + asExpr, asVC, codeSpec, fdec, ffor, funcData, funcDef, packmod, relToQD, + ) + +import Language.Drasil.Generate (gen, genCode) From bb5418d966b47795dcfecfc3ad3d1cd2aae7a52f Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 11:33:50 -0400 Subject: [PATCH 3/7] Corrected import of AST.hs --- code/drasil-code/Language/Drasil/Code/AST.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/drasil-code/Language/Drasil/Code/AST.hs b/code/drasil-code/Language/Drasil/Code/AST.hs index a51386a626..97b8239e74 100644 --- a/code/drasil-code/Language/Drasil/Code/AST.hs +++ b/code/drasil-code/Language/Drasil/Code/AST.hs @@ -8,8 +8,7 @@ module Language.Drasil.Code.AST where -import Language.Drasil.Chunk -import Language.Drasil.Chunk.Eq +import Language.Drasil type HighLevelCode = [Module] type Name = String @@ -41,4 +40,4 @@ data Objective where data Output where Str :: String -> Output - Var :: (Quantity c) => c -> Output \ No newline at end of file + Var :: (Quantity c) => c -> Output From 288f9a6c4f7d64983a172ce4f9affee2fdc5de5a Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 11:56:39 -0400 Subject: [PATCH 4/7] Improved imports in CodeGeneration.hs --- code/drasil-code/Language/Drasil/Code/Code.hs | 2 +- code/drasil-code/Language/Drasil/Code/CodeGeneration.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/drasil-code/Language/Drasil/Code/Code.hs b/code/drasil-code/Language/Drasil/Code/Code.hs index 72bfabfffd..4827ef98f0 100644 --- a/code/drasil-code/Language/Drasil/Code/Code.hs +++ b/code/drasil-code/Language/Drasil/Code/Code.hs @@ -16,4 +16,4 @@ data CodeType = Boolean | String | File | List CodeType - | Object String \ No newline at end of file + | Object String diff --git a/code/drasil-code/Language/Drasil/Code/CodeGeneration.hs b/code/drasil-code/Language/Drasil/Code/CodeGeneration.hs index 211b70e7ac..d761c935e4 100644 --- a/code/drasil-code/Language/Drasil/Code/CodeGeneration.hs +++ b/code/drasil-code/Language/Drasil/Code/CodeGeneration.hs @@ -23,7 +23,7 @@ import Language.Drasil.Code.Imperative.LanguageRenderer (Options) import Data.List (intercalate) import qualified Data.Map as Map (fromList,keys,lookup,Map) import Text.PrettyPrint.HughesPJ (Doc,render) -import System.IO +import System.IO (hPutStrLn, hClose, openFile, IOMode(WriteMode)) import Data.Function (fix) -- | Map of (label,config) pairs for all supported languages. From 08564f7b496852334ee7519fdd3e7f4e6b58452e Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 12:33:51 -0400 Subject: [PATCH 5/7] Improved imports in DataDesc.hs --- code/drasil-code/Language/Drasil/Code/DataDesc.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/drasil-code/Language/Drasil/Code/DataDesc.hs b/code/drasil-code/Language/Drasil/Code/DataDesc.hs index 29da5e4e1a..3d29fb63cd 100644 --- a/code/drasil-code/Language/Drasil/Code/DataDesc.hs +++ b/code/drasil-code/Language/Drasil/Code/DataDesc.hs @@ -1,7 +1,7 @@ module Language.Drasil.Code.DataDesc where import Language.Drasil -import Language.Drasil.Chunk.Code +import Language.Drasil.Chunk.Code (CodeChunk, codevar) import Data.List (nub) From e7ef068f9fabcd75a145e56bec2f411012c62a63 Mon Sep 17 00:00:00 2001 From: elwazana Date: Fri, 6 Jul 2018 13:03:58 -0400 Subject: [PATCH 6/7] Improved imports in Imperative/Helpers.hs --- code/drasil-code/Language/Drasil/Code/Imperative/Helpers.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/drasil-code/Language/Drasil/Code/Imperative/Helpers.hs b/code/drasil-code/Language/Drasil/Code/Imperative/Helpers.hs index 1ec437f13b..254831a2c2 100644 --- a/code/drasil-code/Language/Drasil/Code/Imperative/Helpers.hs +++ b/code/drasil-code/Language/Drasil/Code/Imperative/Helpers.hs @@ -9,7 +9,8 @@ import Control.Monad (filterM) import Data.Char (toUpper) import Data.String.Utils (replace) import Data.List (nub,intersperse) -import Text.PrettyPrint.HughesPJ +import Text.PrettyPrint.HughesPJ (Doc, vcat, hcat, text, char, doubleQuotes, + (<>), ($+$), comma, punctuate, nest) blank :: Doc blank = text "" From 3b2993cfe177f88124d979fd0e6304ef27298bef Mon Sep 17 00:00:00 2001 From: Maryyam Date: Fri, 6 Jul 2018 15:13:09 -0400 Subject: [PATCH 7/7] Removal of `mkDataDf'` (#779) * added DataDefinition.hs file and created DataDefinition data type * additions/upgrades added to DataDefinition type * started transfer of mkDataDef and mkDataDef' to DataDefinition file * transfer of mkDataDef no longer breaks compilation * created mkDD smart constructor * made DataDefinition an instance of all the classes QDefinition is an instance of; temporarily expects a shortname instead of the desired label * made first datadefinition * undoes some changes from previous commit * created DataDefinitions for GlassBR * broken; attempted to replace calls to [QDefinition] with calls to [DataDefinition] * updated version number to avoid import error; now get error from before merge * made progress; callstack outputs a conversion error from use of ConvertRel * GlassBR's data definitions are rendered using DataDefinitions instead of QDefinitions * updated stable for notes added to GlassBR * added a note to GlassBR DD9 as mentioned in #350 * removed all instances of mkDataDef' --- .../Language/Drasil/Code/Imperative/Import.hs | 2 +- code/drasil-data/Data/Drasil/Utils.hs | 17 --- .../drasil-example/Drasil/DocumentLanguage.hs | 10 +- .../Drasil/DocumentLanguage/Definitions.hs | 34 ++++- .../Drasil/GamePhysics/DataDefs.hs | 1 - code/drasil-example/Drasil/GlassBR/Body.hs | 8 +- .../drasil-example/Drasil/GlassBR/DataDefs.hs | 66 +++++++--- code/drasil-example/Drasil/GlassBR/Unitals.hs | 2 +- code/drasil-example/Drasil/SSP/DataDefs.hs | 2 +- code/drasil-example/Drasil/SWHS/DataDefs.hs | 1 - code/drasil-example/Drasil/SWHS/Unitals.hs | 1 - code/drasil-lang/Language/Drasil.hs | 9 +- .../Language/Drasil/Chunk/DataDefinition.hs | 44 ++++++- code/drasil-lang/Language/Drasil/Chunk/Eq.hs | 10 +- code/drasil-lang/Language/Drasil/Document.hs | 4 +- code/drasil-lang/Language/Drasil/Reference.hs | 5 + code/stable/glassbr/SRS/GlassBR_SRS.tex | 28 +++++ code/stable/glassbr/Website/GlassBR_SRS.html | 119 ++++++++++++++++++ 18 files changed, 306 insertions(+), 57 deletions(-) diff --git a/code/drasil-code/Language/Drasil/Code/Imperative/Import.hs b/code/drasil-code/Language/Drasil/Code/Imperative/Import.hs index 4e352cf41d..877f55ded0 100644 --- a/code/drasil-code/Language/Drasil/Code/Imperative/Import.hs +++ b/code/drasil-code/Language/Drasil/Code/Imperative/Import.hs @@ -1,6 +1,6 @@ module Language.Drasil.Code.Imperative.Import(generator, generateCode) where -import Language.Drasil hiding (int) +import Language.Drasil hiding (int, getLabel) import Language.Drasil.Code.Code as C import Language.Drasil.Code.Imperative.AST as I hiding ((&=), State, assign, return, Not, Tan, Cos, Sin, Exp, Abs, Log, And, Or) diff --git a/code/drasil-data/Data/Drasil/Utils.hs b/code/drasil-data/Data/Drasil/Utils.hs index 85491783f7..74838463ba 100644 --- a/code/drasil-data/Data/Drasil/Utils.hs +++ b/code/drasil-data/Data/Drasil/Utils.hs @@ -22,7 +22,6 @@ module Data.Drasil.Utils , fmtU , unwrap , fterms - , mkDataDef, mkDataDef' , prodUCTbl , eqUnR ) where @@ -175,22 +174,6 @@ unwrap :: (Maybe UnitDefn) -> Sentence unwrap (Just a) = Sy (a ^. usymb) unwrap Nothing = EmptyS --- Used to help make Qdefinitions when uid, term, and symbol come from the same source -mkDataDef :: (Quantity c) => c -> Expr -> QDefinition -mkDataDef cncpt equation = datadef $ getUnit cncpt --should references be passed in at this point? - where datadef (Just a) = fromEqn (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) a equation [] (cncpt ^. uid) --shortname - datadef Nothing = fromEqn' (cncpt ^. uid) (cncpt ^. term) EmptyS - (eqSymb cncpt) equation [] (cncpt ^. uid) --shortname - --- Same as 'mkDataDef', but with an additional Sentence that can be taken as "extra information"; issue #350 -mkDataDef' :: (Quantity c) => c -> Expr -> Sentence -> References -> QDefinition -mkDataDef' cncpt equation extraInfo refs = datadef $ getUnit cncpt - where datadef (Just a) = fromEqn (cncpt ^. uid) (cncpt ^. term) extraInfo - (eqSymb cncpt) a equation refs (cncpt ^. uid) --shortname - datadef Nothing = fromEqn' (cncpt ^. uid) (cncpt ^. term) extraInfo - (eqSymb cncpt) equation refs (cncpt ^. uid) --shortname - prodUCTbl :: [[Sentence]] -> Contents prodUCTbl cases = Table [S "Actor", titleize input_ +:+ S "and" +:+ titleize output_] cases diff --git a/code/drasil-example/Drasil/DocumentLanguage.hs b/code/drasil-example/Drasil/DocumentLanguage.hs index ff37467fc3..c3cf93dfa3 100644 --- a/code/drasil-example/Drasil/DocumentLanguage.hs +++ b/code/drasil-example/Drasil/DocumentLanguage.hs @@ -7,7 +7,7 @@ -- instead. module Drasil.DocumentLanguage where -import Drasil.DocumentLanguage.Definitions (Fields, ddefn, derivation, +import Drasil.DocumentLanguage.Definitions (Fields, ddefn, ddefn', derivation, instanceModel, gdefn, tmodel) import Language.Drasil hiding (Manual, Vector) -- Manual - Citation name conflict. FIXME: Move to different namespace @@ -193,6 +193,7 @@ data SCSSub where TMs :: Fields -> [TheoryModel] -> SCSSub GDs :: Fields -> [GenDefn] -> DerivationDisplay -> SCSSub DDs :: Fields -> [QDefinition] -> DerivationDisplay -> SCSSub --FIXME: Need DD intro + DDs' :: Fields -> [DataDefinition] -> DerivationDisplay -> SCSSub --FIXME: Need DD intro -- should eventually replace and be renamed to DDs IMs :: Fields -> [InstanceModel] -> DerivationDisplay -> SCSSub Constraints :: Sentence -> Sentence -> Sentence -> [Contents] {-Fields -> [UncertainWrapper] -> [ConstrainedChunk]-} -> SCSSub --FIXME: temporary definition? --FIXME: Work in Progress ^ @@ -430,7 +431,8 @@ mkSolChSpec si (SCSProg l) = mkSubSCS _ (SCSSubVerb s) = s mkSubSCS _ (TMs _ []) = error "There are no Theoretical Models" mkSubSCS _ (GDs _ [] _) = SSD.genDefnF [] - mkSubSCS _ (DDs _ [] _) = error "There are no Data Definitions" + mkSubSCS _ (DDs _ [] _) = error "There are no Data Definitions" + mkSubSCS _ (DDs' _ [] _) = error "There are no Data Definitions" --FIXME: temporary duplicate mkSubSCS _ (IMs _ [] _) = error "There are no Instance Models" mkSubSCS si' (TMs fields ts) = SSD.thModF (siSys si') (map (tmodel fields (_sysinfodb si')) ts) @@ -438,6 +440,10 @@ mkSolChSpec si (SCSProg l) = SSD.dataDefnF EmptyS (concatMap (\x -> ddefn fields (_sysinfodb si') x : derivation x) dds) mkSubSCS si' (DDs fields dds _) = SSD.dataDefnF EmptyS (map (ddefn fields (_sysinfodb si')) dds) + mkSubSCS si' (DDs' fields dds ShowDerivation) = --FIXME: need to keep track of DD intro. --FIXME: temporary duplicate + SSD.dataDefnF EmptyS (concatMap (\x -> ddefn' fields (_sysinfodb si') x : derivation x) dds) + mkSubSCS si' (DDs' fields dds _) = --FIXME: temporary duplicate + SSD.dataDefnF EmptyS (map (ddefn' fields (_sysinfodb si')) dds) mkSubSCS si' (GDs fields gs' ShowDerivation) = SSD.genDefnF (concatMap (\x -> gdefn fields (_sysinfodb si') x : derivation x) gs') mkSubSCS si' (GDs fields gs' _) = diff --git a/code/drasil-example/Drasil/DocumentLanguage/Definitions.hs b/code/drasil-example/Drasil/DocumentLanguage/Definitions.hs index 8c77d65da8..b5492100a8 100644 --- a/code/drasil-example/Drasil/DocumentLanguage/Definitions.hs +++ b/code/drasil-example/Drasil/DocumentLanguage/Definitions.hs @@ -5,7 +5,7 @@ module Drasil.DocumentLanguage.Definitions , Field(..) , Verbosity(..) , tmodel - , ddefn + , ddefn, ddefn' , gdefn, derivation , instanceModel , InclUnits(..) @@ -50,6 +50,9 @@ tmodel fs m t = Defnt TM (foldr (mkTMField t m) [] fs) (refAdd t) ddefn :: HasSymbolTable ctx => Fields -> ctx -> QDefinition -> Contents ddefn fs m d = Defnt DD (foldr (mkQField d m) [] fs) (refAdd d) +ddefn' :: HasSymbolTable ctx => Fields -> ctx -> DataDefinition -> Contents +ddefn' fs m d = Defnt DD (foldr (mkDDField d m) [] fs) (refAdd d) + -- | Create a general definition using a list of fields, database of symbols, -- and a 'GenDefn' (general definition) chunk (called automatically by 'SCSSub' -- program) @@ -97,7 +100,7 @@ tConToExpr (TCon AssumedCon x) = x -- TODO: buildDescription gets list of constraints to expr and ignores 't'. -- | Create the fields for a definition from a QDefinition (used by ddefn) -mkQField :: HasSymbolTable ctx => QDefinition -> ctx -> Field -> ModRow -> ModRow +mkQField :: (HasSymbolTable ctx) => QDefinition -> ctx -> Field -> ModRow -> ModRow mkQField d _ l@Label fs = (show l, (Paragraph $ at_start d):[]) : fs mkQField d _ l@Symbol fs = (show l, (Paragraph $ (P $ eqSymb d)):[]) : fs mkQField d _ l@Units fs = (show l, (Paragraph $ (unit'2Contents d)):[]) : fs @@ -110,6 +113,19 @@ mkQField d _ l@(Notes) fs = maybe fs (\ss -> (show l, map Paragraph ss) : fs) (d mkQField _ _ label _ = error $ "Label " ++ show label ++ " not supported " ++ "for data definitions" +-- | Create the fields for a definition from a QDefinition (used by ddefn) +mkDDField :: (HasSymbolTable ctx) => DataDefinition -> ctx -> Field -> ModRow -> ModRow +mkDDField d _ l@Label fs = (show l, (Paragraph $ at_start d):[]) : fs +mkDDField d _ l@Symbol fs = (show l, (Paragraph $ (P $ eqSymb d)):[]) : fs +mkDDField d _ l@Units fs = (show l, (Paragraph $ (unit'2Contents d)):[]) : fs +mkDDField d _ l@DefiningEquation fs = (show l, (eqUnR $ sy d $= d ^. relat):[]) : fs --FIXME: appending symbol should be done in the printing stage +mkDDField d m l@(Description v u) fs = + (show l, buildDDescription' v u d m) : fs +mkDDField _ _ l@(RefBy) fs = (show l, fixme) : fs --FIXME: fill this in +mkDDField d _ l@(Source) fs = (show l, [Paragraph $ getSource d]) : fs +mkDDField d _ l@(Notes) fs = maybe fs (\ss -> (show l, map Paragraph ss) : fs) (d ^. getNotes) +mkDDField _ _ label _ = error $ "Label " ++ show label ++ " not supported " ++ + "for data definitions" -- | Create the description field (if necessary) using the given verbosity and -- including or ignoring units for a model / general definition @@ -127,6 +143,14 @@ buildDDescription Succinct u d _ = [Enumeration (Definitions $ (firstPair u d):[ buildDDescription Verbose u d m = [Enumeration (Definitions (firstPair u d : descPairs u (vars (d^.equat) m)))] +-- | Create the description field (if necessary) using the given verbosity and +-- including or ignoring units for a data definition +buildDDescription' :: HasSymbolTable ctx => Verbosity -> InclUnits -> DataDefinition -> ctx -> + [Contents] +buildDDescription' Succinct u d _ = [Enumeration (Definitions $ (firstPair' u d):[])] +buildDDescription' Verbose u d m = [Enumeration (Definitions + (firstPair' u d : descPairs u (vars (d^.relat) m)))] + -- | Create the fields for a general definition from a 'GenDefn' chunk. mkGDField :: HasSymbolTable ctx => GenDefn -> ctx -> Field -> ModRow -> ModRow mkGDField g _ l@Label fs = (show l, (Paragraph $ at_start g):[]) : fs @@ -173,6 +197,12 @@ firstPair :: InclUnits -> QDefinition -> ListPair firstPair (IgnoreUnits) d = (P (eqSymb d), Flat (phrase d)) firstPair (IncludeUnits) d = (P (eqSymb d), Flat (phrase d +:+ sParen (unit'2Contents d))) +-- | Used for definitions. The first pair is the symbol of the quantity we are +-- defining. +firstPair' :: InclUnits -> DataDefinition -> ListPair +firstPair' (IgnoreUnits) d = (P (eqSymb d), Flat (phrase d)) +firstPair' (IncludeUnits) d = (P (eqSymb d), Flat (phrase d +:+ sParen (unit'2Contents d))) + -- | Create the descriptions for each symbol in the relation/equation descPairs :: (Quantity q) => InclUnits -> [q] -> [ListPair] descPairs IgnoreUnits = map (\x -> (P (eqSymb x), Flat $ phrase x)) diff --git a/code/drasil-example/Drasil/GamePhysics/DataDefs.hs b/code/drasil-example/Drasil/GamePhysics/DataDefs.hs index ea7ed4a9f3..d3400a3ba9 100644 --- a/code/drasil-example/Drasil/GamePhysics/DataDefs.hs +++ b/code/drasil-example/Drasil/GamePhysics/DataDefs.hs @@ -9,7 +9,6 @@ import qualified Data.Drasil.Quantities.Math as QM (orientation) import qualified Data.Drasil.Quantities.Physics as QP (angularAccel, angularDisplacement, angularVelocity, displacement, impulseS, linearAccel, linearDisplacement, linearVelocity, position, restitutionCoef, time, velocity) -import Data.Drasil.Utils (mkDataDef) ----- Data Definitions ----- diff --git a/code/drasil-example/Drasil/GlassBR/Body.hs b/code/drasil-example/Drasil/GlassBR/Body.hs index 616a8e88db..44a43ba4bb 100644 --- a/code/drasil-example/Drasil/GlassBR/Body.hs +++ b/code/drasil-example/Drasil/GlassBR/Body.hs @@ -55,7 +55,7 @@ import Drasil.GlassBR.Changes (likelyChanges_SRS, unlikelyChanges_SRS) import Drasil.GlassBR.Concepts (aR, lShareFac, gLassBR, stdOffDist, glaSlab, blastRisk, glass, glaPlane, glassBRProg, ptOfExplsn, acronyms) import Drasil.GlassBR.DataDefs (dataDefns, gbQDefns, hFromt, strDisFac, nonFL, - dimLL, glaTyFac, tolStrDisFac, tolPre, risk) + dimLL, glaTyFac, tolStrDisFac, tolPre, risk, qDefns) import Drasil.GlassBR.ModuleDefs (allMods) import Drasil.GlassBR.References (rbrtsn2012) import Drasil.GlassBR.Symbols (this_symbols) @@ -125,7 +125,7 @@ mkSRS = RefSec (RefProg intro [TUnits, tsymb [TSPurpose, SymbOrder], TAandA]) : [ Assumptions , TMs ([Label] ++ stdFields) [t1IsSafe, t2IsSafe] , GDs [] [] HideDerivation -- No Gen Defs for GlassBR - , DDs ([Label, Symbol, Units] ++ stdFields) dataDefns ShowDerivation + , DDs' ([Label, Symbol, Units] ++ stdFields) dataDefns ShowDerivation , IMs ([Label, Input, Output, InConstraints, OutConstraints] ++ stdFields) [probOfBreak, calofCapacity, calofDemand, testIMFromQD] HideDerivation , Constraints (EmptyS) (dataConstraintUncertainty) (foldlSent [(makeRef (SRS.valsOfAuxCons SRS.missingP [])), S "gives", (plural value `ofThe` S "specification"), @@ -161,7 +161,7 @@ glassSystInfo = SI { _units = map unitWrapper [metre, second, kilogram] ++ map unitWrapper [pascal, newton], _quants = this_symbols, _concepts = [] :: [DefinedQuantityDict], - _definitions = dataDefns ++ + _definitions = qDefns ++ (map (relToQD gbSymbMap) iModels {-[RelationConcept]-}) ++ (map (relToQD gbSymbMap) tModels {-[RelationConcept]-}) ++ [wtntWithEqn, sdWithEqn], -- wtntWithEqn is defined in Unitals but only appears @@ -622,7 +622,7 @@ traceability_matrices_and_graphs_instaModel = ["IM1", "IM2", "IM3"] traceability_matrices_and_graphs_instaModelRef = map (refFromType Theory) iModels traceability_matrices_and_graphs_dataDef = ["DD1", "DD2", "DD3", "DD4", "DD5", "DD6", "DD7", "DD8"] -traceability_matrices_and_graphs_dataDefRef = map (refFromType Data) dataDefns +traceability_matrices_and_graphs_dataDefRef = map (refFromType Data') dataDefns traceability_matrices_and_graphs_data = ["Data Constraints"] traceability_matrices_and_graphs_dataRef = [makeRef (SRS.datCon SRS.missingP [])] diff --git a/code/drasil-example/Drasil/GlassBR/DataDefs.hs b/code/drasil-example/Drasil/GlassBR/DataDefs.hs index 7cdb1d9863..f6692684d1 100644 --- a/code/drasil-example/Drasil/GlassBR/DataDefs.hs +++ b/code/drasil-example/Drasil/GlassBR/DataDefs.hs @@ -1,5 +1,5 @@ module Drasil.GlassBR.DataDefs (dataDefns, dimLL, gbQDefns, glaTyFac, hFromt, - nonFL, risk, strDisFac, tolPre, tolStrDisFac) where + nonFL, risk, strDisFac, tolPre, tolStrDisFac, qDefns) where import Language.Drasil @@ -14,7 +14,7 @@ import Data.Drasil.Concepts.Documentation (datum, user) import Data.Drasil.Concepts.Math (probability, parameter, calculation) import Data.Drasil.Concepts.PhysicalProperties (dimension) import Data.Drasil.SentenceStructures (sAnd) -import Data.Drasil.Utils (getES, mkDataDef, mkDataDef') +import Data.Drasil.Utils (getES) import Control.Lens ((^.)) @@ -22,9 +22,12 @@ import Control.Lens ((^.)) -- DATA DEFINITIONS -- ---------------------- -dataDefns :: [QDefinition] -dataDefns = [risk, hFromt, strDisFac, nonFL, glaTyFac, dimLL, tolPre, - tolStrDisFac] +dataDefns :: [DataDefinition] +dataDefns = [riskDD, hFromtDD, strDisFacDD, nonFLDD, glaTyFacDD, dimLLDD, + tolPreDD, tolStrDisFacDD] + +qDefns :: [QDefinition] +qDefns = [risk, hFromt, strDisFac, nonFL, glaTyFac, dimLL, tolPre, tolStrDisFac] gbQDefns :: [Block QDefinition] gbQDefns = [Parallel hFromt {-DD2-} [glaTyFac {-DD6-}]] ++ --can be calculated on their own @@ -41,7 +44,11 @@ risk_eq = ((sy sflawParamK) / -- FIXME [4] !!! risk :: QDefinition -risk = mkDataDef' risk_fun risk_eq (aGrtrThanB +:+ hRef +:+ ldfRef +:+ jRef) [sourceref $ S "[4]"] +risk = mkDataDef risk_fun risk_eq + +riskDD :: DataDefinition +riskDD = mkDD risk [sourceref $ S "[4]"] [{-derivation-}] ""{-temporary-} + (Just $ aGrtrThanB : hRef : ldfRef : jRef : []) --DD2-- @@ -53,9 +60,13 @@ hFromt_helper :: Double -> Double -> (Expr, Relation) hFromt_helper result condition = (dbl result, (sy nom_thick) $= dbl condition) hFromt :: QDefinition -hFromt = mkDataDef' act_thick hFromt_eq (hMin) [] +hFromt = mkDataDef act_thick hFromt_eq + +hFromtDD :: DataDefinition +hFromtDD = mkDD hFromt [{-references-}] [{-derivation-}] ""--temporary + (Just $ [hMin]) ---DD3-- +--DD3-- (#749) -- loadDF_eq :: Expr -- loadDF_eq = (sy load_dur / 60) $^ (sy sflawParamM / 16) @@ -71,7 +82,11 @@ strDisFac_eq = apply (sy stressDistFac) --strDisFac_eq = FCall (asExpr interpZ) [V "SDF.txt", (sy plate_len) / (sy plate_width), sy dimlessLoad] strDisFac :: QDefinition -strDisFac = mkDataDef' stressDistFac strDisFac_eq (jRef2 +:+ qHtRef +:+ aGrtrThanB) [] +strDisFac = mkDataDef stressDistFac strDisFac_eq + +strDisFacDD :: DataDefinition +strDisFacDD = mkDD strDisFac [{-references-}] [{-derivation-}] ""--temporary + (Just $ [jRef2] ++ [qHtRef] ++ [aGrtrThanB]) --DD5-- @@ -80,7 +95,11 @@ nonFL_eq = ((sy tolLoad) * (sy mod_elas) * (sy act_thick) $^ 4) / (square (sy plate_len * sy plate_width)) nonFL :: QDefinition -nonFL = mkDataDef' nonFactorL nonFL_eq (aGrtrThanB +:+ hRef +:+ qHtTlTolRef) [] +nonFL = mkDataDef nonFactorL nonFL_eq + +nonFLDD :: DataDefinition +nonFLDD = mkDD nonFL [{-references-}] [{-derivation-}] ""--temporary + (Just $ aGrtrThanB : hRef : qHtTlTolRef : []) --DD6-- @@ -93,6 +112,10 @@ glaTyFac_helper result condition = (int result, (sy glass_type) $= str condition glaTyFac :: QDefinition glaTyFac = mkDataDef gTF glaTyFac_eq +glaTyFacDD :: DataDefinition +glaTyFacDD = mkDD glaTyFac [{-references-}] [{-derivation-}] ""--temporary + Nothing + --DD7-- dimLL_eq :: Expr @@ -100,7 +123,11 @@ dimLL_eq = ((sy demand) * (square (sy plate_len * sy plate_width))) / ((sy mod_elas) * (sy act_thick $^ 4) * (sy gTF)) dimLL :: QDefinition -dimLL = mkDataDef' dimlessLoad dimLL_eq (qRef +:+ aGrtrThanB +:+ hRef +:+ gtfRef) [] +dimLL = mkDataDef dimlessLoad dimLL_eq + +dimLLDD :: DataDefinition +dimLLDD = mkDD dimLL [{-references-}] [{-derivation-}] ""--temporary + (Just $ qRef : aGrtrThanB : hRef : gtfRef : []) --DD8-- @@ -109,7 +136,11 @@ tolPre_eq = apply (sy tolLoad) [sy sdf_tol, (sy plate_len) / (sy plate_width)] --tolPre_eq = FCall (asExpr interpY) [V "SDF.txt", (sy plate_len) / (sy plate_width), sy sdf_tol] tolPre :: QDefinition -tolPre = mkDataDef' tolLoad tolPre_eq (qHtTlExtra) [] +tolPre = mkDataDef tolLoad tolPre_eq + +tolPreDD :: DataDefinition +tolPreDD = mkDD tolPre [{-references-}] [{-derivation-}] ""--temporary + (Just $ qHtTlExtra : []) --DD9-- @@ -120,9 +151,13 @@ tolStrDisFac_eq = log (log (1 / (1 - (sy pb_tol))) (square (sy act_thick)))) $^ (sy sflawParamM) * (sy lDurFac))))) tolStrDisFac :: QDefinition -tolStrDisFac = mkDataDef' sdf_tol tolStrDisFac_eq (aGrtrThanB +:+ hRef +:+ ldfRef +:+ pbTolUsr) [] +tolStrDisFac = mkDataDef sdf_tol tolStrDisFac_eq ---Issue #350 +tolStrDisFacDD :: DataDefinition +tolStrDisFacDD = mkDD tolStrDisFac [{-references-}] [{-derivation-}] ""--temporary + (Just $ jtolRelToPbtol : aGrtrThanB : hRef : ldfRef : pbTolUsr : []) + +--Additional Notes-- aGrtrThanB :: Sentence aGrtrThanB = ((getES plate_len) `sC` (getES plate_width) +:+ @@ -172,3 +207,6 @@ jRef2 :: Sentence jRef2 = (getES stressDistFac +:+ S "is the" +:+ phrase stressDistFac `sC` S "which is obtained by" +:+ S "interpolating from" +:+ plural datum +:+. S "shown in Figure 7") + +jtolRelToPbtol :: Sentence +jtolRelToPbtol = (getES sdf_tol +:+ S " is calculated with reference to " +:+. getES pb_tol) \ No newline at end of file diff --git a/code/drasil-example/Drasil/GlassBR/Unitals.hs b/code/drasil-example/Drasil/GlassBR/Unitals.hs index 7fbe2347cc..1059b1a9f5 100644 --- a/code/drasil-example/Drasil/GlassBR/Unitals.hs +++ b/code/drasil-example/Drasil/GlassBR/Unitals.hs @@ -14,7 +14,7 @@ import Data.Drasil.SentenceStructures (displayConstrntsAsSet, foldlSent, foldlsC, foldlOptions) import Data.Drasil.SI_Units (kilogram, kilopascal, metre, millimetre, pascal, second) -import Data.Drasil.Utils (getES, mkDataDef) +import Data.Drasil.Utils (getES) --FIXME: Many of the current terms can be separated into terms and defns? diff --git a/code/drasil-example/Drasil/SSP/DataDefs.hs b/code/drasil-example/Drasil/SSP/DataDefs.hs index 0beda4bbf4..0cf80c396a 100644 --- a/code/drasil-example/Drasil/SSP/DataDefs.hs +++ b/code/drasil-example/Drasil/SSP/DataDefs.hs @@ -20,7 +20,7 @@ import Drasil.SSP.Unitals (baseAngle, baseHydroForce, baseLngth, baseWthX, import Drasil.DocumentLanguage.RefHelpers (ModelDB, ddRefDB, mdb, refDD) import Data.Drasil.Quantities.SolidMechanics as SM (poissnsR) -import Data.Drasil.Utils (eqUnR, getES, mkDataDef) +import Data.Drasil.Utils (eqUnR, getES) -- Needed for derivations import Data.Drasil.Concepts.Documentation (definition, element, value) diff --git a/code/drasil-example/Drasil/SWHS/DataDefs.hs b/code/drasil-example/Drasil/SWHS/DataDefs.hs index adaafdd213..72c023cebd 100644 --- a/code/drasil-example/Drasil/SWHS/DataDefs.hs +++ b/code/drasil-example/Drasil/SWHS/DataDefs.hs @@ -10,7 +10,6 @@ import Drasil.SWHS.Unitals (melt_frac, latentE_P, htFusion, pcm_mass, import Data.Drasil.Quantities.Physics (time) import Data.Drasil.Quantities.PhysicalProperties (mass) import Data.Drasil.Quantities.Thermodynamics (latent_heat) -import Data.Drasil.Utils (mkDataDef) ddRef :: QDefinition -> Sentence ddRef = refDD (ddRefDB swhsRefMDB) diff --git a/code/drasil-example/Drasil/SWHS/Unitals.hs b/code/drasil-example/Drasil/SWHS/Unitals.hs index faadb7d57e..1b3f1d9f18 100644 --- a/code/drasil-example/Drasil/SWHS/Unitals.hs +++ b/code/drasil-example/Drasil/SWHS/Unitals.hs @@ -15,7 +15,6 @@ import Data.Drasil.Quantities.Math (surface, uNormalVect, surArea) import Data.Drasil.Quantities.PhysicalProperties (mass, density, vol) import Drasil.SWHS.Concepts (water, coil, phsChgMtrl) import Data.Drasil.Units.PhysicalProperties (densityU) -import Data.Drasil.Utils(mkDataDef) import Data.Drasil.Quantities.Math (gradient) import Data.Drasil.Constraints (gtZeroConstr) import Data.Drasil.Phrase (of_) diff --git a/code/drasil-lang/Language/Drasil.hs b/code/drasil-lang/Language/Drasil.hs index 88021141bb..0e1791b051 100644 --- a/code/drasil-lang/Language/Drasil.hs +++ b/code/drasil-lang/Language/Drasil.hs @@ -41,6 +41,7 @@ module Language.Drasil ( , UID -- Classes , HasUID(uid) + , HasLabel(getLabel) , NamedIdea(term) , HasAdditionalNotes(getNotes) , Idea(getA) @@ -79,6 +80,8 @@ module Language.Drasil ( , cnstrw -- Chunk.Eq , QDefinition, fromEqn, fromEqn', fromEqn'', getVC, equat, ec + -- Chunk.DataDefinition + , DataDefinition, mkDataDef, mkDD -- Chunk.GenDefn , GenDefn, gd, gdUnit -- Chunk.InstanceModel @@ -234,7 +237,7 @@ import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), Definition(defn), ConceptDomain(cdom), Concept, HasSymbol(symbol),HasSpace(typ), HasUnitSymbol(usymb), IsUnit, CommonIdea(abrv), HasAdditionalNotes(getNotes), Constrained(constraints), HasReasVal(reasVal), ExprRelat(relat), HasDerivation(derivations), - HasReference(getReferences)) + HasReference(getReferences), HasLabel(getLabel)) import Language.Drasil.Chunk.AssumpChunk import Language.Drasil.Chunk.Attribute import Language.Drasil.Chunk.Derivation (Derivation) @@ -268,6 +271,7 @@ import Language.Drasil.Chunk.Constrained.Core (physc, sfwrc, enumc, isPhysC, isS Constraint(..), ConstraintReason(..), Reason(..), TheoryConstraint(..)) import Language.Drasil.Chunk.DefinedQuantity import Language.Drasil.Chunk.Eq (QDefinition, fromEqn, fromEqn', fromEqn'', getVC, equat, ec) +import Language.Drasil.Chunk.DataDefinition (DataDefinition, mkDataDef, mkDD) import Language.Drasil.Chunk.GenDefn import Language.Drasil.Chunk.Goal (Goal, mkGoal) import Language.Drasil.Chunk.InstanceModel @@ -308,6 +312,7 @@ import Language.Drasil.Printing.Helpers (capitalize, paren, sqbrac) --import Language.Drasil.Generate -- moved in SubPackages import Language.Drasil.People (People, Person, person, HasName(..), manyNames ,person', personWM, personWM', mononym, name) + --import Language.Drasil.CodeSpec hiding (outputs, inputs) -- moved in SubPackages --import Language.Drasil.Code.DataDesc -- moved in SubPackages --import Language.Drasil.Code.Imperative.Lang -- moved in SubPackages @@ -318,4 +323,4 @@ import Language.Drasil.Format(Format(TeX, HTML)) import Language.Drasil.TeX.Print (genTeX) import Language.Drasil.HTML.Print (genHTML) import Language.Drasil.HTML.Helpers (makeCSS) -import Language.Drasil.Make.Print (genMake) \ No newline at end of file +import Language.Drasil.Make.Print (genMake) diff --git a/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs b/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs index 8a93cc9342..81696f8d37 100644 --- a/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs +++ b/code/drasil-lang/Language/Drasil/Chunk/DataDefinition.hs @@ -2,19 +2,55 @@ module Language.Drasil.Chunk.DataDefinition where import Language.Drasil.Chunk.Eq (QDefinition) -import Language.Drasil.Spec (Sentence) +import Language.Drasil.Spec (Sentence(EmptyS)) import Language.Drasil.Label.Core (Label) import Language.Drasil.Chunk.References (References) import Language.Drasil.Chunk.Derivation (Derivation) +import Language.Drasil.Expr (Expr) +import Language.Drasil.Chunk.Quantity (Quantity(getUnit), HasSpace(typ), QuantityDict, + mkQuant, qw) +import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), + HasSymbol(symbol), IsUnit, ExprRelat(relat), HasDerivation(derivations), + HasReference(getReferences), ConceptDomain, HasAdditionalNotes(getNotes)) +import Language.Drasil.Chunk.SymbolForm (eqSymb) +import Language.Drasil.Chunk.ShortName (ShortName, HasShortName(shortname), shortname') -import Control.Lens(makeLenses) +import Control.Lens(makeLenses, (^.), view) + +import Language.Drasil.Chunk.Eq(fromEqn, fromEqn') -- A data definition is a QDefinition that may have additional notes. -- It also has attributes like derivation, source, etc. data DataDefinition = DD { _qd :: QDefinition , _ref :: References , _deri :: Derivation - , _lbl :: Label + , _lbl :: ShortName {-FIXME: Upgrade to Label-} , _notes :: Maybe [Sentence] } -makeLenses ''DataDefinition \ No newline at end of file +makeLenses ''DataDefinition + +-- this works because UnitalChunk is a Chunk +instance HasUID DataDefinition where uid = qd . uid +instance NamedIdea DataDefinition where term = qd . term +instance Idea DataDefinition where getA c = getA $ c ^. qd +instance HasSpace DataDefinition where typ = qd . typ +instance HasSymbol DataDefinition where symbol e st = symbol (e^.qd) st +instance Quantity DataDefinition where getUnit (DD a _ _ _ _) = getUnit a +instance ExprRelat DataDefinition where relat = qd . relat +instance HasReference DataDefinition where getReferences = ref +instance Eq DataDefinition where a == b = (a ^. uid) == (b ^. uid) +instance HasDerivation DataDefinition where derivations = deri +instance HasAdditionalNotes DataDefinition where getNotes = notes +instance HasShortName DataDefinition where shortname = view lbl + +-- Used to help make Qdefinitions when uid, term, and symbol come from the same source +mkDataDef :: (Quantity c) => c -> Expr -> QDefinition +mkDataDef cncpt equation = datadef $ getUnit cncpt --should references be passed in at this point? + where datadef (Just a) = fromEqn (cncpt ^. uid) (cncpt ^. term) EmptyS + (eqSymb cncpt) a equation [] (cncpt ^. uid) --shortname + datadef Nothing = fromEqn' (cncpt ^. uid) (cncpt ^. term) EmptyS + (eqSymb cncpt) equation [] (cncpt ^. uid) --shortname + +-- | Smart constructor for data definitions +mkDD :: QDefinition -> References -> Derivation -> String{-Label-} -> Maybe [Sentence] -> DataDefinition +mkDD a b c _ e = DD a b c (shortname' $ a ^. uid {-shortname' d-}) e -- FIXME: should the shortname be passed in or derived? \ No newline at end of file diff --git a/code/drasil-lang/Language/Drasil/Chunk/Eq.hs b/code/drasil-lang/Language/Drasil/Chunk/Eq.hs index 883a7ce351..5f4ac71bd9 100644 --- a/code/drasil-lang/Language/Drasil/Chunk/Eq.hs +++ b/code/drasil-lang/Language/Drasil/Chunk/Eq.hs @@ -5,7 +5,7 @@ module Language.Drasil.Chunk.Eq import Control.Lens ((^.), makeLenses, view) import Language.Drasil.Expr (Expr) -import Language.Drasil.Classes (HasUID(uid),NamedIdea(term), Idea(getA), +import Language.Drasil.Classes (HasUID(uid), NamedIdea(term), Idea(getA), HasSymbol(symbol), IsUnit, ExprRelat(relat), HasDerivation(derivations), HasReference(getReferences), ConceptDomain, HasAdditionalNotes(getNotes)) import Language.Drasil.Chunk.References (References) @@ -25,10 +25,10 @@ import Language.Drasil.Spec (Sentence) data QDefinition = EC { _qua :: QuantityDict , _equat :: Expr - , _ref :: References - , _deri :: Derivation - , _refName :: ShortName - , _notes :: Maybe [Sentence] + , _ref :: References -- FIXME: to be removed + , _deri :: Derivation -- FIXME: to be removed + , _refName :: ShortName -- FIXME: to be removed + , _notes :: Maybe [Sentence] -- FIXME: to be removed } makeLenses ''QDefinition diff --git a/code/drasil-lang/Language/Drasil/Document.hs b/code/drasil-lang/Language/Drasil/Document.hs index 49c85b6755..d7aa559c68 100644 --- a/code/drasil-lang/Language/Drasil/Document.hs +++ b/code/drasil-lang/Language/Drasil/Document.hs @@ -6,6 +6,7 @@ import Language.Drasil.Chunk.AssumpChunk (AssumpChunk) import Language.Drasil.Chunk.Change (Change) import Language.Drasil.Chunk.Citation (BibRef) import Language.Drasil.Chunk.Eq (QDefinition) +import Language.Drasil.Chunk.DataDefinition (DataDefinition) import Language.Drasil.Chunk.Relation (RelationConcept) import Language.Drasil.Chunk.ReqChunk (ReqChunk) import Language.Drasil.Chunk.ShortName (HasShortName(shortname), ShortName, @@ -53,6 +54,7 @@ data Document = Document Title Author [Section] -- | Types of definitions data DType = Data QDefinition -- ^ QDefinition is the chunk with the defining -- equation used to generate the Data Definition + | Data' DataDefinition | General | Theory RelationConcept -- ^ Theoretical models use a relation as -- their definition @@ -127,7 +129,6 @@ instance HasShortName Contents where "Bibliography list of references cannot be referenced. " ++ "You must reference the Section or an individual citation." - --------------------------------------------------------------------------- -- smart constructors needed for LabelledContent -- nothing has a shortname right now @@ -176,6 +177,7 @@ reldefn = Definition . Theory -- | Automatically create the label for a definition getDefName :: DType -> String getDefName (Data c) = "DD:" ++ concatMap repUnd (c ^. uid) -- FIXME: To be removed +getDefName (Data' c) = "DD:" ++ concatMap repUnd (c ^. uid) -- FIXME: To be removed getDefName (Theory c) = "T:" ++ concatMap repUnd (c ^. uid) -- FIXME: To be removed getDefName TM = "T:" getDefName DD = "DD:" diff --git a/code/drasil-lang/Language/Drasil/Reference.hs b/code/drasil-lang/Language/Drasil/Reference.hs index 17f8b6a630..43479e1a8e 100644 --- a/code/drasil-lang/Language/Drasil/Reference.hs +++ b/code/drasil-lang/Language/Drasil/Reference.hs @@ -24,6 +24,7 @@ import Language.Drasil.Document (Contents(..), DType(Data, Theory), import Language.Drasil.RefTypes (RefType(..)) import Language.Drasil.Spec (Sentence(Ref)) import Language.Drasil.UID (UID) +import Language.Drasil.Chunk.DataDefinition (DataDefinition) -- | Database for maintaining references. -- The Int is that reference's number. @@ -230,6 +231,10 @@ instance Referable QDefinition where -- FIXME: This could lead to trouble; need refAdd d = "DD:" ++ concatMap repUnd (d ^. uid) rType _ = Def +instance Referable DataDefinition where + refAdd d = "DD:" ++ concatMap repUnd (d ^. uid) + rType _ = Def + instance Referable InstanceModel where refAdd i = "IM:" ++ i^.uid rType _ = Def diff --git a/code/stable/glassbr/SRS/GlassBR_SRS.tex b/code/stable/glassbr/SRS/GlassBR_SRS.tex index d4d1a6f665..cabb89f148 100644 --- a/code/stable/glassbr/SRS/GlassBR_SRS.tex +++ b/code/stable/glassbr/SRS/GlassBR_SRS.tex @@ -438,6 +438,11 @@ \subsubsection{Data Definitions} \item{$J$ is the stress distribution factor (Function) (Unitless)} \end{symbDescription} \\ \midrule \\ +Notes & $a$, $b$ are dimensions of the plate, where ($a>b$). + $t$ is the true thickness, which is based on the nominal thicknesses as shown in DD2. + $LDF$ is the load duration factor as defined by DD3. + $J$ is the stress distribution factor (Function) , as defined in DD4. +\\ \midrule \\ Source & [4] \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -478,6 +483,8 @@ \subsubsection{Data Definitions} \item{$t$ is the nominal thickness $t\in{}\{2.5,2.7,3.0,4.0,5.0,6.0,8.0,10.0,12.0,16.0,19.0,22.0\}$ (mm)} \end{symbDescription} \\ \midrule \\ +Notes & $t$ is a function that maps from the nominal thickness ($h$) to the minimum thickness. +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -508,6 +515,10 @@ \subsubsection{Data Definitions} \item{$b$ is the plate width (short dimension) (m)} \end{symbDescription} \\ \midrule \\ +Notes & $J$ is the stress distribution factor (Function), which is obtained by interpolating from data shown in Figure 7. + $\hat{q}$ is the dimensionless load defined in DD7. + $a$, $b$ are dimensions of the plate, where ($a>b$). +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -539,6 +550,10 @@ \subsubsection{Data Definitions} \item{$b$ is the plate width (short dimension) (m)} \end{symbDescription} \\ \midrule \\ +Notes & $a$, $b$ are dimensions of the plate, where ($a>b$). + $t$ is the true thickness, which is based on the nominal thicknesses as shown in DD2. + ${\hat{q}_{tol}}$ is the tolerable pressure defined in DD8. +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -602,6 +617,11 @@ \subsubsection{Data Definitions} \item{$GTF$ is the glass type factor (Unitless)} \end{symbDescription} \\ \midrule \\ +Notes & $q$ is the 3 second equivalent pressure, as given in IM3. + $a$, $b$ are dimensions of the plate, where ($a>b$). + $t$ is the true thickness, which is based on the nominal thicknesses as shown in DD2. + $GTF$ is the glass type factor, as given by DD6. +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -632,6 +652,8 @@ \subsubsection{Data Definitions} \item{$b$ is the plate width (short dimension) (m)} \end{symbDescription} \\ \midrule \\ +Notes & ${\hat{q}_{tol}}$ is the tolerable pressure which is obtained from Figure 7 using ${J_{tol}}$ and aspect ratio ($AR=\frac{a}{b}$) as parameters using interpolation. Calculation of ${J_{tol}}$ is defined in DD9. +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in @@ -666,6 +688,12 @@ \subsubsection{Data Definitions} \item{$LDF$ is the load duration factor (Unitless)} \end{symbDescription} \\ \midrule \\ +Notes & ${J_{tol}}$ is calculated with reference to ${P_{btol}}$. + $a$, $b$ are dimensions of the plate, where ($a>b$). + $t$ is the true thickness, which is based on the nominal thicknesses as shown in DD2. + $LDF$ is the load duration factor as defined by DD3. + ${P_{btol}}$ is the tolerable probability entered by the user. +\\ \midrule \\ Source & \\ \midrule \\ RefBy & FIXME: This needs to be filled in diff --git a/code/stable/glassbr/Website/GlassBR_SRS.html b/code/stable/glassbr/Website/GlassBR_SRS.html index c944efb040..9a53eef180 100644 --- a/code/stable/glassbr/Website/GlassBR_SRS.html +++ b/code/stable/glassbr/Website/GlassBR_SRS.html @@ -1409,6 +1409,25 @@

+Notes + + +

+a, b are dimensions of the plate, where (a > b). +

+

+t is the true thickness, which is based on the nominal thicknesses as shown in DD2. +

+

+LDF is the load duration factor as defined by DD3. +

+

+J is the stress distribution factor (Function) , as defined in DD4. +

+ + + + Source @@ -1561,6 +1580,16 @@

+Notes + + +

+t is a function that maps from the nominal thickness (h) to the minimum thickness. +

+ + + + Source @@ -1658,6 +1687,22 @@

+Notes + + +

+J is the stress distribution factor (Function), which is obtained by interpolating from data shown in Figure 7. +

+

+ is the dimensionless load defined in DD7. +

+

+a, b are dimensions of the plate, where (a > b). +

+ + + + Source @@ -1758,6 +1803,22 @@

+Notes + + +

+a, b are dimensions of the plate, where (a > b). +

+

+t is the true thickness, which is based on the nominal thicknesses as shown in DD2. +

+

+tol is the tolerable pressure defined in DD8. +

+ + + + Source @@ -1961,6 +2022,25 @@

+Notes + + +

+q is the 3 second equivalent pressure, as given in IM3. +

+

+a, b are dimensions of the plate, where (a > b). +

+

+t is the true thickness, which is based on the nominal thicknesses as shown in DD2. +

+

+GTF is the glass type factor, as given by DD6. +

+ + + + Source @@ -2058,6 +2138,23 @@

+Notes + + +

+tol is the tolerable pressure which is obtained from Figure 7 using Jtol and aspect ratio (AR =

+ +a + + +b + +
) as parameters using interpolation. Calculation of Jtol is defined in DD9. +

+ + + + Source @@ -2174,6 +2271,28 @@

+Notes + + +

+Jtol is calculated with reference to Pbtol. +

+

+a, b are dimensions of the plate, where (a > b). +

+

+t is the true thickness, which is based on the nominal thicknesses as shown in DD2. +

+

+LDF is the load duration factor as defined by DD3. +

+

+Pbtol is the tolerable probability entered by the user. +

+ + + + Source