From e022b27fdaad3710ad1a3b773990977856a3ad7e Mon Sep 17 00:00:00 2001 From: Christopher Dusovic Date: Tue, 14 Jun 2016 14:03:30 -0700 Subject: [PATCH] Fix various typos --- bql/grammar/grammar_test.go | 6 +-- bql/grammar/llk.go | 2 +- bql/grammar/llk_test.go | 2 +- bql/grammar/parser.go | 8 +-- bql/lexer/lexer.go | 58 ++++++++++---------- bql/planner/planner.go | 60 ++++++++++----------- bql/planner/planner_test.go | 16 +++--- bql/semantic/convert.go | 4 +- bql/semantic/expression.go | 6 +-- bql/semantic/hooks.go | 36 ++++++------- bql/semantic/hooks_test.go | 12 ++--- bql/semantic/semantic.go | 32 +++++------ bql/semantic/semantic_test.go | 4 +- bql/table/table.go | 38 ++++++------- bql/table/table_test.go | 4 +- bql/version/version.go | 4 +- docs/bql.md | 2 +- docs/storage_abstraction_layer.md | 2 +- docs/temporal_graph_modeling.md | 6 +-- io/io.go | 4 +- storage/memory/memory.go | 10 ++-- storage/memory/memory_test.go | 52 +++++++++--------- storage/storage.go | 10 ++-- tools/benchmark/generator/tree/tree.go | 6 +-- tools/benchmark/generator/tree/tree_test.go | 2 +- tools/benchmark/runtime/runtime.go | 10 ++-- tools/benchmark/runtime/runtime_test.go | 4 +- tools/compliance/entry.go | 10 ++-- tools/compliance/runner.go | 2 +- tools/vcli/bw/common/common.go | 4 +- tools/vcli/bw/io/io.go | 4 +- tools/vcli/bw/main.go | 6 +-- tools/vcli/bw/repl/repl.go | 8 +-- tools/vcli/bw/run/run.go | 4 +- triple/literal/literal.go | 12 ++--- triple/node/node.go | 4 +- triple/predicate/predicate.go | 2 +- triple/triple.go | 4 +- 38 files changed, 230 insertions(+), 230 deletions(-) diff --git a/bql/grammar/grammar_test.go b/bql/grammar/grammar_test.go index 5e30a45a..b5e3e577 100644 --- a/bql/grammar/grammar_test.go +++ b/bql/grammar/grammar_test.go @@ -145,7 +145,7 @@ func TestRejectByParse(t *testing.T) { // Reject incomplete clauses. `select ?a from ?b where {?s ?p};`, `select ?a from ?b where {?s ?p ?o . ?};`, - // Reject imcomplete clause aliasing. + // Reject incomplete clause aliasing. `select ?a from ?b where {?s id ?b as ?c ?d ?o};`, `select ?a from ?b where {?s ?p at ?t as ?a ?o};`, `select ?a from ?b where {?s ?p ?o at ?t id ?i};`, @@ -270,7 +270,7 @@ func TestAcceptOpsByParseAndSemantic(t *testing.T) { func TestAcceptQueryBySemanticParse(t *testing.T) { table := []string{ - // Test well type litterals are accepted. + // Test well type literals are accepted. `select ?s from ?g where{?s ?p "1"^^type:int64};`, // Test predicates are accepted. // Test invalid predicate time anchor are rejected. @@ -314,7 +314,7 @@ func TestAcceptQueryBySemanticParse(t *testing.T) { func TestRejectByParseAndSemantic(t *testing.T) { table := []string{ - // Test wront type litterals are rejected. + // Test wrong type literals are rejected. `select ?s from ?g where{?s ?p "true"^^type:int64};`, // Test invalid predicate bounds are rejected. `select ?s from ?b where{/_ as ?s "id"@[2018-07-19T13:12:04.669618843-07:00, 2015-07-19T13:12:04.669618843-07:00] ?o};`, diff --git a/bql/grammar/llk.go b/bql/grammar/llk.go index bd8deeb6..7a382347 100644 --- a/bql/grammar/llk.go +++ b/bql/grammar/llk.go @@ -76,7 +76,7 @@ func (l *LLk) CanAccept(tt lexer.TokenType) bool { return l.tkns[0].Type == tt } -// Consume will consue the current token and move to the next one if it matches +// Consume will consume the current token and move to the next one if it matches // the provided token, false otherwise. func (l *LLk) Consume(tt lexer.TokenType) bool { if l.tkns[0].Type != tt { diff --git a/bql/grammar/llk_test.go b/bql/grammar/llk_test.go index 65504f88..9b45a248 100644 --- a/bql/grammar/llk_test.go +++ b/bql/grammar/llk_test.go @@ -20,7 +20,7 @@ import ( "github.com/google/badwolf/bql/lexer" ) -func TestEmptyImputLLk(t *testing.T) { +func TestEmptyInputLLk(t *testing.T) { const k = 10 l := NewLLk("", k) if l.Current().Type != lexer.ItemEOF { diff --git a/bql/grammar/parser.go b/bql/grammar/parser.go index 2f855e93..324cca02 100644 --- a/bql/grammar/parser.go +++ b/bql/grammar/parser.go @@ -63,16 +63,16 @@ type Clause struct { } // Grammar contains the left factory LLk grammar to be parsed. All provided -// grammars *must* have the "START" symbol to initialte the parsing of input +// grammars *must* have the "START" symbol to initiate the parsing of input // text. type Grammar map[semantic.Symbol][]*Clause -// Parser implements a LLk recursive decend parser for left factorized grammars. +// Parser implements a LLk recursive descent parser for left factorized grammars. type Parser struct { grammar *Grammar } -// NewParser creates a new recursive decend parser for a left factorized +// NewParser creates a new recursive descent parser for a left factorized // grammar. func NewParser(grammar *Grammar) (*Parser, error) { // Check that the grammar is left factorized. @@ -126,7 +126,7 @@ func (p *Parser) consume(llk *LLk, st *semantic.Statement, s semantic.Symbol) (b return false, fmt.Errorf("Parser.consume: could not consume token %s in production %s", llk.Current(), s) } -// expect given the input, symbol, and clause attemps to satisfy all elements. +// expect given the input, symbol, and clause attempts to satisfy all elements. func (p *Parser) expect(llk *LLk, st *semantic.Statement, s semantic.Symbol, cls *Clause) (bool, error) { if cls.ProcessStart != nil { if _, err := cls.ProcessStart(st, s); err != nil { diff --git a/bql/lexer/lexer.go b/bql/lexer/lexer.go index f186a581..3f532d48 100644 --- a/bql/lexer/lexer.go +++ b/bql/lexer/lexer.go @@ -13,7 +13,7 @@ // limitations under the License. // Package lexer implements the lexer used bye the BadWolf query language. -// The lexer is losely written after the parsel model described by Rob Pike +// The lexer is loosely written after the parser model described by Rob Pike // in his presentation "Lexical Scanning in Go". Slides can be found at // http://cuddle.googlecode.com/hg/talk/lex.html#landing-slide. package lexer @@ -66,9 +66,9 @@ const ( ItemBefore // ItemAfter represents the after keyword in BQL. ItemAfter - // ItemBetween represents the betwen keyword in BQL. + // ItemBetween represents the between keyword in BQL. ItemBetween - // ItemCount represents the count funtion in BQL. + // ItemCount represents the count function in BQL. ItemCount // ItemDistinct represents the distinct modifier in BQL. ItemDistinct @@ -82,17 +82,17 @@ const ( ItemOrder // ItemHaving represents the having clause keyword clause in BQL. ItemHaving - // ItemAsc represents asc keywork on order by clause in BQL. + // ItemAsc represents asc keyword on order by clause in BQL. ItemAsc - // ItemDesc represents desc keywork on order by clause in BQL + // ItemDesc represents desc keyword on order by clause in BQL ItemDesc - // ItemLimit represetnts the limit clause in BQL. + // ItemLimit represents the limit clause in BQL. ItemLimit - // ItemBinding respresents a variable binding in BQL. + // ItemBinding represents a variable binding in BQL. ItemBinding - // ItemNode respresents a BadWolf node in BQL. + // ItemNode represents a BadWolf node in BQL. ItemNode // ItemLiteral represents a BadWolf literal in BQL. ItemLiteral @@ -101,19 +101,19 @@ const ( // ItemPredicateBound represents a BadWolf predicate bound in BQL. ItemPredicateBound - // ItemLBracket representes the left opening bracket token in BQL. + // ItemLBracket represents the left opening bracket token in BQL. ItemLBracket - // ItemRBracket representes the right opening bracket token in BQL. + // ItemRBracket represents the right opening bracket token in BQL. ItemRBracket - // ItemLPar representes the left opening parentesis token in BQL. + // ItemLPar represents the left opening parenthesis token in BQL. ItemLPar - // ItemRPar representes the right closing parentesis token in BQL. + // ItemRPar represents the right closing parenthesis token in BQL. ItemRPar // ItemDot represents the graph clause separator . in BQL. ItemDot // ItemSemicolon represents the final statement semicolon in BQL. ItemSemicolon - // ItemComma respresnts the graph join operator in BQL. + // ItemComma represents the graph join operator in BQL. ItemComma // ItemLT represents < in BQL. ItemLT @@ -315,7 +315,7 @@ type lexer struct { tokens chan Token // channel of scanned items. } -// lex creates a new lexer for the givne input +// lex creates a new lexer for the given input func lex(input string, capacity int) (*lexer, <-chan Token) { l := &lexer{ input: input, @@ -353,34 +353,34 @@ func lexToken(l *lexer) stateFn { return lexKeyword } } - if state := isSingleSymboToken(l, ItemLBracket, leftBracket); state != nil { + if state := isSingleSymbolToken(l, ItemLBracket, leftBracket); state != nil { return state } - if state := isSingleSymboToken(l, ItemRBracket, rightBracket); state != nil { + if state := isSingleSymbolToken(l, ItemRBracket, rightBracket); state != nil { return state } - if state := isSingleSymboToken(l, ItemLPar, leftPar); state != nil { + if state := isSingleSymbolToken(l, ItemLPar, leftPar); state != nil { return state } - if state := isSingleSymboToken(l, ItemRPar, rightPar); state != nil { + if state := isSingleSymbolToken(l, ItemRPar, rightPar); state != nil { return state } - if state := isSingleSymboToken(l, ItemSemicolon, semicolon); state != nil { + if state := isSingleSymbolToken(l, ItemSemicolon, semicolon); state != nil { return state } - if state := isSingleSymboToken(l, ItemDot, dot); state != nil { + if state := isSingleSymbolToken(l, ItemDot, dot); state != nil { return state } - if state := isSingleSymboToken(l, ItemComma, comma); state != nil { + if state := isSingleSymbolToken(l, ItemComma, comma); state != nil { return state } - if state := isSingleSymboToken(l, ItemLT, lt); state != nil { + if state := isSingleSymbolToken(l, ItemLT, lt); state != nil { return state } - if state := isSingleSymboToken(l, ItemGT, gt); state != nil { + if state := isSingleSymbolToken(l, ItemGT, gt); state != nil { return state } - if state := isSingleSymboToken(l, ItemEQ, eq); state != nil { + if state := isSingleSymbolToken(l, ItemEQ, eq); state != nil { return state } { @@ -398,8 +398,8 @@ func lexToken(l *lexer) stateFn { return nil // Stop the run loop. } -// isSingleSymboToken check if a single char should be lexed. -func isSingleSymboToken(l *lexer, tt TokenType, symbol rune) stateFn { +// isSingleSymbolToken check if a single char should be lexed. +func isSingleSymbolToken(l *lexer, tt TokenType, symbol rune) stateFn { if r := l.peek(); r == symbol { l.next() l.emit(tt) @@ -420,7 +420,7 @@ func lexBinding(l *lexer) stateFn { return lexSpace } -// lexSpace consumes spaces without emiting any token. +// lexSpace consumes spaces without emitting any token. func lexSpace(l *lexer) stateFn { for { if r := l.next(); !unicode.IsSpace(r) || r == eof { @@ -432,7 +432,7 @@ func lexSpace(l *lexer) stateFn { return lexToken } -// lexKeywork lexes the BQL keywords. +// lexKeyword lexes the BQL keywords. func lexKeyword(l *lexer) stateFn { input := l.input[l.pos:] f := func(r rune) bool { @@ -613,7 +613,7 @@ func lexPredicateOrLiteral(l *lexer) stateFn { return lexLiteral } -// lexPredicate lexes a predicicate of out of the input. +// lexPredicate lexes a predicate of out of the input. func lexPredicate(l *lexer) stateFn { l.next() for done := false; !done; { diff --git a/bql/planner/planner.go b/bql/planner/planner.go index 9244dd71..85d5f16a 100644 --- a/bql/planner/planner.go +++ b/bql/planner/planner.go @@ -33,21 +33,21 @@ import ( "github.com/google/badwolf/triple/literal" ) -// Excecutor interface unifies the execution of statements. -type Excecutor interface { +// Executor interface unifies the execution of statements. +type Executor interface { // Execute runs the proposed plan for a given statement. - Excecute(ctx context.Context) (*table.Table, error) + Execute(ctx context.Context) (*table.Table, error) } // createPlan encapsulates the sequence of instructions that need to be -// excecuted in order to satisfy the exceution of a valid create BQL statement. +// executed in order to satisfy the execution of a valid create BQL statement. type createPlan struct { stm *semantic.Statement store storage.Store } // Execute creates the indicated graphs. -func (p *createPlan) Excecute(ctx context.Context) (*table.Table, error) { +func (p *createPlan) Execute(ctx context.Context) (*table.Table, error) { t, err := table.New([]string{}) if err != nil { return nil, err @@ -65,14 +65,14 @@ func (p *createPlan) Excecute(ctx context.Context) (*table.Table, error) { } // dropPlan encapsulates the sequence of instructions that need to be -// excecuted in order to satisfy the exceution of a valid drop BQL statement. +// executed in order to satisfy the execution of a valid drop BQL statement. type dropPlan struct { stm *semantic.Statement store storage.Store } // Execute drops the indicated graphs. -func (p *dropPlan) Excecute(ctx context.Context) (*table.Table, error) { +func (p *dropPlan) Execute(ctx context.Context) (*table.Table, error) { t, err := table.New([]string{}) if err != nil { return nil, err @@ -90,7 +90,7 @@ func (p *dropPlan) Excecute(ctx context.Context) (*table.Table, error) { } // insertPlan encapsulates the sequence of instructions that need to be -// excecuted in order to satisfy the exceution of a valid insert BQL statement. +// executed in order to satisfy the execution of a valid insert BQL statement. type insertPlan struct { stm *semantic.Statement store storage.Store @@ -133,7 +133,7 @@ func update(ctx context.Context, stm *semantic.Statement, store storage.Store, f } // Execute inserts the provided data into the indicated graphs. -func (p *insertPlan) Excecute(ctx context.Context) (*table.Table, error) { +func (p *insertPlan) Execute(ctx context.Context) (*table.Table, error) { t, err := table.New([]string{}) if err != nil { return nil, err @@ -144,14 +144,14 @@ func (p *insertPlan) Excecute(ctx context.Context) (*table.Table, error) { } // deletePlan encapsulates the sequence of instructions that need to be -// excecuted in order to satisfy the exceution of a valid delete BQL statement. +// executed in order to satisfy the execution of a valid delete BQL statement. type deletePlan struct { stm *semantic.Statement store storage.Store } // Execute deletes the provided data into the indicated graphs. -func (p *deletePlan) Excecute(ctx context.Context) (*table.Table, error) { +func (p *deletePlan) Execute(ctx context.Context) (*table.Table, error) { t, err := table.New([]string{}) if err != nil { return nil, err @@ -162,7 +162,7 @@ func (p *deletePlan) Excecute(ctx context.Context) (*table.Table, error) { } // queryPlan encapsulates the sequence of instructions that need to be -// excecuted in order to satisfy the exceution of a valid query BQL statement. +// executed in order to satisfy the execution of a valid query BQL statement. type queryPlan struct { // Plan input. stm *semantic.Statement @@ -176,7 +176,7 @@ type queryPlan struct { chanSize int } -// newQueryPlan returns a new query plan ready to be excecuted. +// newQueryPlan returns a new query plan ready to be executed. func newQueryPlan(ctx context.Context, store storage.Store, stm *semantic.Statement, chanSize int) (*queryPlan, error) { bs := []string{} for _, b := range stm.Bindings() { @@ -206,7 +206,7 @@ func newQueryPlan(ctx context.Context, store storage.Store, stm *semantic.Statem }, nil } -// processClause retrives the triples for the provided triple given the +// processClause retrieves the triples for the provided triple given the // information available. func (p *queryPlan) processClause(ctx context.Context, cls *semantic.GraphClause, lo *storage.LookupOptions) (bool, error) { // This method decides how to process the clause based on the current @@ -244,7 +244,7 @@ func (p *queryPlan) processClause(ctx context.Context, cls *semantic.GraphClause return false, p.tbl.AppendTable(tbl) } if exist > 0 && exist < total { - // Data is partially binded, retrieve data either extends the row with the + // Data is partially bound, retrieve data either extends the row with the // new bindings or filters it out if now new bindings are available. return false, p.specifyClauseWithTable(ctx, cls, lo) } @@ -252,15 +252,15 @@ func (p *queryPlan) processClause(ctx context.Context, cls *semantic.GraphClause // Since all bindings in the clause are already solved, the clause becomes a // fully specified triple. If the triple does not exist the row will be // deleted. - return false, p.filterOnExistance(ctx, cls, lo) + return false, p.filterOnExistence(ctx, cls, lo) } - // Somethign is wrong with the code. + // Something is wrong with the code. return false, fmt.Errorf("queryPlan.processClause(%v) should have never failed to resolve the clause", cls) } -// getBindedValueForComponent return the unique binded value if available on +// getBoundValueForComponent return the unique bound value if available on // the provided row. -func getBindedValueForComponent(r table.Row, bs []string) *table.Cell { +func getBoundValueForComponent(r table.Row, bs []string) *table.Cell { var cs []*table.Cell for _, b := range bs { if v, ok := r[b]; ok { @@ -273,11 +273,11 @@ func getBindedValueForComponent(r table.Row, bs []string) *table.Cell { return nil } -// addSpecifiedData specializes the clause given the row provided and attemp to -// retrieve the correspoinding clause data. +// addSpecifiedData specializes the clause given the row provided and attempt to +// retrieve the corresponding clause data. func (p *queryPlan) addSpecifiedData(ctx context.Context, r table.Row, cls *semantic.GraphClause, lo *storage.LookupOptions) error { if cls.S == nil { - v := getBindedValueForComponent(r, []string{cls.SBinding, cls.SAlias}) + v := getBoundValueForComponent(r, []string{cls.SBinding, cls.SAlias}) if v != nil { if v.N != nil { cls.S = v.N @@ -285,7 +285,7 @@ func (p *queryPlan) addSpecifiedData(ctx context.Context, r table.Row, cls *sema } } if cls.P == nil { - v := getBindedValueForComponent(r, []string{cls.PBinding, cls.PAlias}) + v := getBoundValueForComponent(r, []string{cls.PBinding, cls.PAlias}) if v != nil { if v.N != nil { cls.P = v.P @@ -298,7 +298,7 @@ func (p *queryPlan) addSpecifiedData(ctx context.Context, r table.Row, cls *sema lo = nlo } if cls.O == nil { - v := getBindedValueForComponent(r, []string{cls.OBinding, cls.OAlias}) + v := getBoundValueForComponent(r, []string{cls.OBinding, cls.OAlias}) if v != nil { o, err := cellToObject(v) if err == nil { @@ -361,9 +361,9 @@ func cellToObject(c *table.Cell) (*triple.Object, error) { return nil, fmt.Errorf("invalid cell %v", c) } -// filterOnExistance removes rows based on the existance of the fully qualified +// filterOnExistence removes rows based on the existence of the fully qualified // triple after the biding of the clause. -func (p *queryPlan) filterOnExistance(ctx context.Context, cls *semantic.GraphClause, lo *storage.LookupOptions) error { +func (p *queryPlan) filterOnExistence(ctx context.Context, cls *semantic.GraphClause, lo *storage.LookupOptions) error { rows := p.tbl.Rows() for idx, pending := 0, len(rows); pending > 0; pending-- { r := rows[idx] @@ -463,11 +463,11 @@ func (p *queryPlan) filterOnExistance(ctx context.Context, cls *semantic.GraphCl return nil } -// processGraphPattern proces the query graph pattern to retrieve the +// processGraphPattern process the query graph pattern to retrieve the // data from the specified graphs. func (p *queryPlan) processGraphPattern(ctx context.Context, lo *storage.LookupOptions) error { for _, cls := range p.cls { - // The current planner is based on naively excecuting clauses by + // The current planner is based on naively executing clauses by // specificity. unresolvable, err := p.processClause(ctx, cls, lo) if err != nil { @@ -589,7 +589,7 @@ func (p *queryPlan) limit() { } // Execute queries the indicated graphs. -func (p *queryPlan) Excecute(ctx context.Context) (*table.Table, error) { +func (p *queryPlan) Execute(ctx context.Context) (*table.Table, error) { // Retrieve the data. lo := p.stm.GlobalLookupOptions() if err := p.processGraphPattern(ctx, lo); err != nil { @@ -616,7 +616,7 @@ func (p *queryPlan) Excecute(ctx context.Context) (*table.Table, error) { } // New create a new executable plan given a semantic BQL statement. -func New(ctx context.Context, store storage.Store, stm *semantic.Statement, chanSize int) (Excecutor, error) { +func New(ctx context.Context, store storage.Store, stm *semantic.Statement, chanSize int) (Executor, error) { switch stm.Type() { case semantic.Query: return newQueryPlan(ctx, store, stm, chanSize) diff --git a/bql/planner/planner_test.go b/bql/planner/planner_test.go index 78b686a5..fc9b13dc 100644 --- a/bql/planner/planner_test.go +++ b/bql/planner/planner_test.go @@ -47,7 +47,7 @@ func insertTest(t *testing.T) { if err != nil { t.Errorf("planner.New: should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - if _, err = pln.Excecute(ctx); err != nil { + if _, err = pln.Execute(ctx); err != nil { t.Errorf("planner.Execute: failed to execute insert plan with error %v", err) } g, err := memory.DefaultStore.Graph(ctx, "?a") @@ -86,7 +86,7 @@ func deleteTest(t *testing.T) { if err != nil { t.Errorf("planner.New: should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - if _, err = pln.Excecute(ctx); err != nil { + if _, err = pln.Execute(ctx); err != nil { t.Errorf("planner.Execute: failed to execute insert plan with error %v", err) } g, err := memory.DefaultStore.Graph(ctx, "?a") @@ -157,7 +157,7 @@ func TestPlannerCreateGraph(t *testing.T) { if err != nil { t.Errorf("planner.New: should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - if _, err := pln.Excecute(ctx); err != nil { + if _, err := pln.Execute(ctx); err != nil { t.Errorf("planner.Execute: failed to execute insert plan with error %v", err) } if _, err := memory.DefaultStore.Graph(ctx, "?foo"); err != nil { @@ -188,7 +188,7 @@ func TestPlannerDropGraph(t *testing.T) { if err != nil { t.Errorf("planner.New: should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - if _, err := pln.Excecute(ctx); err != nil { + if _, err := pln.Execute(ctx); err != nil { t.Errorf("planner.Execute: failed to execute insert plan with error %v", err) } if g, err := memory.DefaultStore.Graph(ctx, "?foo"); err == nil { @@ -499,7 +499,7 @@ func TestPlannerQuery(t *testing.T) { if err != nil { t.Errorf("planner.New failed to create a valid query plan with error %v", err) } - tbl, err := plnr.Excecute(ctx) + tbl, err := plnr.Execute(ctx) if err != nil { t.Errorf("planner.Excecute failed for query %q with error %v", entry.q, err) continue @@ -513,7 +513,7 @@ func TestPlannerQuery(t *testing.T) { } } -func TestTreeTravesalToRoot(t *testing.T) { +func TestTreeTraversalToRoot(t *testing.T) { // Graph traversal data. traversalTriples := `/person "born in"@[] /city /person "parent of"@[] /person @@ -550,7 +550,7 @@ func TestTreeTravesalToRoot(t *testing.T) { if err != nil { t.Errorf("planner.New failed to create a valid query plan with error %v", err) } - tbl, err := plnr.Excecute(ctx) + tbl, err := plnr.Execute(ctx) if err != nil { t.Errorf("planner.Excecute failed for query %q with error %v", traversalQuery, err) } @@ -581,7 +581,7 @@ func benchmarkQuery(query string, b *testing.B) { if err != nil { b.Errorf("planner.New failed to create a valid query plan with error %v", err) } - _, err = plnr.Excecute(ctx) + _, err = plnr.Execute(ctx) if err != nil { b.Errorf("planner.Excecute failed for query %q with error %v", query, err) } diff --git a/bql/semantic/convert.go b/bql/semantic/convert.go index b90723f0..d9029168 100644 --- a/bql/semantic/convert.go +++ b/bql/semantic/convert.go @@ -31,7 +31,7 @@ func (s Symbol) String() string { return string(s) } -// ConsumedElement groups the curernt element being processed by the parser. +// ConsumedElement groups the current element being processed by the parser. type ConsumedElement struct { isSymbol bool symbol Symbol @@ -46,7 +46,7 @@ func NewConsumedSymbol(s Symbol) ConsumedElement { } } -// NewConsumedToken create a new consumed element that boxes a roken. +// NewConsumedToken create a new consumed element that boxes a token. func NewConsumedToken(tkn *lexer.Token) ConsumedElement { return ConsumedElement{ isSymbol: false, diff --git a/bql/semantic/expression.go b/bql/semantic/expression.go index 31130f75..7f2a1663 100644 --- a/bql/semantic/expression.go +++ b/bql/semantic/expression.go @@ -27,7 +27,7 @@ import ( // Evaluator interface computes the evaluation of a boolean expression. type Evaluator interface { // Evaluate computes the boolean value of the expression given a certain - // restults table row. It will return an + // results table row. It will return an // error if it could not be evaluated for the provided table row. Evaluate(r table.Row) (bool, error) } @@ -208,7 +208,7 @@ func (e *booleanNode) Evaluate(r table.Row) (bool, error) { } } -// NewBinaryBooleanExpression creates a new binary boolean evalautor. +// NewBinaryBooleanExpression creates a new binary boolean evaluator. func NewBinaryBooleanExpression(op OP, lE, rE Evaluator) (Evaluator, error) { switch op { case AND, OR: @@ -224,7 +224,7 @@ func NewBinaryBooleanExpression(op OP, lE, rE Evaluator) (Evaluator, error) { } } -// NewUnaryBooleanExpression creates a new unary boolean evalautor. +// NewUnaryBooleanExpression creates a new unary boolean evaluator. func NewUnaryBooleanExpression(op OP, lE Evaluator) (Evaluator, error) { switch op { case NOT: diff --git a/bql/semantic/hooks.go b/bql/semantic/hooks.go index f97fa084..ada327c7 100644 --- a/bql/semantic/hooks.go +++ b/bql/semantic/hooks.go @@ -106,16 +106,16 @@ func dataAccumulator(b literal.Builder) ElementHook { } var ( - // predicateRegexp contains the regular expression for not fullly defined predicates. + // predicateRegexp contains the regular expression for not fully defined predicates. predicateRegexp *regexp.Regexp - // boundRegexp contains the regular expression for not fullly defined predicate bounds. + // boundRegexp contains the regular expression for not fully defined predicate bounds. boundRegexp *regexp.Regexp // dach provides a unique data hook generator. dach ElementHook - // gach provide a unique hook to collect all targetted Graphs + // gach provide a unique hook to collect all targeted Graphs // for a given Statement. gach ElementHook @@ -143,13 +143,13 @@ var ( // gbch contains the variable for collecting bindings from a group by. gbch ElementHook - // gcch contrains the clause hook to validate group by bindings. + // gcch contains the clause hook to validate group by bindings. gcch ClauseHook // obch contains the variable for collecting bindings from a order by. obch ElementHook - // occh contrains the clause hook to validate order by bindings. + // occh contains the clause hook to validate order by bindings. occh ClauseHook // hech contains the element hook to collect all the tokens that form the @@ -237,13 +237,13 @@ func VarAccumulatorHook() ElementHook { } // VarBindingsGraphChecker returns the singleton for checking a query statement -// for valid bidings in the select variables. +// for valid bindings in the select variables. func VarBindingsGraphChecker() ClauseHook { return bgch } // GroupByBindings returns the singleton for collecting all the group by -// bidings. +// bindings. func GroupByBindings() ElementHook { return gbch } @@ -255,7 +255,7 @@ func GroupByBindingsChecker() ClauseHook { } // OrderByBindings returns the singleton for collecting all the group by -// bidings. +// bindings. func OrderByBindings() ElementHook { return obch } @@ -315,7 +315,7 @@ func graphAccumulator() ElementHook { func whereNextWorkingClause() ClauseHook { var f ClauseHook f = func(s *Statement, _ Symbol) (ClauseHook, error) { - s.AddWorkingGrpahClause() + s.AddWorkingGraphClause() return f, nil } return f @@ -396,8 +396,8 @@ func whereSubjectClause() ElementHook { return f } -// processPredicate updates the working graph clause if threre is an available -// predcicate. +// processPredicate updates the working graph clause if there is an available +// predicate. func processPredicate(c *GraphClause, ce ConsumedElement, lastNopToken *lexer.Token) (*predicate.Predicate, string, string, bool, error) { var ( nP *predicate.Predicate @@ -426,8 +426,8 @@ func processPredicate(c *GraphClause, ce ConsumedElement, lastNopToken *lexer.To return nil, pID, pAnchorBinding, temporal, nil } -// processPredicateBound updates the working graph clause if threre is an -// available predcicate bound. +// processPredicateBound updates the working graph clause if there is an +// available predicate bound. func processPredicateBound(c *GraphClause, ce ConsumedElement, lastNopToken *lexer.Token) (string, string, string, *time.Time, *time.Time, bool, error) { var ( pID string @@ -443,7 +443,7 @@ func processPredicateBound(c *GraphClause, ce ConsumedElement, lastNopToken *lex } id, tl, tu := cmps[0][1], cmps[0][2], cmps[0][3] pID = id - // Lower bound procssing. + // Lower bound processing. if strings.Index(tl, "?") != -1 { pLowerBoundAlias = tl } else { @@ -456,7 +456,7 @@ func processPredicateBound(c *GraphClause, ce ConsumedElement, lastNopToken *lex pLowerBound = &ptl } } - // Lower bound procssing. + // Lower bound processing. if strings.Index(tu, "?") != -1 { pUpperBoundAlias = tu } else { @@ -722,7 +722,7 @@ func groupByBindings() ElementHook { return f } -// groupByBindingsChecker checks that all group by bindings are valid ouytput +// groupByBindingsChecker checks that all group by bindings are valid output // bindings. func groupByBindingsChecker() ClauseHook { var f ClauseHook @@ -786,7 +786,7 @@ func orderByBindings() ElementHook { return f } -// orderByBindingsChecker checks that all order by bindings are valid ouytput +// orderByBindingsChecker checks that all order by bindings are valid output // bindings. func orderByBindingsChecker() ClauseHook { var f ClauseHook @@ -840,7 +840,7 @@ func havingExpression() ElementHook { } // havingExpressionBuilder given the collected tokens that forms the having -// clause expression, it builds the expresion to use when filtering values +// clause expression, it builds the expression to use when filtering values // on the final result table. func havingExpressionBuilder() ClauseHook { var f ClauseHook diff --git a/bql/semantic/hooks_test.go b/bql/semantic/hooks_test.go index 07c46b8d..d81e7d8b 100644 --- a/bql/semantic/hooks_test.go +++ b/bql/semantic/hooks_test.go @@ -300,7 +300,7 @@ func TestWhereSubjectClauseHook(t *testing.T) { }) } -func TestWherePredicatClauseHook(t *testing.T) { +func TestWherePredicateClauseHook(t *testing.T) { st := &Statement{} f := wherePredicateClause() st.ResetWorkingGraphClause() @@ -1254,7 +1254,7 @@ func TestGroupByBindings(t *testing.T) { t.Errorf("semantic.groupByBindings should never fail with error %v", err) } } - // Check collected ouytput. + // Check collected output. if got, want := st.groupBy, entry.want; !reflect.DeepEqual(got, want) { t.Errorf("semantic.groupByBindings failed to collect the expected group by bindings; got %v, want %v", got, want) } @@ -1388,7 +1388,7 @@ func TestOrderByBindings(t *testing.T) { t.Errorf("semantic.orderByBindings should never fail with error %v", err) } } - // Check collected ouytput. + // Check collected output. if got, want := st.orderBy, entry.want; !reflect.DeepEqual(got, want) { t.Errorf("semantic.orderByBindings failed to collect the expected group by bindings; got %v, want %v", got, want) } @@ -1579,7 +1579,7 @@ func TestHavingExpression(t *testing.T) { t.Errorf("semantic.havingExpression should never fail with error %v", err) } } - // Check collected ouytput. + // Check collected output. if got, want := st.havingExpression, entry.want; !reflect.DeepEqual(got, want) { t.Errorf("semantic.havingExpression failed to collect the expected tokens; got %v, want %v", got, want) } @@ -1747,7 +1747,7 @@ func TestLimitCollection(t *testing.T) { t.Errorf("semantic.limitCollection should never fail with error %v", err) } } - // Check collected ouytput. + // Check collected output. if got, want := st.limit, entry.want; !st.limitSet || got != want { t.Errorf("semantic.limitClause failed to collect the expected value; got %v, want %v (%v)", got, want, st.limitSet) } @@ -1907,7 +1907,7 @@ func TestCollectGlobalBounds(t *testing.T) { if fail { continue } - // Check collected ouytput. + // Check collected output. if got, want := st.lookupOptions, entry.want; !entry.fail && !reflect.DeepEqual(got, want) { t.Errorf("semantic.CollectGlobalBounds failed to collect the expected value for case %q; got %v, want %v (%v)", entry.id, got, want, st.limitSet) } diff --git a/bql/semantic/semantic.go b/bql/semantic/semantic.go index dba5eb1e..629949c4 100644 --- a/bql/semantic/semantic.go +++ b/bql/semantic/semantic.go @@ -13,9 +13,9 @@ // limitations under the License. // Package semantic contains the semantic analysis required to have a -// senantically valid parser. It includes the data conversion required to +// semantically valid parser. It includes the data conversion required to // turn tokens into valid BadWolf structures. It also provides the hooks -// implementations required for buliding an actionable execution plan. +// implementations required for building an actionable execution plan. package semantic import ( @@ -38,7 +38,7 @@ type StatementType int8 const ( // Query statement. Query StatementType = iota - // Insert statemrnt. + // Insert statement. Insert // Delete statement. Delete @@ -176,7 +176,7 @@ func (c *GraphClause) IsEmpty() bool { return reflect.DeepEqual(c, &GraphClause{}) } -// BindType set he type of a statement. +// BindType sets the type of a statement. func (s *Statement) BindType(st StatementType) { s.sType = st } @@ -206,7 +206,7 @@ func (s *Statement) Data() []*triple.Triple { return s.data } -// GraphPatternClauses return the list of graph pattern clauses +// GraphPatternClauses returns the list of graph pattern clauses func (s *Statement) GraphPatternClauses() []*GraphClause { return s.pattern } @@ -221,23 +221,23 @@ func (s *Statement) WorkingClause() *GraphClause { return s.workingClause } -// AddWorkingGrpahClause add the current working graph clause to the set of +// AddWorkingGraphClause adds the current working graph clause to the set of // clauses that form the graph pattern. -func (s *Statement) AddWorkingGrpahClause() { +func (s *Statement) AddWorkingGraphClause() { if s.workingClause != nil || !s.workingClause.IsEmpty() { s.pattern = append(s.pattern, s.workingClause) } s.ResetWorkingGraphClause() } -// addtoBindings add the binding if not empty. +// addToBindings adds the binding if not empty. func addToBindings(bs map[string]int, b string) { if b != "" { bs[b]++ } } -// BindingsMap retuns the set of bindings available on the graph clauses for he +// BindingsMap returns the set of bindings available on the graph clauses for he // statement. func (s *Statement) BindingsMap() map[string]int { bm := make(map[string]int) @@ -268,7 +268,7 @@ func (s *Statement) BindingsMap() map[string]int { return bm } -// Bindings retuns the list of bindings available on the graph clauses for he +// Bindings returns the list of bindings available on the graph clauses for he // statement. func (s *Statement) Bindings() []string { var bs []string @@ -281,12 +281,12 @@ func (s *Statement) Bindings() []string { // bySpecificity type helps sort clauses by Specificity. type bySpecificity []*GraphClause -// Len returns the lenght of the clauses array. +// Len returns the length of the clauses array. func (s bySpecificity) Len() int { return len(s) } -// Swap exchange the i and j elements in the clauses array. +// Swap exchanges the i and j elements in the clauses array. func (s bySpecificity) Swap(i, j int) { s[i], s[j] = s[j], s[i] } @@ -309,7 +309,7 @@ func (s *Statement) SortedGraphPatternClauses() []*GraphClause { return ptrns } -// Projection contails the information required to project the outcome of +// Projection contains the information required to project the outcome of // querying with GraphClauses. It also contains the information of what // aggregation function should be used. type Projection struct { @@ -324,7 +324,7 @@ func (p *Projection) String() string { return fmt.Sprintf("%s as %s (%s, %s)", p.Binding, p.Alias, p.OP, p.Modifier) } -// IsEmpty check if the given projection is empty. +// IsEmpty checks if the given projection is empty. func (p *Projection) IsEmpty() bool { return p.Binding == "" && p.Alias == "" && p.OP == lexer.ItemError && p.Modifier == lexer.ItemError } @@ -342,7 +342,7 @@ func (s *Statement) WorkingProjection() *Projection { return s.workingProjection } -// AddWorkingProjection add the current projection variableto the set of +// AddWorkingProjection adds the current projection variable to the set of // projects that this statement. func (s *Statement) AddWorkingProjection() { if s.workingProjection != nil && !s.workingProjection.IsEmpty() { @@ -356,7 +356,7 @@ func (s *Statement) Projections() []*Projection { return s.projection } -// InputBindings returns the list of incomming binding feed from a where clause. +// InputBindings returns the list of incoming binding feed from a where clause. func (s *Statement) InputBindings() []string { var res []string for _, p := range s.projection { diff --git a/bql/semantic/semantic_test.go b/bql/semantic/semantic_test.go index 8174dc64..4b7d594a 100644 --- a/bql/semantic/semantic_test.go +++ b/bql/semantic/semantic_test.go @@ -80,7 +80,7 @@ func TestGraphClauseManipulation(t *testing.T) { if st.WorkingClause() == nil { t.Fatalf("semantic.GraphClause.WorkingClause should return a working clause after initilization in %v", st) } - st.AddWorkingGrpahClause() + st.AddWorkingGraphClause() if got, want := len(st.GraphPatternClauses()), 1; got != want { t.Fatalf("semantic.GraphClause.Clauses return wrong number of clauses in %v; got %d, want %d", st, got, want) } @@ -116,7 +116,7 @@ func TestBindingListing(t *testing.T) { OUpperBoundAlias: "?" + v, } *wcls = *cls - stm.AddWorkingGrpahClause() + stm.AddWorkingGraphClause() } bds := stm.BindingsMap() if len(bds) != 10 { diff --git a/bql/table/table.go b/bql/table/table.go index 8b647104..a7b15a08 100644 --- a/bql/table/table.go +++ b/bql/table/table.go @@ -30,7 +30,7 @@ import ( ) // Table contains the results of a BQL query. This table implementation is not -// safe for concurrency. You should take appropiate precautions if you want to +// safe for concurrency. You should take appropriate precautions if you want to // access it concurrently and wrap to properly control concurrent operations. type Table struct { bs []string @@ -110,10 +110,10 @@ func (r Row) ToTextLine(res *bytes.Buffer, bs []string, sep string) error { return nil } -// AddRow adds a row to the end of a table. For preformance reasons, it does not -// check that all bindindgs are set, nor that they are declared on table +// AddRow adds a row to the end of a table. For performance reasons, it does not +// check that all bindings are set, nor that they are declared on table // creation. BQL builds valid tables, if you plan to create tables on your own -// you should be carful to provide valid rows. +// you should be careful to provide valid rows. func (t *Table) AddRow(r Row) { if len(r) > 0 { t.data = append(t.data, r) @@ -139,7 +139,7 @@ func (t *Table) Rows() []Row { return t.data } -// AddBindings add the new binings provided to the table. +// AddBindings add the new bindings provided to the table. func (t *Table) AddBindings(bs []string) { for _, b := range bs { if !t.mbs[b] { @@ -149,8 +149,8 @@ func (t *Table) AddBindings(bs []string) { } } -// ProjectBindings replaces the current bidings with the projected one. The -// provided bindings needs to be a subsed of the original bindings. If the +// ProjectBindings replaces the current bindings with the projected one. The +// provided bindings needs to be a subset of the original bindings. If the // provided bindings are not a subset of the original ones, the projection will // fail, leave the table unmodified, and return an error. The projection only // modify the bindings, but does not drop non projected data. @@ -169,7 +169,7 @@ func (t *Table) ProjectBindings(bs []string) error { return nil } -// HasBinding returns true if the binding currently exist on the teable. +// HasBinding returns true if the binding currently exist on the table. func (t *Table) HasBinding(b string) bool { return t.mbs[b] } @@ -224,7 +224,7 @@ func equalBindings(b1, b2 map[string]bool) bool { } // AppendTable appends the content of the provided table. It will fail it the -// target table is not empty and the binidngs do not match. +// target table is not empty and the bindings do not match. func (t *Table) AppendTable(t2 *Table) error { if t2 == nil { return nil @@ -261,7 +261,7 @@ func MergeRows(ms []Row) Row { return res } -// DotProduct does the doot product with the provided tatble +// DotProduct does the dot product with the provided table func (t *Table) DotProduct(t2 *Table) error { if !disjointBinding(t.mbs, t2.mbs) { return fmt.Errorf("DotProduct operations requires disjoint bindingts; instead got %v and %v", t.mbs, t2.mbs) @@ -312,7 +312,7 @@ func (t *Table) Limit(i int64) { } // SortConfig contains the sorting information. Contains the binding order -// to use wile sorting as well as the deriction for each of them to use. +// to use while sorting as well as the direction for each of them to use. type SortConfig []struct { Binding string Desc bool @@ -323,7 +323,7 @@ type bySortConfig struct { cfg SortConfig } -// Len returns the lenght of the table. +// Len returns the length of the table. func (c bySortConfig) Len() int { return len(c.rows) } @@ -476,7 +476,7 @@ func NewSumFloat64LiteralAccumulator(s float64) Accumulator { return &sumFloat64{s, s} } -// countAcc implements an accumulator that count accumulation occurances. +// countAcc implements an accumulator that count accumulation occurrences. type countAcc struct { state int64 } @@ -497,7 +497,7 @@ func NewCountAccumulator() Accumulator { return &countAcc{0} } -// countDistinctAcc implements an accumulator that count accumulation occurances. +// countDistinctAcc implements an accumulator that count accumulation occurrences. type countDistinctAcc struct { state map[string]int64 } @@ -521,12 +521,12 @@ func NewCountDistinctAccumulator() Accumulator { } // groupRangeReduce takes a sorted range and generates a new row containing -// the aggregated colums and the non agggregated ones. +// the aggregated columns and the non aggregated ones. func (t *Table) groupRangeReduce(i, j int, alias map[string]string, acc map[string]Accumulator) (Row, error) { if i > j { return nil, fmt.Errorf("cannot aggregate empty ranges [%d, %d)", i, j) } - // Ininitalize the range and accumulator results. + // Initialize the range and accumulator results. rng := t.data[i:j] vaccs := make(map[string]interface{}) // Reset the accumulators. @@ -589,12 +589,12 @@ type AliasAccPair struct { } // fullGroupRangeReduce takes a sorted range and generates a new row containing -// the aggregated colums and the non agggregated ones. +// the aggregated columns and the non aggregated ones. func (t *Table) fullGroupRangeReduce(i, j int, acc map[string]map[string]AliasAccPair) (Row, error) { if i > j { return nil, fmt.Errorf("cannot aggregate empty ranges [%d, %d)", i, j) } - // Ininitalize the range and accumulator results. + // Initialize the range and accumulator results. rng := t.data[i:j] // Reset the accumulators. for _, aap := range acc { @@ -698,7 +698,7 @@ func (t *Table) Reduce(cfg SortConfig, aaps []AliasAccPair) error { return fmt.Errorf("table.Reduce invalid reduce configuration in cfg=%v, aap=%v for table with binding %v", cfg, aaps, t.bs) } // Valid reduce configuration. Reduce sorts the table and then reduces - // contigous groups row groups. + // contiguous groups row groups. if t.NumRows() == 0 { return nil } diff --git a/bql/table/table_test.go b/bql/table/table_test.go index 75382303..d685be06 100644 --- a/bql/table/table_test.go +++ b/bql/table/table_test.go @@ -335,7 +335,7 @@ func TestProjectBindings(t *testing.T) { } } -func TestDisjoingBinding(t *testing.T) { +func TestDisjointBinding(t *testing.T) { testTable := []struct { b1 map[string]bool b2 map[string]bool @@ -673,7 +673,7 @@ func TestCountAccumulators(t *testing.T) { if got, want := cv.(int64), int64(5); got != want { t.Errorf("Count accumulator failed; got %d, want %d", got, want) } - // Count distint accumulator + // Count distinct accumulator var ( dv interface{} da = NewCountDistinctAccumulator() diff --git a/bql/version/version.go b/bql/version/version.go index b5c39a98..270cbe75 100644 --- a/bql/version/version.go +++ b/bql/version/version.go @@ -19,10 +19,10 @@ var ( Major = 0 // Minor is the current minor version of master branch. Minor = 4 - // Patch is the curernt patched version of the master branch. + // Patch is the current patched version of the master branch. Patch = 3 // Release is the current release level of the master branch. Valid values - // are dev (developement unreleased), rcX (release candidate with current + // are dev (development unreleased), rcX (release candidate with current // iteration), stable (indicates a final released version). Release = "dev" ) diff --git a/docs/bql.md b/docs/bql.md index 6e720555..d85cb30e 100644 --- a/docs/bql.md +++ b/docs/bql.md @@ -1,7 +1,7 @@ # BQL: BadWolf Query language BadWolf provides a high level declarative query and update language. BQL -(or BadWolf Query Language) is a declarative language losely modeled after +(or BadWolf Query Language) is a declarative language loosely modeled after [SPARQL](https://en.wikipedia.org/wiki/SPARQL) to fit the temporal nature of BadWolf graph data. diff --git a/docs/storage_abstraction_layer.md b/docs/storage_abstraction_layer.md index fa4add41..c968fafc 100644 --- a/docs/storage_abstraction_layer.md +++ b/docs/storage_abstraction_layer.md @@ -19,7 +19,7 @@ The storage abstraction layer is built around two simple interfaces: query language. The goal of these interfaces is to allow writing specialized drivers for -different storage backends. For instance, BadWolf provides a simple +different storage back-ends. For instance, BadWolf provides a simple memory-based implementation of these interfaces in the ```storage/memory``` package. All relevant interface definitions can be found in the [storage.go](../storage/storage.go) file of the ```storage``` package. Also diff --git a/docs/temporal_graph_modeling.md b/docs/temporal_graph_modeling.md index ca899abe..5961c35f 100644 --- a/docs/temporal_graph_modeling.md +++ b/docs/temporal_graph_modeling.md @@ -32,7 +32,7 @@ types. * _Equality_: Given two types A and B, A == B if and only if they have the exact same path representation. In other words, if strings(A)==string(B) - wher == is the case sensitive equal. + where == is the case sensitive equal. * _Covariant_: Given two types A and B, A [covariant](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) ) B if B _is a_ A. In other words, A _covariant_ B if B is a prefix @@ -78,7 +78,7 @@ Also, as mentioned earlier, all values and, hence, literals are immutable. _String_ and _Blob_ can contain elements of arbitrary length. This can be problematic depending on the storage backend being used. For that reason, the ```literal``` package provides mechanisms to enforce maximum length limits -to protect storage backends. +to protect storage back-ends. Two literal builders are provided to create new literals: @@ -91,7 +91,7 @@ by the string representation of the value between quotes followed by ```^^``` an the type assertion ```type:``` with the corresponding type appended. This pretty printing convention loosely follows the [RDF specification for literals](http://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal) -also simplifying the parsing of such string formated literals. Some examples +also simplifying the parsing of such string formatted literals. Some examples of pretty printed literals are shown below. ``` diff --git a/io/io.go b/io/io.go index 06674e44..1bd0a685 100644 --- a/io/io.go +++ b/io/io.go @@ -53,9 +53,9 @@ func ReadIntoGraph(ctx context.Context, g storage.Graph, r io.Reader, b literal. } // WriteGraph serializes the graph into the writer where each triple is -// marshalled into a separate line. If there is an error writting the +// marshaled into a separate line. If there is an error writing the // serialization will stop. It returns the number of triples serialized -// regardless if it succeded of it failed partialy. +// regardless if it succeeded or failed partially. func WriteGraph(ctx context.Context, w io.Writer, g storage.Graph) (int, error) { var ( wg sync.WaitGroup diff --git a/storage/memory/memory.go b/storage/memory/memory.go index 4f3fdce3..393029b0 100644 --- a/storage/memory/memory.go +++ b/storage/memory/memory.go @@ -183,7 +183,7 @@ func (m *memory) AddTriples(ctx context.Context, ts []*triple.Triple) error { return nil } -// RemoveTriples removes the trilpes from the storage. +// RemoveTriples removes the triples from the storage. func (m *memory) RemoveTriples(ctx context.Context, ts []*triple.Triple) error { for _, t := range ts { guid := t.GUID() @@ -228,7 +228,7 @@ type checker struct { o *storage.LookupOptions } -// newChecer creates a new checker for a given LookupOptions configuration. +// newChecker creates a new checker for a given LookupOptions configuration. func newChecker(o *storage.LookupOptions) *checker { return &checker{ max: o.MaxElements > 0, @@ -300,7 +300,7 @@ func (m *memory) Subjects(ctx context.Context, p *predicate.Predicate, o *triple return nil } -// PredicatesForSubjecAndObject publishes all predicates available for the +// PredicatesForSubjectAndObject publishes all predicates available for the // given subject and object to the provided channel. func (m *memory) PredicatesForSubjectAndObject(ctx context.Context, s *node.Node, o *triple.Object, lo *storage.LookupOptions, prds chan<- *predicate.Predicate) error { if prds == nil { @@ -360,7 +360,7 @@ func (m *memory) PredicatesForObject(ctx context.Context, o *triple.Object, lo * return nil } -// TriplesForSubject publishes all triples available for the given subect to +// TriplesForSubject publishes all triples available for the given subject to // the provided channel. func (m *memory) TriplesForSubject(ctx context.Context, s *node.Node, lo *storage.LookupOptions, trpls chan<- *triple.Triple) error { if trpls == nil { @@ -473,7 +473,7 @@ func (m *memory) Exist(ctx context.Context, t *triple.Triple) (bool, error) { return ok, nil } -// Triples allows to iterate over all available triples by pubhsing them to the +// Triples allows to iterate over all available triples by pushing them to the // provided channel. func (m *memory) Triples(ctx context.Context, trpls chan<- *triple.Triple) error { if trpls == nil { diff --git a/storage/memory/memory_test.go b/storage/memory/memory_test.go index 648c0039..9272d148 100644 --- a/storage/memory/memory_test.go +++ b/storage/memory/memory_test.go @@ -59,9 +59,9 @@ func TestGraphNames(t *testing.T) { t.Errorf("memoryStore.NewGraph: should never fail to crate a graph %s; %s", g, err) } } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. gns := make(chan string, len(gs)) if err := s.GraphNames(ctx, gns); err != nil { t.Errorf("memoryStore.GraphNames: failed with error %v", err) @@ -203,9 +203,9 @@ func TestObjects(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. os := make(chan *triple.Object, 100) if err := g.Objects(ctx, ts[0].Subject(), ts[0].Predicate(), storage.DefaultLookup, os); err != nil { t.Errorf("g.Objects(%s, %s) failed with error %v", ts[0].Subject(), ts[0].Predicate(), err) @@ -230,9 +230,9 @@ func TestSubjects(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. ss := make(chan *node.Node, 100) if err := g.Subjects(ctx, ts[0].Predicate(), ts[0].Object(), storage.DefaultLookup, ss); err != nil { t.Errorf("g.Subjects(%s, %s) failed with error %v", ts[0].Predicate(), ts[0].Object(), err) @@ -256,9 +256,9 @@ func TestPredicatesForSubjectAndObject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. ps := make(chan *predicate.Predicate, 100) if err := g.PredicatesForSubjectAndObject(ctx, ts[0].Subject(), ts[0].Object(), storage.DefaultLookup, ps); err != nil { t.Errorf("g.PredicatesForSubjectAndObject(%s, %s) failed with error %v", ts[0].Subject(), ts[0].Object(), err) @@ -281,9 +281,9 @@ func TestPredicatesForSubject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. ps := make(chan *predicate.Predicate, 100) if err := g.PredicatesForSubject(ctx, ts[0].Subject(), storage.DefaultLookup, ps); err != nil { t.Errorf("g.PredicatesForSubject(%s) failed with error %v", ts[0].Subject(), err) @@ -306,9 +306,9 @@ func TestPredicatesForObject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. ps := make(chan *predicate.Predicate, 100) if err := g.PredicatesForObject(ctx, ts[0].Object(), storage.DefaultLookup, ps); err != nil { t.Errorf("g.PredicatesForObject(%s) failed with error %v", ts[0].Object(), err) @@ -331,9 +331,9 @@ func TestTriplesForSubject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.TriplesForSubject(ctx, ts[0].Subject(), storage.DefaultLookup, trpls); err != nil { t.Errorf("g.TriplesForSubject(%s) failed with error %v", ts[0].Subject(), err) @@ -353,9 +353,9 @@ func TestTriplesForPredicate(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.TriplesForPredicate(ctx, ts[0].Predicate(), storage.DefaultLookup, trpls); err != nil { t.Errorf("g.TriplesForPredicate(%s) failed with error %v", ts[0].Subject(), err) @@ -375,9 +375,9 @@ func TestTriplesForObject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.TriplesForObject(ctx, ts[0].Object(), storage.DefaultLookup, trpls); err != nil { t.Errorf("g.TriplesForObject(%s) failed with error %v", ts[0].Object(), err) @@ -413,9 +413,9 @@ func TestTriplesForObjectWithLimit(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) lo := &storage.LookupOptions{ MaxElements: 2, @@ -448,9 +448,9 @@ func TestTriplesForSubjectAndPredicate(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.TriplesForSubjectAndPredicate(ctx, ts[0].Subject(), ts[0].Predicate(), storage.DefaultLookup, trpls); err != nil { t.Errorf("g.TriplesForSubjectAndPredicate(%s, %s) failed with error %v", ts[0].Subject(), ts[0].Predicate(), err) @@ -470,9 +470,9 @@ func TestTriplesForPredicateAndObject(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.TriplesForPredicateAndObject(ctx, ts[0].Predicate(), ts[0].Object(), storage.DefaultLookup, trpls); err != nil { t.Errorf("g.TriplesForPredicateAndObject(%s, %s) failed with error %v", ts[0].Predicate(), ts[0].Object(), err) @@ -509,9 +509,9 @@ func TestTriples(t *testing.T) { if err := g.AddTriples(ctx, ts); err != nil { t.Errorf("g.AddTriples(_) failed failed to add test triples with error %v", err) } - // To avoid blocking on the test. On a real usage of the driver you woul like + // To avoid blocking on the test. On a real usage of the driver you would like // to call the graph operation on a separated goroutine using a sync.WaitGroup - // to collect the error code eventualy. + // to collect the error code eventually. trpls := make(chan *triple.Triple, 100) if err := g.Triples(ctx, trpls); err != nil { t.Fatal(err) diff --git a/storage/storage.go b/storage/storage.go index d5726058..596cf104 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -30,10 +30,10 @@ type LookupOptions struct { // set it returns all the lookup results. MaxElements int - // LowerAnchor if provided represents the lower time anchor to be considered. + // LowerAnchor, if provided, represents the lower time anchor to be considered. LowerAnchor *time.Time - // UpperArnchor if provided represents the upper time anchor to be considered. + // UpperAnchor, if provided, represents the upper time anchor to be considered. UpperAnchor *time.Time } @@ -79,7 +79,7 @@ type Graph interface { // exists should not fail. AddTriples(ctx context.Context, ts []*triple.Triple) error - // RemoveTriples removes the trilpes from the storage. Removing triples that + // RemoveTriples removes the triples from the storage. Removing triples that // are not present on the store should not fail. RemoveTriples(ctx context.Context, ts []*triple.Triple) error @@ -147,7 +147,7 @@ type Graph interface { // is provided. PredicatesForObject(ctx context.Context, o *triple.Object, lo *LookupOptions, prds chan<- *predicate.Predicate) error - // PredicatesForSubjecAndObject pushes to the provided channel all predicates + // PredicatesForSubjectAndObject pushes to the provided channel all predicates // available for the given subject and object. The function does not return // immediately but spawns a goroutine to satisfy elements in the channel. // @@ -159,7 +159,7 @@ type Graph interface { PredicatesForSubjectAndObject(ctx context.Context, s *node.Node, o *triple.Object, lo *LookupOptions, prds chan<- *predicate.Predicate) error // TriplesForSubject pushes to the provided channel all triples available for - // the given subect. The function does not return immediately but spawns a + // the given subject. The function does not return immediately but spawns a // goroutine to satisfy elements in the channel. // // If the lookup options provide a max number of elements the function will diff --git a/tools/benchmark/generator/tree/tree.go b/tools/benchmark/generator/tree/tree.go index 0664b1a4..63c6b537 100644 --- a/tools/benchmark/generator/tree/tree.go +++ b/tools/benchmark/generator/tree/tree.go @@ -67,9 +67,9 @@ func (t *treeGenerator) newNode(branch int, parentID string) (*node.Node, error) return node.NewNode(t.nodeType, id), nil } -// newTriple creates a new triple given the parent and the descendent as an object. -func (t *treeGenerator) newTriple(parent, descendent *node.Node) (*triple.Triple, error) { - return triple.New(parent, t.predicate, triple.NewNodeObject(descendent)) +// newTriple creates a new triple given the parent and the descendant as an object. +func (t *treeGenerator) newTriple(parent, descendant *node.Node) (*triple.Triple, error) { + return triple.New(parent, t.predicate, triple.NewNodeObject(descendant)) } // recurse generated the triple by recursing while there are still triples diff --git a/tools/benchmark/generator/tree/tree_test.go b/tools/benchmark/generator/tree/tree_test.go index 0182108d..ac39d4ee 100644 --- a/tools/benchmark/generator/tree/tree_test.go +++ b/tools/benchmark/generator/tree/tree_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/badwolf/tools/benchmark/generator" ) -func TesEmpty(t *testing.T) { +func TestEmpty(t *testing.T) { } func TestNewNode(t *testing.T) { diff --git a/tools/benchmark/runtime/runtime.go b/tools/benchmark/runtime/runtime.go index 2355486c..6671e4c6 100644 --- a/tools/benchmark/runtime/runtime.go +++ b/tools/benchmark/runtime/runtime.go @@ -27,8 +27,8 @@ import ( var timeNow = time.Now // TrackDuration measure the duration of the run time function using the -// wall clock. You should not consider the returned duration in the precense -// or an error since it will likely have shortcut the excecution of the +// wall clock. You should not consider the returned duration in the presence +// or an error since it will likely have shortcut the execution of the // function being executed. func TrackDuration(f func() error) (time.Duration, error) { ts := timeNow() @@ -37,8 +37,8 @@ func TrackDuration(f func() error) (time.Duration, error) { return d, err } -// RepetitionDurationStats extracts some duration stats by repeateadly execution -// and measuring runtime. Retuns the mean and deviation of the run duration of +// RepetitionDurationStats extracts some duration stats by repeatedly execution +// and measuring runtime. Returns the mean and deviation of the run duration of // the provided function. If an error is return by the function it will shortcut // the execution and return just the error. func RepetitionDurationStats(reps int, setup, f, teardown func() error) (time.Duration, time.Duration, error) { @@ -81,7 +81,7 @@ func RepetitionDurationStats(reps int, setup, f, teardown func() error) (time.Du return time.Duration(mean), time.Duration(dev), nil } -// BenchEntry cotains the bench entry id, the function to run, and the number +// BenchEntry contains the bench entry id, the function to run, and the number // of repetitions to run. type BenchEntry struct { BatteryID string diff --git a/tools/benchmark/runtime/runtime_test.go b/tools/benchmark/runtime/runtime_test.go index a009b88a..b4676295 100644 --- a/tools/benchmark/runtime/runtime_test.go +++ b/tools/benchmark/runtime/runtime_test.go @@ -35,7 +35,7 @@ func init() { } } -func TestIncreasigMonotonicTimeNowIncrease(t *testing.T) { +func TestIncreasingMonotonicTimeNowIncrease(t *testing.T) { to := timeNow() for i := 0; i <= 100; i++ { tn := timeNow() @@ -86,7 +86,7 @@ func TestDurationStats(t *testing.T) { } } -func TestRuncBenchmarkBattery(t *testing.T) { +func TestRunBenchmarkBattery(t *testing.T) { var testData []*BenchEntry for i := 0; i < 1000; i++ { testData = append(testData, &BenchEntry{ diff --git a/tools/compliance/entry.go b/tools/compliance/entry.go index 564204ba..0014a0ea 100644 --- a/tools/compliance/entry.go +++ b/tools/compliance/entry.go @@ -16,7 +16,7 @@ // implementations and BQL behavior testing. The compliance package is built // around stories. A story is a collection of graphs and a sequence of // assertions against the provided data. An assertion is defined by a tuple -// containing a BQL, the execution status, and the expeted result table. +// containing a BQL, the execution status, and the expected result table. package compliance import ( @@ -36,11 +36,11 @@ type Graph struct { // ID of the binding name to use for the graph. ID string - // Facts contains the parseable tribles which define the graph. + // Facts contains the parseable triples which define the graph. Facts []string } -// Assertion contains a BQL, the expecte status of the BQL query execution, +// Assertion contains a BQL, the expected status of the BQL query execution, // and the returned results table. type Assertion struct { // Requires of the assertion. @@ -53,10 +53,10 @@ type Assertion struct { WillFail bool // MustReturn contains the table containing the expected results provided - // by the BQL statemnet execution. + // by the BQL statement execution. MustReturn []map[string]string - // The equivalent table representation of the MustReturn inforamtion. + // The equivalent table representation of the MustReturn information. table *table.Table } diff --git a/tools/compliance/runner.go b/tools/compliance/runner.go index bbeaa72a..29802b34 100644 --- a/tools/compliance/runner.go +++ b/tools/compliance/runner.go @@ -96,7 +96,7 @@ func (a *Assertion) runAssertion(ctx context.Context, st storage.Store, chanSize if err != nil { return errorizer(fmt.Errorf("Should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err)) } - tbl, err := pln.Excecute(ctx) + tbl, err := pln.Execute(ctx) if err != nil { return errorizer(fmt.Errorf("planner.Execute: failed to execute assertion %q with error %v", a.Requires, err)) } diff --git a/tools/vcli/bw/common/common.go b/tools/vcli/bw/common/common.go index 2de7c4e3..6e682b23 100644 --- a/tools/vcli/bw/common/common.go +++ b/tools/vcli/bw/common/common.go @@ -87,7 +87,7 @@ func Help(args []string, cmds []*command.Command) int { // StoreGenerator is a function that generate a new valid storage.Store. type StoreGenerator func() (storage.Store, error) -// InitializeDriver attemps to initalize the driver. +// InitializeDriver attempts to initialize the driver. func InitializeDriver(driverName string, drivers map[string]StoreGenerator) (storage.Store, error) { f, ok := drivers[driverName] if !ok { @@ -100,7 +100,7 @@ func InitializeDriver(driverName string, drivers map[string]StoreGenerator) (sto return f() } -// InitializeCommands intializes the avaialbe commands with the given storage +// InitializeCommands initializes the available commands with the given storage // instance. func InitializeCommands(driver storage.Store, chanSize, bulkTripleOpSize, builderSize int) []*command.Command { return []*command.Command{ diff --git a/tools/vcli/bw/io/io.go b/tools/vcli/bw/io/io.go index 34412ba4..444ac6f1 100644 --- a/tools/vcli/bw/io/io.go +++ b/tools/vcli/bw/io/io.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package io contains helper functions for io operatoins on the command line +// Package io contains helper functions for io operations on the command line // bw tool. package io @@ -59,7 +59,7 @@ func ReadLines(path string) ([]string, error) { return lines, scanner.Err() } -// ProcessLines from a file using the provied call back. The error of the +// ProcessLines from a file using the provided call back. The error of the // callback will be passed through. Returns the number of processed errors // before the error. Returns the line where the error occurred or the total // numbers of lines processed. diff --git a/tools/vcli/bw/main.go b/tools/vcli/bw/main.go index fdf1c237..c931e405 100644 --- a/tools/vcli/bw/main.go +++ b/tools/vcli/bw/main.go @@ -29,13 +29,13 @@ import ( ) var ( - // drivers contains the registed drivers available for this command line tool. + // drivers contains the registered drivers available for this command line tool. registeredDrivers map[string]common.StoreGenerator // Available flags. driver = flag.String("driver", "VOLATILE", "The storage driver to use {VOLATILE}.") bqlChannelSize = flag.Int("bql_channel_size", 0, "Internal channel size to use on BQL queries.") bulkTripleOpSize = flag.Int("bulk_triple_op_size", 1000, "Number of triples to use in bulk load operations.") - bulkTriplBuildersize = flag.Int("bulk_triple_builder_size_in_bytes", 1000, "Maximum size of literals when parsing a triple.") + bulkTripleBuilderSize = flag.Int("bulk_triple_builder_size_in_bytes", 1000, "Maximum size of literals when parsing a triple.") // Add your driver flags below. ) @@ -52,5 +52,5 @@ func registerDrivers() { func main() { flag.Parse() registerDrivers() - os.Exit(common.Run(*driver, registeredDrivers, *bqlChannelSize, *bulkTripleOpSize, *bulkTriplBuildersize)) + os.Exit(common.Run(*driver, registeredDrivers, *bqlChannelSize, *bulkTripleOpSize, *bulkTripleBuilderSize)) } diff --git a/tools/vcli/bw/repl/repl.go b/tools/vcli/bw/repl/repl.go index b3ccd591..23a8dc54 100644 --- a/tools/vcli/bw/repl/repl.go +++ b/tools/vcli/bw/repl/repl.go @@ -54,11 +54,11 @@ func New(driver storage.Store, chanSize, bulkSize, builderSize int) *command.Com type readLiner func(*os.File) <-chan string -// simpleReadline reads a line from the provided file. This does not support +// simpleReadLine reads a line from the provided file. This does not support // any advanced terminal functionalities. // // TODO(xllora): Replace simple reader for function that supports advanced -// teminal input. +// terminal input. func simpleReadLine(f *os.File) <-chan string { c := make(chan string) go func() { @@ -181,7 +181,7 @@ func runBQLFromFile(ctx context.Context, driver storage.Store, chanSize int, lin return path, len(lines), nil } -// runBQL attemps to excecute the provided query against the given store. +// runBQL attempts to execute the provided query against the given store. func runBQL(ctx context.Context, bql string, s storage.Store, chanSize int) (*table.Table, error) { p, err := grammar.NewParser(grammar.SemanticBQL()) if err != nil { @@ -195,7 +195,7 @@ func runBQL(ctx context.Context, bql string, s storage.Store, chanSize int) (*ta if err != nil { return nil, fmt.Errorf("should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - res, err := pln.Excecute(ctx) + res, err := pln.Execute(ctx) if err != nil { return nil, fmt.Errorf("planner.Execute: failed to execute insert plan with error %v", err) } diff --git a/tools/vcli/bw/run/run.go b/tools/vcli/bw/run/run.go index cc562633..34843a44 100644 --- a/tools/vcli/bw/run/run.go +++ b/tools/vcli/bw/run/run.go @@ -78,7 +78,7 @@ func runCommand(ctx context.Context, cmd *command.Command, args []string, store return 0 } -// BQL attemps to excecute the provided query against the given store. +// BQL attempts to execute the provided query against the given store. func BQL(ctx context.Context, bql string, s storage.Store, chanSize int) (*table.Table, error) { p, err := grammar.NewParser(grammar.SemanticBQL()) if err != nil { @@ -92,7 +92,7 @@ func BQL(ctx context.Context, bql string, s storage.Store, chanSize int) (*table if err != nil { return nil, fmt.Errorf("[ERROR] Should have not failed to create a plan using memory.DefaultStorage for statement %v with error %v", stm, err) } - res, err := pln.Excecute(ctx) + res, err := pln.Execute(ctx) if err != nil { return nil, fmt.Errorf("[ERROR] Failed to execute BQL statement with error %v", err) } diff --git a/triple/literal/literal.go b/triple/literal/literal.go index c99a80af..ec44f1fc 100644 --- a/triple/literal/literal.go +++ b/triple/literal/literal.go @@ -67,7 +67,7 @@ func (l *Literal) Type() Type { return l.t } -// String eturns a string representation of the literal. +// String returns a string representation of the literal. func (l *Literal) String() string { return fmt.Sprintf("\"%v\"^^type:%v", l.Interface(), l.Type()) } @@ -131,7 +131,7 @@ func (l *Literal) Interface() interface{} { return l.v } -// Builder interface provides a standar way to build literals given a type and +// Builder interface provides a standard way to build literals given a type and // a given value. type Builder interface { Build(t Type, v interface{}) (*Literal, error) @@ -145,11 +145,11 @@ func init() { defaultBuilder = &unboundBuilder{} } -// The deatuls bilder is unbound. This allows to create a literal arbitrarily +// The default builder is unbound. This allows to create a literal arbitrarily // long. type unboundBuilder struct{} -// Build creates a new unboud literal from a type and a value. +// Build creates a new unbound literal from a type and a value. func (b *unboundBuilder) Build(t Type, v interface{}) (*Literal, error) { switch v.(type) { case bool: @@ -181,7 +181,7 @@ func (b *unboundBuilder) Build(t Type, v interface{}) (*Literal, error) { }, nil } -// Parse creates a string out of a prettyfied representation. +// Parse creates a string out of a prettified representation. func (b *unboundBuilder) Parse(s string) (*Literal, error) { raw := strings.TrimSpace(s) if len(raw) == 0 { @@ -282,7 +282,7 @@ func (b *boundedBuilder) Parse(s string) (*Literal, error) { return l, nil } -// NewBoundedBuilder creates a builder that that guarantess that no literal will +// NewBoundedBuilder creates a builder that guarantees that no literal will // be created if the size of the string or a blob is bigger than the provided // maximum. func NewBoundedBuilder(max int) Builder { diff --git a/triple/node/node.go b/triple/node/node.go index e96a7338..d215cc13 100644 --- a/triple/node/node.go +++ b/triple/node/node.go @@ -39,7 +39,7 @@ func (t *Type) Covariant(ot *Type) bool { if !strings.HasPrefix(t.String(), ot.String()) { return false } - // /type/foo is covarian of /type, but /typefoo is not covatiant of /type. + // /type/foo is covariant of /type, but /typefoo is not covariant of /type. return len(t.String()) == len(ot.String()) || t.String()[len(ot.String())] == '/' } @@ -189,7 +189,7 @@ func init() { } // NewBlankNode creates a new blank node. The blank node ID is guaranteed to -// be uique in BadWolf. +// be unique in BadWolf. func NewBlankNode() *Node { id := ID(<-nextVal) return &Node{ diff --git a/triple/predicate/predicate.go b/triple/predicate/predicate.go index 8f44c9fa..373d0add 100644 --- a/triple/predicate/predicate.go +++ b/triple/predicate/predicate.go @@ -152,7 +152,7 @@ func NewTemporal(id string, t time.Time) (*Predicate, error) { } // GUID returns a global unique identifier for the given predicate. It is -// implemented as the base64 encoded stringified version of the preducate. +// implemented as the base64 encoded stringified version of the predicate. func (p *Predicate) GUID() string { return base64.StdEncoding.EncodeToString([]byte(p.String())) } diff --git a/triple/triple.go b/triple/triple.go index a7d9e171..48d26f59 100644 --- a/triple/triple.go +++ b/triple/triple.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package triple implements and allows to manipulate Badwolf triples. +// Package triple implements and allows to manipulate BadWolf triples. package triple import ( @@ -161,7 +161,7 @@ func (t *Triple) Predicate() *predicate.Predicate { return t.p } -// Object returns the object of the tirple. +// Object returns the object of the triple. func (t *Triple) Object() *Object { return t.o }