Documentation ¶
Overview ¶
Package sparkl provides facilities to generate an Index for a WissKI
Package sparkl implements a very primitive graph index
Index ¶
- func Export(pb *pathbuilder.Pathbuilder, index *Index, engine storages.BundleEngine, ...) error
- func LoadPathbuilder(pb *pathbuilder.Pathbuilder, index *Index, engine storages.BundleEngine) (map[string][]Entity, error)
- func ParsePredicateString(target *[]URI, value string)
- type BundleEngine
- type BundleStorage
- type Cache
- func (c Cache) Aliases(uri URI) []URI
- func (c Cache) Bundle(uri URI) (string, bool)
- func (cache Cache) BundleNames() []string
- func (c Cache) Canonical(uri URI) URI
- func (cache *Cache) DecodeFrom(decoder *gob.Decoder) error
- func (cache *Cache) EncodeTo(encoder *gob.Encoder) error
- func (cache Cache) Entities(bundle_machine string) []Entity
- func (c Cache) Entity(uri URI, bundle string) (*Entity, bool)
- func (c Cache) FirstBundle(uris ...URI) (uri URI, bundle string, ok bool)
- type Context
- type DiskEngine
- type Engine
- type Entity
- type Index
- type MemoryEngine
- type Path
- type Paths
- type Predicates
- type QuadSource
- type Source
- type Token
- type Triple
- type URI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Export ¶
func Export(pb *pathbuilder.Pathbuilder, index *Index, engine storages.BundleEngine, exporter exporter.Exporter) error
Export loads all top-level paths from the given path-builder from the index into the given engine. Afterwards it is exported into the given exporter.
func LoadPathbuilder ¶
func LoadPathbuilder(pb *pathbuilder.Pathbuilder, index *Index, engine storages.BundleEngine) (map[string][]Entity, error)
LoadPathbuilder loads all paths in the given pathbuilder
func ParsePredicateString ¶
ParsePredicateString parses a value of comma-seperate value into a list of URIs
Types ¶
type BundleEngine ¶
type BundleEngine = storages.BundleEngine
type BundleStorage ¶
type BundleStorage = storages.BundleStorage
func StoreBundle ¶
func StoreBundle(bundle *pathbuilder.Bundle, index *Index, engine BundleEngine) (BundleStorage, func() error, error)
StoreBundle loads all entities from the given bundle into a new storage, which is then returned.
Storages for any child bundles, and the bundle itself, are created using the makeStorage function. The storage for this bundle is returned.
func StoreBundles ¶
func StoreBundles(bundles []*pathbuilder.Bundle, index *Index, engine BundleEngine) ([]BundleStorage, func() error, error)
StoreBundles is like StoreBundle, but takes multiple bundles
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents an easily accessible cache of WissKIObjects. It is held entirely in memory.
func (Cache) BundleNames ¶
type Context ¶
type Context struct { Index *Index Engine BundleEngine // contains filtered or unexported fields }
Context represents a context to extract bundle data from index into storages.
A Context must be opened, and eventually waited on. See [Open] and [Close].
func (*Context) Open ¶
func (context *Context) Open()
Open opens this context, and signals that multiple calls to Store() may follow.
Multiple calls to Open are invalid.
func (*Context) Store ¶
func (context *Context) Store(bundle *pathbuilder.Bundle) BundleStorage
Store creates a new Storage for the given bundle and schedules entities to be loaded. May only be called between calls [Open] and [Wait].
Any error that occurs is returned only by Wait.
type DiskEngine ¶
type DiskEngine = igraph.DiskEngine[URI, any]
type Index ¶
type MemoryEngine ¶
type MemoryEngine = igraph.MemoryEngine[URI, any]
type Predicates ¶
Predicates represent special predicates
type QuadSource ¶
type QuadSource struct { Reader io.ReadSeeker // contains filtered or unexported fields }
QuadSource reads triples from a quad file
func (*QuadSource) Close ¶
func (qs *QuadSource) Close() error
func (*QuadSource) Next ¶
func (qs *QuadSource) Next() Token
Next reads the next token from the QuadSource
func (*QuadSource) Open ¶
func (qs *QuadSource) Open() error
type Source ¶
type Source interface { // Open opens this data source. // // It is valid to call open more than once after Next() returns a token with err = io.EOF. // In this case the second call to open should reset the data source. Open() error // Close closes this source. // Close may only be called once a token with err != io.EOF is called. Close() error // Next scans the next token Next() Token }
Source represents a source of triples
type Token ¶
Token represents a token read from a triplestore file.
It can represent one of three states:
1. an error token 1. a (subject, predicate, object) token 2. a (subject, predicate, datum) token
In the case of 1, Error != nil. In the case of 2, Error == nil && HasDatum = False In the case of 3, Error == nil && HasDatum = True