mqldb

package
v0.0.0-...-ec95f82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalStatement

func EvalStatement(db *DB, selection Selection, statement parser.Statement) ([]mcmodel.Activity, []mcmodel.Entity)

EvalStatement runs a query and returns the results. At the moment selection is a simple boolean flag on whether to return samples and/or processes from the matches.

func LoadProject

func LoadProject(projectID int)

func MapToStatement

func MapToStatement(m map[string]interface{}) parser.Statement

MapToStatement takes a map, which represents the converted JSON payload for a statement and converts it to statement. It recursively calls itself to build out the full statement.

Types

type Activity2Entity

type Activity2Entity struct {
	ID         int
	ActivityID int
	EntityID   int
}

Activity2Entity represents the join table for mapping the relationships between processes and samples.

func (Activity2Entity) TableName

func (Activity2Entity) TableName() string

type DB

type DB struct {
	ProjectID    int
	ExperimentID int
	DatasetID    int

	// Process and process data lookups
	Processes                    []mcmodel.Activity
	AllProcessAttributes         []*mcmodel.Attribute
	ProcessAttributesByProcessID map[int]map[string]*mcmodel.Attribute
	ProcessSamples               map[int][]*mcmodel.Entity

	// Sample and sample data lookups
	Samples             []mcmodel.Entity
	SampleProcesses     map[int][]*mcmodel.Activity
	AllSampleAttributes []*mcmodel.Attribute

	SampleAttributesBySampleIDAndStates map[int]map[int]map[string]*mcmodel.Attribute
	// contains filtered or unexported fields
}

func NewDB

func NewDB(projectID int, db *gorm.DB) *DB

NewDB creates a new in memory instance of the samples, processes, attributes and their relationships DB that is used by the evaluator for query processing.

func (*DB) Load

func (db *DB) Load() error

Load loads the samples, processes and attributes for the given project into memory.

type Experiment2Activity

type Experiment2Activity struct {
	ID           int
	ActivityID   int
	ExperimentID int
}

type Experiment2Entity

type Experiment2Entity struct {
	ID           int
	EntityID     int
	ExperimentID int
}

type ProcessSelection

type ProcessSelection struct {
	All        bool
	Name       bool
	ID         bool
	Attributes []string
}

type SampleSelection

type SampleSelection struct {
	All        bool
	Name       bool
	ID         bool
	Attributes []string
}

type SampleState

type SampleState struct {
	EntityStateID int
	// contains filtered or unexported fields
}

SampleState is the state associated with a sample. The IDs contained in the structures are used to look up items in the hash tables in the DB.

type Selection

type Selection struct {
	ProcessSelection ProcessSelection
	SampleSelection  SampleSelection
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL