Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Re-export database types and functions to simplify external use.
Synopsis
- data ChunkDB = CDB SymbolMap TermMap ConceptMap UnitMap TraceMap RefbyMap DatadefnMap InsModelMap GendefMap TheoryModelMap ConceptInstanceMap SectionMap LabelledContentMap ReferenceMap
- type RefbyMap = Map UID [UID]
- type TraceMap = Map UID [UID]
- type UMap a = Map UID (a, Int)
- cdb :: (Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) => [q] -> [t] -> [c] -> [u] -> [DataDefinition] -> [InstanceModel] -> [GenDefn] -> [TheoryModel] -> [ConceptInstance] -> [Section] -> [LabelledContent] -> [Reference] -> ChunkDB
- idMap :: HasUID a => [a] -> Map UID (a, Int)
- termMap :: Idea c => [c] -> TermMap
- conceptMap :: Concept c => [c] -> ConceptMap
- traceMap :: [(UID, [UID])] -> TraceMap
- generateRefbyMap :: TraceMap -> RefbyMap
- asOrderedList :: UMap a -> [a]
- collectUnits :: Quantity c => ChunkDB -> [c] -> [UnitDefn]
- termResolve :: ChunkDB -> UID -> IdeaDict
- defResolve :: ChunkDB -> UID -> ConceptChunk
- symbResolve :: ChunkDB -> UID -> QuantityDict
- traceLookup :: UID -> TraceMap -> [UID]
- refbyLookup :: UID -> RefbyMap -> [UID]
- datadefnLookup :: UID -> DatadefnMap -> DataDefinition
- insmodelLookup :: UID -> InsModelMap -> InstanceModel
- gendefLookup :: UID -> GendefMap -> GenDefn
- theoryModelLookup :: UID -> TheoryModelMap -> TheoryModel
- conceptinsLookup :: UID -> ConceptInstanceMap -> ConceptInstance
- sectionLookup :: UID -> SectionMap -> Section
- labelledconLookup :: UID -> LabelledContentMap -> LabelledContent
- refResolve :: UID -> ReferenceMap -> Reference
- unitTable :: Lens' ChunkDB UnitMap
- traceTable :: Lens' ChunkDB TraceMap
- refbyTable :: Lens' ChunkDB RefbyMap
- dataDefnTable :: Lens' ChunkDB DatadefnMap
- insmodelTable :: Lens' ChunkDB InsModelMap
- gendefTable :: Lens' ChunkDB GendefMap
- theoryModelTable :: Lens' ChunkDB TheoryModelMap
- conceptinsTable :: Lens' ChunkDB ConceptInstanceMap
- sectionTable :: Lens' ChunkDB SectionMap
- labelledcontentTable :: Lens' ChunkDB LabelledContentMap
- refTable :: Lens' ChunkDB ReferenceMap
- dumpChunkDB :: ChunkDB -> DumpedChunkDB
- type DumpedChunkDB = Map ChunkType [UID]
Chunk Database
Types
Our chunk databases. Must contain all maps needed in an example. In turn, these maps must contain every chunk definition or concept used in its respective example, else an error is thrown.
type UMap a = Map UID (a, Int) Source #
The misnomers below (for the following Map types) are not actually a bad thing. We want to ensure data can't be added to a map if it's not coming from a chunk, and there's no point confusing what the map is for. One is for symbols + their units, and the others are for what they state.
Constructors
cdb :: (Quantity q, MayHaveUnit q, Idea t, Concept c, IsUnit u) => [q] -> [t] -> [c] -> [u] -> [DataDefinition] -> [InstanceModel] -> [GenDefn] -> [TheoryModel] -> [ConceptInstance] -> [Section] -> [LabelledContent] -> [Reference] -> ChunkDB Source #
Smart constructor for chunk databases. Takes in the following:
- [
Quantity
] (forSymbolMap
), NamedIdea
s (forTermMap
),Concept
s (forConceptMap
),- Units (something that
IsUnit
forUnitMap
), DataDefinition
s (forDatadefnMap
),InstanceModel
s (forInsModelMap
),GenDefn
s (forGendefMap
),TheoryModel
s (forTheoryModelMap
),ConceptInstance
s (forConceptInstanceMap
),Section
s (forSectionMap
),LabelledContent
s (forLabelledContentMap
).
conceptMap :: Concept c => [c] -> ConceptMap Source #
Smart constructor for a ConceptMap
.
traceMap :: [(UID, [UID])] -> TraceMap Source #
Smart constructor for a TraceMap
given a traceability matrix.
generateRefbyMap :: TraceMap -> RefbyMap Source #
Translates a traceability map into a reference map.
Lookup Functions
asOrderedList :: UMap a -> [a] Source #
Gets an ordered list of a
from any a
that is of type UMap
.
defResolve :: ChunkDB -> UID -> ConceptChunk Source #
symbResolve :: ChunkDB -> UID -> QuantityDict Source #
datadefnLookup :: UID -> DatadefnMap -> DataDefinition Source #
Looks up a UID
in the datadefinition table. If nothing is found, an error is thrown.
insmodelLookup :: UID -> InsModelMap -> InstanceModel Source #
Looks up a UID
in the instance model table. If nothing is found, an error is thrown.
gendefLookup :: UID -> GendefMap -> GenDefn Source #
Looks up a UID
in the general definition table. If nothing is found, an error is thrown.
theoryModelLookup :: UID -> TheoryModelMap -> TheoryModel Source #
Looks up a UID
in the theory model table. If nothing is found, an error is thrown.
conceptinsLookup :: UID -> ConceptInstanceMap -> ConceptInstance Source #
Looks up a UID
in the concept instance table. If nothing is found, an error is thrown.
sectionLookup :: UID -> SectionMap -> Section Source #
Looks up a UID
in the section table. If nothing is found, an error is thrown.
labelledconLookup :: UID -> LabelledContentMap -> LabelledContent Source #
Looks up a UID
in the labelled content table. If nothing is found, an error is thrown.
refResolve :: UID -> ReferenceMap -> Reference Source #
Lenses
traceTable :: Lens' ChunkDB TraceMap Source #
refbyTable :: Lens' ChunkDB RefbyMap Source #
dataDefnTable :: Lens' ChunkDB DatadefnMap Source #
insmodelTable :: Lens' ChunkDB InsModelMap Source #
gendefTable :: Lens' ChunkDB GendefMap Source #
theoryModelTable :: Lens' ChunkDB TheoryModelMap Source #
conceptinsTable :: Lens' ChunkDB ConceptInstanceMap Source #
sectionTable :: Lens' ChunkDB SectionMap Source #
labelledcontentTable :: Lens' ChunkDB LabelledContentMap Source #
Debugging Tools
dumpChunkDB :: ChunkDB -> DumpedChunkDB Source #
type DumpedChunkDB = Map ChunkType [UID] Source #