Documentation
¶
Index ¶
- Constants
- Variables
- type Iterator
- func (g *Iterator) Close()
- func (g *Iterator) Collect() [][]ld.Node
- func (g *Iterator) Domain() []*ld.BlankNode
- func (g *Iterator) Get(node *ld.BlankNode) (n ld.Node)
- func (g *Iterator) Graph() []*ld.Quad
- func (g *Iterator) Index() []ld.Node
- func (g *Iterator) Len() int
- func (g *Iterator) Less(a, b int) bool
- func (g *Iterator) Log()
- func (g *Iterator) Next(node *ld.BlankNode) ([]*ld.BlankNode, error)
- func (g *Iterator) Seek(index []Term) (err error)
- func (g *Iterator) String() string
- func (g *Iterator) Swap(a, b int)
- type List
- type Options
- type Permutation
- type Statement
- type Store
- func (s *Store) Close() (err error)
- func (db *Store) Delete(uri string) (err error)
- func (db *Store) Get(uri string) ([]*ld.Quad, error)
- func (db *Store) List(uri string) List
- func (s *Store) Log()
- func (s *Store) Query(pattern []*ld.Quad, domain []*ld.BlankNode, index []ld.Node) (*Iterator, error)
- func (s *Store) QueryJSONLD(query interface{}) (*Iterator, error)
- func (db *Store) Set(uri string, dataset []*ld.Quad) (err error)
- func (db *Store) SetDataset(uri string, dataset *ld.RDFDataset, canonize bool) error
- func (db *Store) SetJSONLD(uri string, input interface{}, canonize bool) error
- type TagScheme
- type Term
- type V
- type Value
Constants ¶
const Algorithm = "URDNA2015"
Algorithm has to be URDNA2015
const DatasetPrefix = byte('/')
DatasetPrefix keys track the Multihashes of the documents 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 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 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 ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
An Iterator exposes Next and Seek operations
func MakeConstraintGraph ¶
func MakeConstraintGraph( pattern []*ld.Quad, domain []*ld.BlankNode, index []ld.Node, tag TagScheme, txn *badger.Txn, ) (iterator *Iterator, err error)
MakeConstraintGraph populates, scores, sorts, and connects a new constraint graph
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) 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 Statement ¶
A Statement is a reference to a specific quad in a specific dataset
type Store ¶
A Store is a database instance
func (*Store) Query ¶
func (s *Store) Query(pattern []*ld.Quad, domain []*ld.BlankNode, index []ld.Node) (*Iterator, error)
Query satisfies the Styx interface
func (*Store) QueryJSONLD ¶
QueryJSONLD exposes a JSON-LD query interface
func (*Store) SetDataset ¶
SetDataset sets a piprate/json-gold dataset struct
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
type V ¶
type V struct {
Term
// contains filtered or unexported fields
}
V is a struct that caches a variable's total state
type Value ¶
type Value interface {
Term() Term
Node(origin iri, values valueCache, txn *badger.Txn) ld.Node
// We don't actually use JSON or NQuads but they might be nice to have in the future
JSON(origin iri, values valueCache, txn *badger.Txn) interface{}
NQuads(origin iri, values valueCache, txn *badger.Txn) string
}
A Value is an RDF term