drasil-database-0.1.1.0: A framework for code and document generation for scientific software - Database SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Drasil

Description

Re-export database types and functions to simplify external use.

Synopsis

Chunk Database

Types

data ChunkDB Source #

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.

Constructors

CDB SymbolMap TermMap ConceptMap UnitMap TraceMap RefbyMap DatadefnMap InsModelMap GendefMap TheoryModelMap ConceptInstanceMap SectionMap LabelledContentMap ReferenceMap 

type RefbyMap = Map UID [UID] Source #

A reference map, used to hold a UID and where it is referenced (UIDs).

type TraceMap = Map UID [UID] Source #

A traceability map, used to hold the relation between one UID and a list of other UIDs.

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:

idMap :: HasUID a => [a] -> Map UID (a, Int) Source #

General smart constructor for making a UMap out of anything that has a UID.

termMap :: Idea c => [c] -> TermMap Source #

Smart constructor for a TermMap.

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.

collectUnits :: Quantity c => ChunkDB -> [c] -> [UnitDefn] Source #

Gets the units of a Quantity as UnitDefns.

termResolve :: ChunkDB -> UID -> IdeaDict Source #

Looks up a UID in the term table from the ChunkDB. If nothing is found, an error is thrown.

defResolve :: ChunkDB -> UID -> ConceptChunk Source #

Looks up a UID in the definition table from the ChunkDB. If nothing is found, an error is thrown.

symbResolve :: ChunkDB -> UID -> QuantityDict Source #

Looks up a UID in the symbol table from the ChunkDB. If nothing is found, an error is thrown.

traceLookup :: UID -> TraceMap -> [UID] Source #

Trace a UID to related UIDs.

refbyLookup :: UID -> RefbyMap -> [UID] Source #

Trace a UID to referenced UIDs.

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 #

Looks up a UID in the reference table from the ChunkDB. If nothing is found, an error is thrown.

Lenses

unitTable :: Lens' ChunkDB UnitMap 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 #

refTable :: Lens' ChunkDB ReferenceMap Source #

Debugging Tools