linkedql

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name exposed to the query interface.
	Name = "linkedql"
	// Namespace is an RDF namespace used for LinkedQL classes.
	Namespace = "http://cayley.io/linkedql#"
	// Prefix is an RDF namespace prefix used for LinkedQL classes.
	Prefix = "linkedql:"
)

Variables

This section is empty.

Functions

func AbsoluteValue

func AbsoluteValue(value quad.Value, ns *voc.Namespaces) quad.Value

AbsoluteValue uses given ns to resolve short IRIs and types in typed strings to their full form

func AbsoluteValues

func AbsoluteValues(values []quad.Value, ns *voc.Namespaces) []quad.Value

AbsoluteValues applies AbsoluteValue on each item in provided values using provided ns

func BuildIterator

func BuildIterator(step Step, qs graph.QuadStore, ns *voc.Namespaces) (query.Iterator, error)

BuildIterator for given Step returns a query.Iterator

func Register

func Register(typ RegistryItem)

Register adds an Item type to the registry.

func RegisteredTypes

func RegisteredTypes() []string

RegisteredTypes returns type names of all registered types.

func TypeByName

func TypeByName(name string) (reflect.Type, bool)

TypeByName returns a type by its registration name. See Register.

Types

type DocumentIterator

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

DocumentIterator is an iterator of documents from the graph

func NewDocumentIterator

func NewDocumentIterator(valueIt *ValueIterator) *DocumentIterator

NewDocumentIterator returns a new DocumentIterator for a QuadStore and Path.

func (*DocumentIterator) Close

func (it *DocumentIterator) Close() error

Close implements query.Iterator.

func (*DocumentIterator) Err

func (it *DocumentIterator) Err() error

Err implements query.Iterator.

func (*DocumentIterator) Next

func (it *DocumentIterator) Next(ctx context.Context) bool

Next implements query.Iterator.

func (*DocumentIterator) Result

func (it *DocumentIterator) Result() interface{}

Result implements query.Iterator.

type EntityBNode

type EntityBNode quad.BNode

EntityBNode is an entity BNode.

func (EntityBNode) BuildIdentifier

func (i EntityBNode) BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)

BuildIdentifier implements EntityIdentifier

type EntityIRI

type EntityIRI quad.IRI

EntityIRI is an entity IRI.

func (EntityIRI) BuildIdentifier

func (iri EntityIRI) BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)

BuildIdentifier implements EntityIdentifier

type EntityIdentifier

type EntityIdentifier struct {
	EntityIdentifierI
}

EntityIdentifier is a struct wrapping the interface EntityIdentifierI

func NewEntityIdentifier

func NewEntityIdentifier(v EntityIdentifierI) EntityIdentifier

NewEntityIdentifier constructs a new EntityIdentifer from a EntityIdentiferI

func (*EntityIdentifier) UnmarshalJSON

func (p *EntityIdentifier) UnmarshalJSON(data []byte) error

UnmarshalJSON implements RawMessage

type EntityIdentifierI

type EntityIdentifierI interface {
	BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)
}

EntityIdentifierI is an interface to be used where a single entity identifier is expected.

type EntityIdentifierString

type EntityIdentifierString string

EntityIdentifierString is an entity IRI or BNode strings.

func (EntityIdentifierString) BuildIdentifier

func (i EntityIdentifierString) BuildIdentifier(ns *voc.Namespaces) (quad.Value, error)

BuildIdentifier implements EntityIdentifier

type GraphPattern

type GraphPattern = map[string]interface{}

GraphPattern represents a JSON-LD document

type IteratorStep

type IteratorStep interface {
	Step
	BuildIterator(qs graph.QuadStore, ns *voc.Namespaces) (query.Iterator, error)
}

IteratorStep is a step that can build an Iterator.

type PathStep

type PathStep interface {
	Step
	BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)
}

PathStep is a Step that can build a Path.

type PropertyIRI

type PropertyIRI quad.IRI

PropertyIRI is an IRI of a Property

func (PropertyIRI) BuildPath

func (p PropertyIRI) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)

BuildPath implements PropertyPath

type PropertyIRIString

type PropertyIRIString string

PropertyIRIString is a string of IRI of a Property

func (PropertyIRIString) BuildPath

func (p PropertyIRIString) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)

BuildPath implements PropertyPath

type PropertyIRIStrings

type PropertyIRIStrings []string

