query

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: GPL-3.0 Imports: 9 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 = 57364
View Source
const BAR = 57365
View Source
const COMMA = 57354
View Source
const COUNT = 57347
View Source
const DISTINCT = 57348
View Source
const DOT = 57359
View Source
const LBRACE = 57355
View Source
const LBRACK = 57369
View Source
const LIMIT = 57353
View Source
const LINK = 57366
View Source
const LPAREN = 57357
View Source
const NUMBER = 57371
View Source
const OR = 57350
View Source
const PARTIAL = 57352
View Source
const PLUS = 57362
View Source
const QUESTION = 57363
View Source
const RBRACE = 57356
View Source
const RBRACK = 57370
View Source
const RPAREN = 57358
View Source
const SELECT = 57346
View Source
const SEMICOLON = 57360
View Source
const SLASH = 57361
View Source
const UNION = 57351
View Source
const URI = 57368
View Source
const VAR = 57367
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) Equals

func (f Filter) Equals(f2 Filter) bool
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
}

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)

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
}

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