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 

Fields

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.

data TermAbbr Source #

Constructors

TermAbbr 

data DomDefn Source #

Constructors

DomDefn 

Fields

Constructors

cdb' :: (Quantity q, MayHaveUnit q, Concept q, Concept c, IsUnit u) => [q] -> [IdeaDict] -> [c] -> [u] -> [DataDefinition] -> [InstanceModel] -> [GenDefn] -> [TheoryModel] -> [ConceptInstance] -> [LabelledContent] -> [Reference] -> [Citation] -> ChunkDB Source #

Smart constructor for chunk databases. Takes in the following:

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

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

symbolMap :: (Quantity c, MayHaveUnit c, Concept c) => [c] -> SymbolMap Source #

Smart constructor for a SymbolMap.

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

Smart constructor for a TermMap.

conceptMap :: Concept c => [c] -> ConceptMap Source #

Smart constructor for a ConceptMap.

unitMap :: IsUnit u => [u] -> UnitMap Source #

Smart constructor for a UnitMap.

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 :: (NP -> Maybe String -> c) -> ChunkDB -> UID -> c Source #

Search for _any_ chunk that is an instance of Idea and process its "term" and abbreviation.

termResolve' :: ChunkDB -> UID -> TermAbbr Source #

Find a chunks "term" and abbreviation, if it exists.

defResolve :: ([UID] -> Sentence -> c) -> ChunkDB -> UID -> c Source #

Looks up a UID in all tables with concepts from the ChunkDB. If nothing is found, an error is thrown.

symbResolve :: ChunkDB -> UID -> DefinedQuantityDict 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.

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 #

citationTable :: Lens' ChunkDB CitationMap 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 #

labelledcontentTable :: Lens' ChunkDB LabelledContentMap Source #

refTable :: Lens' ChunkDB ReferenceMap Source #

Debugging Tools

Helpers