spock

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: AGPL-3.0 Imports: 4 Imported by: 4

README

spock

Documentation

Index

Constants

View Source
const IRI = iri("")

Variables

This section is empty.

Functions

This section is empty.

Types

type Bag

type Bag []SPOCK

Collection of knowledge statements

func (*Bag) Join

func (bag *Bag) Join(spock SPOCK) error

type Clause

type Clause int

types of predicate clauses

const (
	ALL Clause = iota
	EQ         // Equal
	PQ         // Prefix Equal
	LT         // Less Than
	GT         // Greater Than
	IN         // InRange, Between
)

type Hint

type Hint int

Hint to construct the query

const (
	HINT_NONE Hint = iota
	HINT_FILTER
	HINT_FILTER_PREFIX
	HINT_MATCH
)

type Pattern

type Pattern struct {
	Strategy                     Strategy
	S                            *Predicate[xsd.AnyURI]
	P                            *Predicate[xsd.AnyURI]
	O                            *Predicate[xsd.Value]
	HintForS, HintForP, HintForO Hint
}

func Query

func Query(
	s *Predicate[xsd.AnyURI],
	p *Predicate[xsd.AnyURI],
	o *Predicate[xsd.Value],
) Pattern

func (Pattern) Dump

func (q Pattern) Dump() string

func (Pattern) String

func (q Pattern) String() string

type Predicate

type Predicate[T any] struct {
	Clause Clause
	Value  T
	Other  T
}

Predicate expression

func Eq

func Eq[T xsd.DataType](value T) *Predicate[xsd.Value]

Makes `equal to` value predicate

func Gt

func Gt[T xsd.DataType](value T) *Predicate[xsd.Value]

Makes `greater than` value predicate

func HasPrefix

func HasPrefix[T xsd.DataType](value T) *Predicate[xsd.Value]

Makes `prefix` value predicate

func In

func In[T xsd.DataType](from, to T) *Predicate[xsd.Value]

Makes `in range` predicate

func Lt

func Lt[T xsd.DataType](value T) *Predicate[xsd.Value]

Makes `less than` value predicate

func (Predicate[T]) String

func (pred Predicate[T]) String() string

type SPOCK

type SPOCK struct {
	S xsd.AnyURI // s: subject
	P xsd.AnyURI // p: predicate
	O xsd.Value  // o: object
	C float64    // c: credibility
	K guid.K     // k: k-order
}

Knowledge statement

func From

func From[T xsd.DataType](s, p curie.IRI, o T) SPOCK

Create new knowledge statement From

func (SPOCK) String

func (spock SPOCK) String() string

type Strategy

type Strategy int

Lookup strategy for knowledge statements

const (
	STRATEGY_NONE Strategy = iota
	STRATEGY_SPO
	STRATEGY_SOP
	STRATEGY_PSO
	STRATEGY_POS
	STRATEGY_OPS
	STRATEGY_OSP
)

type Stream

type Stream interface {
	Head() SPOCK
	Next() bool
	FMap(func(SPOCK) error) error
}

Stream of knowledge statements ⟨s,p,o,c,k⟩

func NewFilter

func NewFilter(pred func(SPOCK) bool, stream Stream) Stream

func NewFilterO

func NewFilterO(hint Hint, q *Predicate[xsd.Value], stream Stream) Stream

func NewFilterP

func NewFilterP(hint Hint, q *Predicate[xsd.AnyURI], stream Stream) Stream

func NewFilterS

func NewFilterS(hint Hint, q *Predicate[xsd.AnyURI], stream Stream) Stream

Directories

Path Synopsis
encoding
store
dynamo Module
ephemeral Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