Documentation
¶
Index ¶
- Constants
- Variables
- func ToRDFDataset(quads []*rdf.Quad) *ld.RDFDataset
- type Config
- type Dictionary
- type DictionaryFactory
- type ID
- type Iterator
- func (iter *Iterator) Close()
- func (iter *Iterator) Collect() ([][]rdf.Term, error)
- func (iter *Iterator) Domain() []rdf.Term
- func (iter *Iterator) Get(node rdf.Term) rdf.Term
- func (iter *Iterator) Graph() []*rdf.Quad
- func (iter *Iterator) Index() []rdf.Term
- func (iter *Iterator) Len() int
- func (iter *Iterator) Less(a, b int) bool
- func (iter *Iterator) Log()
- func (iter *Iterator) Next(node rdf.Term) ([]rdf.Term, error)
- func (iter *Iterator) Prov() ([][]rdf.Term, error)
- func (iter *Iterator) Seek(index []rdf.Term) (err error)
- func (iter *Iterator) String() string
- func (iter *Iterator) Swap(a, b int)
- type Permutation
- type QuadStore
- type Statement
- type Store
- func (s *Store) Close() (err error)
- func (s *Store) Delete(node rdf.Term) (err error)
- func (s *Store) Get(node rdf.Term) ([]*rdf.Quad, error)
- func (s *Store) List(node rdf.Term) interface{ ... }
- func (s *Store) Log()
- func (s *Store) Query(pattern []*rdf.Quad, domain []rdf.Term, index []rdf.Term) (*Iterator, error)
- func (s *Store) QueryJSONLD(query interface{}) (*Iterator, error)
- func (s *Store) Set(node rdf.Term, dataset []*rdf.Quad) (err error)
- func (s *Store) SetJSONLD(uri string, input interface{}, canonize bool) error
- type TagScheme
Constants ¶
const Algorithm = "URDNA2015"
Algorithm has to be URDNA2015
const DatasetPrefix = byte(':')
DatasetPrefix keys store the datasets in the database
const Format = "application/n-quads"
Format has to be application/n-quads
const IDToValuePrefix = byte('<')
IDToValuePrefix keys translate uint64 ids to string IRIs
const SequenceBandwidth = 512
SequenceBandwidth sets the lease block size of the ID counter
const UnaryPrefix = byte('u')
UnaryPrefix keys translate ld.Node values to uint64 ids
const ValueToIDPrefix = byte('>')
ValueToIDPrefix keys translate string IRIs to uint64 ids
Variables ¶
var BinaryPrefixes = [6]byte{'i', 'j', 'k', 'l', 'm', 'n'}
BinaryPrefixes address the binary indices
var ErrEmptyInterset = errors.New("Empty intersection")
ErrEmptyInterset indicates that a constraint set had an empty join
var ErrEndOfSolutions = errors.New("No more solutions")
ErrEndOfSolutions is a generic out-of-reuslts signal
var ErrInvalidDomain = errors.New("Invalid domain")
ErrInvalidDomain means that provided domain included blank nodes that were not in the query
var ErrInvalidIndex = errors.New("Invalid index")
ErrInvalidIndex means that provided index included blank nodes or that it was too long
var ErrInvalidInput = errors.New("Invalid dataset")
ErrInvalidInput indicates that a given dataset was invalid
var ErrInvalidTerm = errors.New("Invalid term")
ErrInvalidTerm indicates that the given term was of an unexpected type
var ErrNotFound = errors.New("Not found")
ErrNotFound indicates that the given node was syntactically valid, but not present in the database.
var ErrParseQuads = errors.New("Error parsing quads from Badger datastore")
ErrParseQuads indicates that a TSV of quads could not be parsed
var ErrTagScheme = errors.New("URI did not validate the tag scheme")
ErrTagScheme indicates that a given URI did not validate the database's tag scheme
var SequenceKey = []byte("#")
SequenceKey to store the id counter
var TernaryPrefixes = [3]byte{'a', 'b', 'c'}
TernaryPrefixes address the ternary indices
Functions ¶
func ToRDFDataset ¶ added in v0.2.0
func ToRDFDataset(quads []*rdf.Quad) *ld.RDFDataset
ToRDFDataset transforms the slice of quads into an *ld.RDFDataset
Types ¶
type Config ¶ added in v0.2.0
type Config struct {
TagScheme TagScheme
Dictionary DictionaryFactory
QuadStore QuadStore
}
Config contains the initialization options passed to Styx
type Dictionary ¶ added in v0.2.0
type Dictionary interface {
GetID(term rdf.Term, origin rdf.Term) (ID, error)
GetTerm(id ID, origin rdf.Term) (rdf.Term, error)
Commit() error
}
A Dictionary is a scheme for serializing terms to and from strings
type DictionaryFactory ¶ added in v0.2.0
type DictionaryFactory interface {
Open(update bool) Dictionary
Close() error
}
A DictionaryFactory instantiates dictionaries
var StringDictionary DictionaryFactory = stringDictionary{}
StringDictionary is a dictionary that that serializes terms to and from their full N-Quads string representation
func MakeIriDictionary ¶ added in v0.3.0
func MakeIriDictionary(tags TagScheme, db *badger.DB) (DictionaryFactory, error)
MakeIriDictionary returns a new dictionary factory that compacts IRIs with base64 IDs
type ID ¶ added in v0.2.0
type ID string
ID is the type of terms of the index tuples
var NIL ID = ""
NIL is empty ID
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
An Iterator exposes Next and Seek operations
func (*Iterator) Collect ¶
Collect calls Next(nil) on the iterator until there are no more solutions, and returns all the results in a slice.
func (*Iterator) Graph ¶
Graph returns a []*rdfjs.Quad representation of the iterator's current value
func (*Iterator) Less ¶
TODO: put more thought into the sorting heuristic. Right now the variables are sorted their norm: in increasing order of their length-normalized sum of the squares of the counts of all their constraints (of any degree).
func (*Iterator) Next ¶
Next advances the iterator to the next result that differs in the given node. If nil is passed, the last node in the domain is used.
type Permutation ¶
type Permutation uint8
Permutation is a permutation of a triple
const ( // SPO is the subject-predicate-object permutation SPO Permutation = iota // POS is the predicate-object-subject permutation POS // OSP is the object-subject-predicate permutation OSP // SOP is the subject-object-predicate permutation SOP // PSO is the predicate-subject-object permutation PSO // OPS is the object-predicate-subject permutation OPS )
type QuadStore ¶ added in v0.2.0
type QuadStore interface {
Set(id ID, quads [][4]ID) error
Get(id ID) ([][4]ID, error)
Delete(id ID) error
List(id ID) interface {
Next() (id ID, valid bool)
Close()
}
}
QuadStore is an interface for things that can persist datasets
func MakeBadgerStore ¶ added in v0.2.0
MakeBadgerStore creates new badger quad store
func MakeEmptyStore ¶ added in v0.3.0
func MakeEmptyStore() QuadStore
MakeEmptyStore returns a quadstore that doesn't store any quads
func MakeMemoryStore ¶ added in v0.2.0
func MakeMemoryStore() QuadStore
MakeMemoryStore returns an in-memory quad store
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
A Statement is a reference to a specific quad in a specific dataset
func (*Statement) Graph ¶
func (statement *Statement) Graph(dictionary Dictionary) rdf.Term
Graph returns the URI for the statement's graph
func (*Statement) URI ¶
func (statement *Statement) URI(dictionary Dictionary) string
URI returns the URI for the statement using path syntax
type Store ¶
A Store is a database instance
func NewMemoryStore ¶ added in v0.3.0
NewMemoryStore opens a styx database in memory
func (*Store) QueryJSONLD ¶
QueryJSONLD exposes a JSON-LD query interface
type TagScheme ¶
A TagScheme is an interface for testing whether a given URI is a dataset URI or not
func NewPrefixTagScheme ¶
NewPrefixTagScheme creates a tag scheme that tests for the given prefix