query

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: GPL-3.0 Imports: 11 Imported by: 0

README

Hod Query

What to preserve from SPARQL:

Documentation

Index

Constants

View Source
const (
	PATTERN_SINGLE = iota + 1
	PATTERN_ZERO_ONE
	PATTERN_ONE_PLUS
	PATTERN_ZERO_PLUS
)
View Source
const ASTERISK = 57366
View Source
const BAR = 57367
View Source
const COMMA = 57356
View Source
const COUNT = 57347
View Source
const DISTINCT = 57348
View Source
const DOT = 57361
View Source
const FULLURI = 57371
View Source
const LBRACE = 57357
View Source
const LBRACK = 57372
View Source
const LIMIT = 57353
View Source
const LINK = 57368
View Source
const LITERAL = 57375
View Source
const LPAREN = 57359
View Source
const NAMESPACE = 57355
View Source
const NUMBER = 57374
View Source
const OR = 57350
View Source
const PARTIAL = 57352
View Source
const PLUS = 57364
View Source
const PREFIX = 57354
View Source
const QUESTION = 57365
View Source
const RBRACE = 57358
View Source
const RBRACK = 57373
View Source
const RPAREN = 57360
View Source
const SELECT = 57346
View Source
const SEMICOLON = 57362
View Source
const SLASH = 57363
View Source
const UNION = 57351
View Source
const URI = 57370
View Source
const VAR = 57369
View Source
const WHERE = 57349

Variables

This section is empty.

Functions

func FlattenOrClauseList

func FlattenOrClauseList(oclist []OrClause) [][]Filter

func TokenName

func TokenName(t Token) string

Types

type Definition

type Definition struct {
	Token   Token
	Pattern string
	// contains filtered or unexported fields
}

type Filter

type Filter struct {
	Subject turtle.URI
	Path    []PathPattern
	Object  turtle.URI
}

func (Filter) Copy added in v0.4.0

func (f Filter) Copy() Filter

func (Filter) Equals

func (f Filter) Equals(f2 Filter) bool

func (Filter) NumVars added in v0.4.0

func (f Filter) NumVars() int

func (Filter) String added in v0.4.1

func (f Filter) String() string
type Link struct {
	Name string
}

type OrClause

type OrClause struct {
	// a component of an OR clause
	Terms []Filter
	// pointer to the left/right of OR clause
	// These are nestable
	LeftOr     []OrClause
	LeftTerms  []Filter
	RightOr    []OrClause
	RightTerms []Filter
}

func FilterListToOrClause

func FilterListToOrClause(filters []Filter) OrClause

func (OrClause) Flatten

func (oc OrClause) Flatten() [][]Filter

returns a flat list of triples that comes from expanding out the OrClause tree

type PathPattern

type PathPattern struct {
	Predicate turtle.URI
	Pattern   Pattern
}

func (PathPattern) String added in v0.4.1

func (pp PathPattern) String() string

type Pattern

type Pattern uint

func (Pattern) String

func (p Pattern) String() string

type Query

type Query struct {
	Select SelectClause
	Where  WhereClause
}

func Parse

func Parse(r io.Reader) (Query, error)

func (Query) Copy added in v0.4.0

func (q Query) Copy() Query

func (Query) Hash added in v0.4.1

func (q Query) Hash(orTerms [][]Filter) []byte

generate a unique hash for this query. To do this, we SORT the components (Select.Variables, Where.Filters, Where.Ors), and then append them together to create the hash

type Result

type Result struct {
	Token Token
	Value []byte
	Line  int
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(defs []Definition) *Scanner

func (*Scanner) Next

func (s *Scanner) Next() *Result

func (*Scanner) ScanWords

func (s *Scanner) ScanWords(data []byte, atEOF bool) (advance int, token []byte, err error)

slightly altered version of https://golang.org/src/bufio/scan.go?s=12794:12872 to keep track of line numbers

func (*Scanner) SetInput

func (s *Scanner) SetInput(input io.Reader)

func (*Scanner) Tokenize

func (s *Scanner) Tokenize() []*Result

type SelectClause

type SelectClause struct {
	Variables []SelectVar
	Distinct  bool
	Count     bool
	Partial   bool
	HasLinks  bool
	Limit     int
}

type SelectVar

type SelectVar struct {
	Var      turtle.URI
	AllLinks bool
	Links    []Link
}

func (SelectVar) Copy added in v0.4.0

func (v SelectVar) Copy() SelectVar

type Token

type Token uint32
const (
	EOF Token = 1<<32 - 1 - iota
	Error
)

type WhereClause

type WhereClause struct {
	Filters []Filter
	Ors     []OrClause
}

Jump to

Keyboard shortcuts

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