Documentation ¶
Overview ¶
Deep6 is a simple embeddable hexastore graph database. To the core hexastore tuple index we add auto-generated links based on selected property values, and offer object traversals over linked data types.
The use-case deep6 was creted for is to link data formats of different types in the education-technology space together so that user can retrieve, for example, all SIF, XAPI statements or abitrary json objects related to a student, a teacher or a school.
Index ¶
- Variables
- func Flatten(m map[string]interface{}) map[string]interface{}
- func MergeErrors(cs ...<-chan error) <-chan error
- func WaitForPipeline(errs ...<-chan error) error
- type Deep6DB
- func (d6 *Deep6DB) Close()
- func (d6 *Deep6DB) Delete(id string) error
- func (d6 *Deep6DB) FindById(id string) (map[string][]map[string]interface{}, error)
- func (d6 *Deep6DB) FindByPredicate(predicate string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
- func (d6 *Deep6DB) FindByType(typename string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
- func (d6 *Deep6DB) FindByValue(term string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
- func (d6 *Deep6DB) IngestFromFile(fname string) error
- func (d6 *Deep6DB) IngestFromHTTPRequest(r *http.Request) error
- func (d6 *Deep6DB) IngestFromJSONChannel(c <-chan []byte) error
- func (d6 *Deep6DB) IngestFromReader(r io.Reader) error
- func (d6 *Deep6DB) TraversalWithId(id string, t Traversal, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
- func (d6 *Deep6DB) TraversalWithValue(val string, t Traversal, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
- type Filter
- type FilterSpec
- type IngestData
- type Traversal
- type TraversalData
- type Triple
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("object not found")
Functions ¶
func Flatten ¶
Flatten takes a map of a json file and returns a new one where nested maps are replaced by dot-delimited keys.
func MergeErrors ¶
MergeErrors merges multiple channels of errors. Based on https://blog.golang.org/pipelines.
func WaitForPipeline ¶
WaitForPipeline waits for results from all error channels. It returns early on the first error.
Types ¶
type Deep6DB ¶
type Deep6DB struct { // // set level of audit ouput, one of: none, basic, high // AuditLevel string // contains filtered or unexported fields }
func OpenFromFile ¶
Open the database using the specified directory It will be created if it doesn't exist.
func (*Deep6DB) Close ¶
func (d6 *Deep6DB) Close()
shuts down the and ensures all writes are committed.
func (*Deep6DB) FindById ¶
Finds all tuples for a given object reinflates into a json object and returns a map[string]interface{} representing the json object
id - unique id of the object being searched for
func (*Deep6DB) FindByPredicate ¶
func (d6 *Deep6DB) FindByPredicate(predicate string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
Finds all objects where a predicate exists. More useful with xapi than other data.
Predicate must be in dotted path form e.g. 'XAPI.verb' or 'StudentPersonal.PersonInfo.Name'
returns a map[string]interface{} representing the json object
predicate - string value to search for can be a partial predicate e.g. (full) StudentPersonal.PersonInfo.Name.FamilyName (partial) .FamilyName
filterspec - optional filter for results
func (*Deep6DB) FindByType ¶
func (d6 *Deep6DB) FindByType(typename string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
Finds all objects of a specified type will be object name for SIF e.g. StudentPersonal or generic e.g. XAPI returns an array of map[string]interface{} containing the json objects
typename - object type to search for
func (*Deep6DB) FindByValue ¶
func (d6 *Deep6DB) FindByValue(term string, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
Finds all objects where a property has the given value. returns a map[string]interface{} representing the json object
term - string value to search for supports partial (prefix) search e.g. jaqueline as opposed to jaqueline5@email.com
func (*Deep6DB) IngestFromFile ¶
Load data into D6 from a file
func (*Deep6DB) IngestFromHTTPRequest ¶
Load data into D6 from an http request
func (*Deep6DB) IngestFromJSONChannel ¶
Feed data into db from a channel providing json objects as byte slices - typically for us the iterator from crdt manager receiver
func (*Deep6DB) IngestFromReader ¶
Feed data in D6 from any io.Reader
func (*Deep6DB) TraversalWithId ¶
func (d6 *Deep6DB) TraversalWithId(id string, t Traversal, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
Follows a traversal spec starting with an object found to have the supplied initial value
id - the value to search for traversalspec - object types to traverse
func (*Deep6DB) TraversalWithValue ¶
func (d6 *Deep6DB) TraversalWithValue(val string, t Traversal, filterspec FilterSpec) (map[string][]map[string]interface{}, error)
Follows a traversal spec starting with an object found to have the supplied value
Unlike find by id this traversal may find multiple matches so dataset returned can contain mmultiple result arrays, but data will be constrained by the Types of the traversal-spec.
Allows traversal using for example a localid for a user, or a user name as opposed to a unique id
val - the value to search for traversalspec - object types to traverse
type FilterSpec ¶
data strucure
Predicate: predicte string (can be part predicate) in dotted form e.g. PersonInfo.FamilyName
or simply .FamilyName
TargetValue: the value to use as a filter, if the value matches the value of the predicate in the object the object will be returned in results
type IngestData ¶
type IngestData struct { // Unique id for the object being processed // will be derived from the inbound json object // or created by the pipeline N3id string // The declared type of the objecct // such as a SIF StudentPersonal // for data with no type system, will use // the object datamodel, all xAPI objects // for instance end up as type XAPI Type string // The datamodel that the object being processed // appears to belong to based on the // datatype.toml classification // if no model can be derived will default to JSON DataModel string // The unmarshaled json of the object // as a map[string]interface{} RawData map[string]interface{} // The specifications for which features of an object should // be surfaced as links within the graph. // Provided in ./config/datatype.toml. // Searches triple predicates for the spec, so use e.g. // ".RefId" to find the precise refid of a SIF object // but use "RefId" (no dot) to find refids of referenced objects // such as SchoolInfoRefId LinkSpecs []string // Array of values extracted during classification // which will be concatenated to make // a unique property identifier for objects // that have no discriminating features, e.g. // a syllabus has a stage, but so do lessons // it has a subject, but so do lessons and subjects // so to avoid filtering in a traversal // a combination of stage and subject will link // to only one sylabus. UniqueValues []string // // The resulting psuedo-unique key for this object. // Unique string // Potential links are derived from the inbound object // but need to be verified and written, this is done // by different parts of the ingest pipeline and so // are carried between stages in this slice LinkCandidates []Triple // The slice of hexastore triples parsed // from the original inbound data object Triples []Triple // The set of generated triiples that link // the features requested in LinkSpecs to the // rest of the graph LinkTriples []Triple }
strucuture used by the ingest pipeeline to pass original data and derived data between each stage.
Clssification of the data, and derivation of the object unique id etc. are governed by the configuration found in the ./config/datatype.toml file, see comments there for more details.
type Traversal ¶
type Traversal struct {
TraversalSpec []string
}
Data type for traversal specification
Each element is be an object type name the traversal finds objects of each type in the order specified as long as there is some forward or backward link available.
type TraversalData ¶
type TraversalData struct { // // Triples that successfully meet the // traversal spec requirements // // this data is persisted between stages of the // pipeline // // Stores the id and type of the match // TraversalMatches map[string]string // // Triples to be considered by next stage // // each stage replaces this data with new targets // TraversalStageTargets map[string]string }
Data strucure to move between stages of a graph traversal pipeline
Source Files ¶
- config.go
- deep6.go
- delete.go
- filter.go
- filterresults.go
- ingestaudit.go
- ingestdata.go
- ingestfile.go
- jsoniterator.go
- jsonreader.go
- linkReverseChecker.go
- linkbuilder.go
- linkparser.go
- linkremover.go
- linkwriter.go
- objectRemover.go
- objectclassifier.go
- objectfilter.go
- pipelineHelpers.go
- query.go
- removeaudit.go
- resultssource.go
- resultstidy.go
- runingest.go
- runremove.go
- sbf.go
- seisdb.go
- timetrack.go
- traversal.go
- traversalaudit.go
- traversaldata.go
- traversalhydrator.go
- traversalsource.go
- traverselinks.go
- traversetypes.go
- tripleremover.go
- triplewriter.go
- tuplegenerator.go