PropertyIRIStrings is a slice of property IRI strings.

func (PropertyIRIStrings) BuildPath

func (p PropertyIRIStrings) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)

BuildPath implements PropertyPath.

func (PropertyIRIStrings) PropertyIRIs

func (p PropertyIRIStrings) PropertyIRIs() PropertyIRIs

PropertyIRIs casts PropertyIRIStrings into PropertyIRIs

type PropertyIRIs

type PropertyIRIs []PropertyIRI

PropertyIRIs is a slice of property IRIs.

func (PropertyIRIs) BuildPath

func (p PropertyIRIs) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)

BuildPath implements PropertyPath.

type PropertyPath

type PropertyPath struct {
	PropertyPathI
}

PropertyPath is a struct wrapping PropertyPathI

func NewPropertyPath

func NewPropertyPath(p PropertyPathI) *PropertyPath

NewPropertyPath constructs a new PropertyPath

func (*PropertyPath) Description

func (*PropertyPath) Description() string

Description implements Step.

func (*PropertyPath) UnmarshalJSON

func (p *PropertyPath) UnmarshalJSON(data []byte) error

UnmarshalJSON implements RawMessage

type PropertyPathI

type PropertyPathI interface {
	BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)
}

PropertyPathI is an interface to be used where a path of properties is expected.

type PropertyStep

type PropertyStep struct {
	PathStep
}

PropertyStep is a step that should resolve to a path of properties

func (PropertyStep) BuildPath

func (p PropertyStep) BuildPath(qs graph.QuadStore, ns *voc.Namespaces) (*path.Path, error)

BuildPath implements PropertyPath

type RegistryItem

type RegistryItem interface {
	Description() string
}

RegistryItem in the registry.

func Unmarshal

func Unmarshal(data []byte) (RegistryItem, error)

Unmarshal attempts to unmarshal an Item or returns error.

type Session

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

Session represents a LinkedQL query processing.

func NewSession

func NewSession(qs graph.QuadStore) *Session

NewSession creates a new Session.

func (*Session) Execute

func (s *Session) Execute(ctx context.Context, query string, opt query.Options) (query.Iterator, error)

Execute for a given context, query and options return an iterator of results.

type Step

type Step interface {
	RegistryItem
}

Step is a logical part in the query

type TagsIterator

type TagsIterator struct {
	ValueIt   *ValueIterator
	Selected  []string
	ExcludeID bool
	// contains filtered or unexported fields
}

TagsIterator is a result iterator for records consisting of selected tags or all the tags in the query.

func NewTagsIterator

func NewTagsIterator(valueIt *ValueIterator, selected []string, excludeID bool) TagsIterator

NewTagsIterator creates a new TagsIterator

func (*TagsIterator) Close

func (it *TagsIterator) Close() error

Close implements query.Iterator.

func (*TagsIterator) Err

func (it *TagsIterator) Err() error

Err implements query.Iterator.

func (*TagsIterator) Next

func (it *TagsIterator) Next(ctx context.Context) bool

Next implements query.Iterator.

func (*TagsIterator) Result

func (it *TagsIterator) Result() interface{}

Result implements query.Iterator.

type ValueIterator

type ValueIterator struct {
	Namer refs.Namer
	// contains filtered or unexported fields
}

ValueIterator is an iterator of values from the graph.

func NewValueIterator

func NewValueIterator(p *path.Path, namer refs.Namer) *ValueIterator

NewValueIterator returns a new ValueIterator for a path and namer.

func NewValueIteratorFromPathStep

func NewValueIteratorFromPathStep(step PathStep, qs graph.QuadStore, ns *voc.Namespaces) (*ValueIterator, error)

NewValueIteratorFromPathStep attempts to build a path from PathStep and return a new ValueIterator of it. If BuildPath fails returns error.

func (*ValueIterator) Close

func (it *ValueIterator) Close() error

Close implements query.Iterator.

func (*ValueIterator) Err

func (it *ValueIterator) Err() error

Err implements query.Iterator.

func (*ValueIterator) Next

func (it *ValueIterator) Next(ctx context.Context) bool

Next implements query.Iterator.

func (*ValueIterator) Result

func (it *ValueIterator) Result() interface{}

Result implements query.Iterator.

func (*ValueIterator) Value

func (it *ValueIterator) Value() quad.Value

Value returns the current value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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