Documentation
¶
Overview ¶
Package store provides the in-memory triple store with SPO/POS/OSP indices for efficient pattern-based lookups.
Index ¶
- type MemoryStore
- func (m *MemoryStore) Add(t term.Triple, context term.Term)
- func (m *MemoryStore) AddN(quads []term.Quad)
- func (m *MemoryStore) Bind(prefix string, namespace term.URIRef)
- func (m *MemoryStore) ContextAware() bool
- func (m *MemoryStore) Contexts(triple *term.Triple) TermIterator
- func (m *MemoryStore) Len(context term.Term) int
- func (m *MemoryStore) Namespace(prefix string) (term.URIRef, bool)
- func (m *MemoryStore) Namespaces() NamespaceIterator
- func (m *MemoryStore) Prefix(namespace term.URIRef) (string, bool)
- func (m *MemoryStore) Remove(pattern term.TriplePattern, context term.Term)
- func (m *MemoryStore) Set(t term.Triple, context term.Term)
- func (m *MemoryStore) TransactionAware() bool
- func (m *MemoryStore) Triples(pattern term.TriplePattern, context term.Term) TripleIterator
- type NamespaceIterator
- type Store
- type TermIterator
- type TermPairIterator
- type TripleIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is a thread-safe in-memory triple store with 3 indices (SPO, POS, OSP). All methods are safe for concurrent use. Ported from: rdflib.plugins.stores.memory.SimpleMemory
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore creates a new empty in-memory store. Ported from: rdflib.plugins.stores.memory.SimpleMemory.__init__
func (*MemoryStore) Add ¶
func (m *MemoryStore) Add(t term.Triple, context term.Term)
Add inserts a triple into the store. Ported from: rdflib.plugins.stores.memory.SimpleMemory.add
func (*MemoryStore) AddN ¶
func (m *MemoryStore) AddN(quads []term.Quad)
AddN atomically batch-adds quads. Ported from: rdflib.store.Store.addN
func (*MemoryStore) Bind ¶
func (m *MemoryStore) Bind(prefix string, namespace term.URIRef)
Bind associates a prefix with a namespace. Ported from: rdflib.plugins.stores.memory.SimpleMemory.bind
func (*MemoryStore) ContextAware ¶
func (m *MemoryStore) ContextAware() bool
ContextAware reports whether this store supports named graphs.
func (*MemoryStore) Contexts ¶
func (m *MemoryStore) Contexts(triple *term.Triple) TermIterator
Contexts returns an empty iterator (not context-aware).
func (*MemoryStore) Len ¶
func (m *MemoryStore) Len(context term.Term) int
Len returns the number of triples. Ported from: rdflib.plugins.stores.memory.SimpleMemory.__len__
func (*MemoryStore) Namespace ¶
func (m *MemoryStore) Namespace(prefix string) (term.URIRef, bool)
Namespace returns the namespace URI for a prefix. Ported from: rdflib.plugins.stores.memory.SimpleMemory.namespace
func (*MemoryStore) Namespaces ¶
func (m *MemoryStore) Namespaces() NamespaceIterator
Namespaces returns an iterator over all namespace bindings. Ported from: rdflib.plugins.stores.memory.SimpleMemory.namespaces
func (*MemoryStore) Prefix ¶
func (m *MemoryStore) Prefix(namespace term.URIRef) (string, bool)
Prefix returns the prefix for a namespace URI. Ported from: rdflib.plugins.stores.memory.SimpleMemory.prefix
func (*MemoryStore) Remove ¶
func (m *MemoryStore) Remove(pattern term.TriplePattern, context term.Term)
Remove deletes triples matching the pattern. The match and delete are performed under a single write lock to avoid TOCTOU races. Ported from: rdflib.plugins.stores.memory.SimpleMemory.remove
func (*MemoryStore) Set ¶
func (m *MemoryStore) Set(t term.Triple, context term.Term)
Set atomically removes all triples matching (s, p, *) and adds the new triple under a single write lock.
func (*MemoryStore) TransactionAware ¶
func (m *MemoryStore) TransactionAware() bool
TransactionAware reports whether this store supports transactions.
func (*MemoryStore) Triples ¶
func (m *MemoryStore) Triples(pattern term.TriplePattern, context term.Term) TripleIterator
Triples returns matching triples. Ported from: rdflib.plugins.stores.memory.SimpleMemory.triples
type NamespaceIterator ¶
NamespaceIterator yields (prefix, namespace) pairs.
type Store ¶
type Store interface {
// Add inserts a triple into the store, associated with the given context.
Add(triple term.Triple, context term.Term)
// AddN batch-adds quads (triple + context).
AddN(quads []term.Quad)
// Remove deletes triples matching the pattern from the given context.
// If context is nil, removes from all contexts.
Remove(pattern term.TriplePattern, context term.Term)
// Set atomically removes all triples matching (s, p, *) and adds (s, p, o)
// under a single lock, preventing concurrent callers from observing an
// intermediate state where the old value is removed but the new one is not
// yet added.
Set(triple term.Triple, context term.Term)
// Triples returns an iterator over triples matching the pattern in the given context.
Triples(pattern term.TriplePattern, context term.Term) TripleIterator
// Len returns the number of triples in the given context (nil = all).
Len(context term.Term) int
// Contexts returns an iterator over all contexts, optionally filtered by a triple.
Contexts(triple *term.Triple) TermIterator
// Bind associates a prefix with a namespace URI.
Bind(prefix string, namespace term.URIRef)
// Namespace returns the namespace URI for a prefix.
Namespace(prefix string) (term.URIRef, bool)
// Prefix returns the prefix for a namespace URI.
Prefix(namespace term.URIRef) (string, bool)
// Namespaces returns an iterator over all (prefix, namespace) bindings.
Namespaces() NamespaceIterator
// ContextAware reports whether this store supports named graphs.
ContextAware() bool
// TransactionAware reports whether this store supports transactions.
TransactionAware() bool
}
Store is the abstract interface for RDF triple storage backends.
type TermIterator ¶
TermIterator is an iterator over terms, compatible with range-over-func (Go 1.23+).
type TermPairIterator ¶
TermPairIterator is an iterator over (Term, Term) pairs, compatible with range-over-func.