Skip to content

Commit

Permalink
use labels in the data analysis chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
stefjoosten committed Oct 13, 2023
1 parent 7401004 commit 57740bb
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/Ampersand/Output/ToPandoc/ChapterDataAnalysis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
(plain . text . l) (NL "Aantal", EN "Count"),
(plain . text . l) (NL "Vullingsgraad", EN "Filling degree")
]
[ [ (plain . text . text1ToText . tName) c,
[ [ (plain . text . label) c,
meaningOf c
<> (mconcat . map (amPandoc . explMarkup) . purposesOf fSpec outputLang') c,
(plain . text . tshow . Set.size . atomsInCptIncludingSmaller fSpec) c,
Expand Down Expand Up @@ -179,7 +179,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
(plain . text . l) (NL "Voorbeelden", EN "Examples"),
(plain . text . l) (NL "Aantal", EN "Count")
]
[ [ (plain . text . text1ToText . tName) c
[ [ (plain . text . label) c
] -- max 20 voorbeelden van atomen van concept c
++ (map (plain . text . showA) . take 20 . Set.toList . atomsInCptIncludingSmaller fSpec) c
++ [ (plain . text . tshow . Set.size . atomsInCptIncludingSmaller fSpec) c
Expand Down Expand Up @@ -222,7 +222,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
(plain . text . l) (NL "#uniek", EN "#unique")
]
( [ [ (plain . text . text1ToText . sqlColumNameToText1 . attSQLColName) attr,
(plain . text) ((text1ToText . tName . target . attExpr) attr <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) ((label . target . attExpr) attr <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) (percent (Set.size pairs) n),
(plain . text . tshow . Set.size . Set.map apRight) pairs
]
Expand All @@ -232,7 +232,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
pairs <- [(pairsInExpr fSpec . attExpr) (attr :: SqlAttribute)]
]
<> [ [ (plain . text . text1ToText . sqlColumNameToText1 . attSQLColName) attr,
(plain . text) ((text1ToText . tName . target . attExpr) attr <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) ((label . target . attExpr) attr <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) (percent (Set.size pairs) n),
(plain . text . tshow . Set.size . Set.map apRight) pairs
-- , (plain . text . tshow) nTgtConcept
Expand All @@ -259,10 +259,10 @@ chpDataAnalysis env fSpec = (theBlocks, [])
(plain . text . l) (NL "Target", EN "Target"),
(plain . text . l) (NL "uniek", EN "unique")
]
[ [ (plain . text) ((text1ToText . tName . source) rel <> "(" <> tshow nSrcConcept <> ")"), -- use "tshow.attType" for the technical type.
[ [ (plain . text) ((label . source) rel <> "(" <> tshow nSrcConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) (percent (Set.size (Set.map apLeft pairs)) nSrcConcept),
(plain . text) ((text1ToText . tName) rel <> "(" <> tshow (Set.size pairs) <> ")"),
(plain . text) ((text1ToText . tName . target) rel <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) ((label) rel <> "(" <> tshow (Set.size pairs) <> ")"),

Check warning on line 264 in src/Ampersand/Output/ToPandoc/ChapterDataAnalysis.hs

View workflow job for this annotation

GitHub Actions / Hlint - Check for code sanity

Warning in chpDataAnalysis in module Ampersand.Output.ToPandoc.ChapterDataAnalysis: Redundant bracket ▫︎ Found: "(label)" ▫︎ Perhaps: "label"
(plain . text) ((label . target) rel <> "(" <> tshow nTgtConcept <> ")"), -- use "tshow.attType" for the technical type.
(plain . text) (percent (Set.size (Set.map apRight pairs)) nTgtConcept)
]
| Just rel <- map assmdcl asscs,
Expand Down Expand Up @@ -308,11 +308,11 @@ chpDataAnalysis env fSpec = (theBlocks, [])
<> mconcat
[ simpleTable
[plainText "Concept", plainText "C", plainText "R", plainText "U", plainText "D"]
[ [ (plainText . text1ToText . tName) cncpt,
mconcat . map (plainText . text1ToText . tName) $ ifcsC,
mconcat . map (plainText . text1ToText . tName) $ ifcsR,
mconcat . map (plainText . text1ToText . tName) $ ifcsU,
mconcat . map (plainText . text1ToText . tName) $ ifcsD
[ [ (plainText . label) cncpt,
mconcat . map (plainText . label) $ ifcsC,
mconcat . map (plainText . label) $ ifcsR,
mconcat . map (plainText . label) $ ifcsU,
mconcat . map (plainText . label) $ ifcsD
]
| (cncpt, (ifcsC, ifcsR, ifcsU, ifcsD)) <- crudObjsPerConcept (crudInfo fSpec)
]
Expand Down Expand Up @@ -401,7 +401,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
Dutch -> "Dit attribuut verwijst naar een rij in de tabel "
English -> "This attribute is a foreign key to "
)
<> (text . text1ToText . tName) c
<> (text . label) c
PlainAttr ->
( case outputLang' of
Dutch -> "Dit attribuut implementeert "
Expand Down Expand Up @@ -474,7 +474,7 @@ chpDataAnalysis env fSpec = (theBlocks, [])
docRule :: LocalizedStr -> Rule -> Blocks
docRule heading rule =
mconcat
[ plain $ strong (text (l heading <> ": ") <> (emph . text . text1ToText . tName) rule),
[ plain $ strong (text (l heading <> ": ") <> (emph . text . label) rule),
mconcat . map (amPandoc . explMarkup) . purposesOf fSpec outputLang' $ rule,
printMeaning outputLang' rule,
para (showMath rule),
Expand Down Expand Up @@ -506,28 +506,28 @@ primExpr2pandocMath lang e =
case lang of
Dutch -> text "de relatie "
English -> text "the relation "
<> math ((text1ToText . tName . source) d <> " \\rightarrow {" <> (text1ToText . tName) d <> "} " <> (text1ToText . tName . target) d)
<> math ((label . source) d <> " \\rightarrow {" <> label d <> "} " <> (label . target) d)
(EFlp (EDcD d)) ->
case lang of
Dutch -> text "de relatie "
English -> text "the relation "
<> math ((text1ToText . tName . source) d <> " \\leftarrow {" <> (text1ToText . tName) d <> "} " <> (text1ToText . tName . target) d)
<> math ((label . source) d <> " \\leftarrow {" <> label d <> "} " <> (label . target) d)
(EIsc (r1, _)) ->
let srcTable = case r1 of
EDcI c -> c
_ -> fatal ("Unexpected term: " <> tshow r1)
in case lang of
Dutch -> text "de identiteitsrelatie van "
English -> text "the identityrelation of "
<> math (text1ToText . tName $ srcTable)
<> math (label $ srcTable)

Check warning on line 522 in src/Ampersand/Output/ToPandoc/ChapterDataAnalysis.hs

View workflow job for this annotation

GitHub Actions / Hlint - Check for code sanity

Suggestion in primExpr2pandocMath in module Ampersand.Output.ToPandoc.ChapterDataAnalysis: Redundant $ ▫︎ Found: "label $ srcTable" ▫︎ Perhaps: "label srcTable"
(EDcI c) ->
case lang of
Dutch -> text "de identiteitsrelatie van "
English -> text "the identityrelation of "
<> math (text1ToText . tName $ c)
<> math (label $ c)

Check warning on line 527 in src/Ampersand/Output/ToPandoc/ChapterDataAnalysis.hs

View workflow job for this annotation

GitHub Actions / Hlint - Check for code sanity

Suggestion in primExpr2pandocMath in module Ampersand.Output.ToPandoc.ChapterDataAnalysis: Redundant $ ▫︎ Found: "label $ c" ▫︎ Perhaps: "label c"
(EEps c _) ->
case lang of
Dutch -> text "de identiteitsrelatie van "
English -> text "the identityrelation of "
<> math (text1ToText . tName $ c)
<> math (label $ c)

Check warning on line 532 in src/Ampersand/Output/ToPandoc/ChapterDataAnalysis.hs

View workflow job for this annotation

GitHub Actions / Hlint - Check for code sanity

Suggestion in primExpr2pandocMath in module Ampersand.Output.ToPandoc.ChapterDataAnalysis: Redundant $ ▫︎ Found: "label $ c" ▫︎ Perhaps: "label c"
_ -> fatal ("Have a look at the generated Haskell to see what is going on..\n" <> tshow e)

0 comments on commit 57740bb

Please sign in to comment.