Documentation ¶
Index ¶
- type Context
- type Continuation
- type Entity
- func (anEntity *Entity) GetBooleanPropertyValues(typeURI string) ([]bool, error)
- func (anEntity *Entity) GetFirstBooleanPropertyValue(typeURI string) (bool, error)
- func (anEntity *Entity) GetFirstFloatPropertyValue(typeURI string) (float64, error)
- func (anEntity *Entity) GetFirstIntPropertyValue(typeURI string) (int, error)
- func (anEntity *Entity) GetFirstReferenceValue(typeURI string) (string, error)
- func (anEntity *Entity) GetFirstStringPropertyValue(typeURI string) (string, error)
- func (anEntity *Entity) GetFloatPropertyValues(typeURI string) ([]float64, error)
- func (anEntity *Entity) GetIntPropertyValues(typeURI string) ([]int, error)
- func (anEntity *Entity) GetReferenceValues(typeURI string) ([]string, error)
- func (anEntity *Entity) GetStringPropertyValues(typeURI string) ([]string, error)
- func (anEntity *Entity) SetID(id string) *Entity
- func (anEntity *Entity) SetProperty(property string, value any) *Entity
- func (anEntity *Entity) SetReference(reference string, value any) *Entity
- type EntityCollection
- func (ec *EntityCollection) AddEntity(entity *Entity) error
- func (ec *EntityCollection) AddEntityFromMap(data map[string]any) error
- func (ec *EntityCollection) ExpandNamespacePrefixes() error
- func (ec *EntityCollection) GetContinuationToken() *Continuation
- func (ec *EntityCollection) GetEntities() []*Entity
- func (ec *EntityCollection) GetNamespaceManager() NamespaceManager
- func (ec *EntityCollection) GetNamespaceMappings() map[string]string
- func (ec *EntityCollection) SetContinuationToken(continuation *Continuation)
- func (ec *EntityCollection) SetOmitContextOnWrite(isOmitted bool)
- func (ec *EntityCollection) WriteEntityGraphJSON(writer io.Writer) error
- func (ec *EntityCollection) WriteJSON_LD(writer io.Writer) error
- type EntityParser
- func (esp *EntityParser) GetIdentityValue(value string) (string, error)
- func (esp *EntityParser) GetNamespaceManager() NamespaceManager
- func (esp *EntityParser) LoadEntityCollection(reader io.Reader) (*EntityCollection, error)
- func (esp *EntityParser) Parse(reader io.Reader, emitEntity func(*Entity) error, ...) error
- func (esp *EntityParser) WithCompressURIs() *EntityParser
- func (esp *EntityParser) WithExpandURIs() *EntityParser
- func (esp *EntityParser) WithLenientNamespaceChecks() *EntityParser
- func (esp *EntityParser) WithNoContext() *EntityParser
- func (esp *EntityParser) WithParsedContextCallback(callback func(context *Context)) *EntityParser
- type JsonLDWriter
- type JsonLdRef
- type NamespaceContext
- func (aContext *NamespaceContext) AsContext() *Context
- func (aContext *NamespaceContext) AssertPrefixedIdentifierFromURI(URI string) (string, error)
- func (aContext *NamespaceContext) DoesExpansionExistForPrefix(prefix string) bool
- func (aContext *NamespaceContext) GetFullURI(value string) (string, error)
- func (aContext *NamespaceContext) GetNamespaceExpansionForPrefix(prefix string) (string, error)
- func (aContext *NamespaceContext) GetNamespaceMappings() map[string]string
- func (aContext *NamespaceContext) GetPrefixForExpansion(expansion string) (string, error)
- func (aContext *NamespaceContext) GetPrefixedIdentifier(value string) (string, error)
- func (aContext *NamespaceContext) IsFullUri(value string) bool
- func (aContext *NamespaceContext) StorePrefixExpansionMapping(prefix string, expansion string)
- type NamespaceManager
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
func NewContext ¶
func NewContext() *Context
type Continuation ¶
func NewContinuation ¶
func NewContinuation() *Continuation
type Entity ¶
type Entity struct { ID string `json:"id,omitempty"` InternalID uint64 `json:"internalId,omitempty"` Recorded uint64 `json:"recorded,omitempty"` IsDeleted bool `json:"deleted,omitempty"` References map[string]any `json:"refs"` Properties map[string]any `json:"props"` }
func (*Entity) GetBooleanPropertyValues ¶
func (*Entity) GetFirstBooleanPropertyValue ¶
func (*Entity) GetFirstFloatPropertyValue ¶
func (*Entity) GetFirstIntPropertyValue ¶
func (*Entity) GetFirstReferenceValue ¶
func (*Entity) GetFirstStringPropertyValue ¶
func (*Entity) GetFloatPropertyValues ¶
func (*Entity) GetIntPropertyValues ¶
func (*Entity) GetReferenceValues ¶
func (*Entity) GetStringPropertyValues ¶
func (*Entity) SetProperty ¶ added in v0.7.1
type EntityCollection ¶
type EntityCollection struct { Entities []*Entity Continuation *Continuation NamespaceManager NamespaceManager OmitContextOnWrite bool }
EntityCollection is a utility structure for collecting together a set of entities, namespace mappings and a continuation token
func NewEntityCollection ¶
func NewEntityCollection(nsManager NamespaceManager) *EntityCollection
func (*EntityCollection) AddEntity ¶
func (ec *EntityCollection) AddEntity(entity *Entity) error
AddEntity adds the given entity to the collection
func (*EntityCollection) AddEntityFromMap ¶ added in v0.7.5
func (ec *EntityCollection) AddEntityFromMap(data map[string]any) error
AddEntityFromMap adds an entity to the collection from a map The map should have the following structure (the keys are case sensitive):
{ "id": "ns0:entity1", "deleted": false, "recorded": 1234567890, "props": { "ns0:property1": "value1" }, "refs": { "ns0:reference1": "ns0:entity2" }
func (*EntityCollection) ExpandNamespacePrefixes ¶ added in v0.7.4
func (ec *EntityCollection) ExpandNamespacePrefixes() error
func (*EntityCollection) GetContinuationToken ¶
func (ec *EntityCollection) GetContinuationToken() *Continuation
func (*EntityCollection) GetEntities ¶
func (ec *EntityCollection) GetEntities() []*Entity
func (*EntityCollection) GetNamespaceManager ¶
func (ec *EntityCollection) GetNamespaceManager() NamespaceManager
func (*EntityCollection) GetNamespaceMappings ¶
func (ec *EntityCollection) GetNamespaceMappings() map[string]string
func (*EntityCollection) SetContinuationToken ¶
func (ec *EntityCollection) SetContinuationToken(continuation *Continuation)
SetContinuationToken sets the continuation token on the EntityCollection
func (*EntityCollection) SetOmitContextOnWrite ¶ added in v0.7.6
func (ec *EntityCollection) SetOmitContextOnWrite(isOmitted bool)
SetOmitContextOnWrite sets the OmitContextOnWrite flag on the EntityCollection such that when writing the collection to Entity Graph JSON the context is omitted
func (*EntityCollection) WriteEntityGraphJSON ¶
func (ec *EntityCollection) WriteEntityGraphJSON(writer io.Writer) error
func (*EntityCollection) WriteJSON_LD ¶
func (ec *EntityCollection) WriteJSON_LD(writer io.Writer) error
type EntityParser ¶
type EntityParser struct {
// contains filtered or unexported fields
}
func NewEntityParser ¶
func NewEntityParser(nsmanager NamespaceManager) *EntityParser
func (*EntityParser) GetIdentityValue ¶
func (esp *EntityParser) GetIdentityValue(value string) (string, error)
func (*EntityParser) GetNamespaceManager ¶
func (esp *EntityParser) GetNamespaceManager() NamespaceManager
func (*EntityParser) LoadEntityCollection ¶
func (esp *EntityParser) LoadEntityCollection(reader io.Reader) (*EntityCollection, error)
func (*EntityParser) Parse ¶
func (esp *EntityParser) Parse(reader io.Reader, emitEntity func(*Entity) error, emitContinuation func(*Continuation)) error
func (*EntityParser) WithCompressURIs ¶
func (esp *EntityParser) WithCompressURIs() *EntityParser
func (*EntityParser) WithExpandURIs ¶
func (esp *EntityParser) WithExpandURIs() *EntityParser
func (*EntityParser) WithLenientNamespaceChecks ¶ added in v0.7.3
func (esp *EntityParser) WithLenientNamespaceChecks() *EntityParser
func (*EntityParser) WithNoContext ¶
func (esp *EntityParser) WithNoContext() *EntityParser
func (*EntityParser) WithParsedContextCallback ¶ added in v0.7.1
func (esp *EntityParser) WithParsedContextCallback(callback func(context *Context)) *EntityParser
type JsonLDWriter ¶
type JsonLDWriter struct { }
func (*JsonLDWriter) Write ¶
func (jsonLDWriter *JsonLDWriter) Write(ec *EntityCollection, writer io.Writer) error
type NamespaceContext ¶
type NamespaceContext struct {
// contains filtered or unexported fields
}
func NewNamespaceContext ¶
func NewNamespaceContext() *NamespaceContext
func (*NamespaceContext) AsContext ¶
func (aContext *NamespaceContext) AsContext() *Context
func (*NamespaceContext) AssertPrefixedIdentifierFromURI ¶ added in v0.7.1
func (aContext *NamespaceContext) AssertPrefixedIdentifierFromURI(URI string) (string, error)
func (*NamespaceContext) DoesExpansionExistForPrefix ¶ added in v0.7.8
func (aContext *NamespaceContext) DoesExpansionExistForPrefix(prefix string) bool
func (*NamespaceContext) GetFullURI ¶
func (aContext *NamespaceContext) GetFullURI(value string) (string, error)
func (*NamespaceContext) GetNamespaceExpansionForPrefix ¶
func (aContext *NamespaceContext) GetNamespaceExpansionForPrefix(prefix string) (string, error)
func (*NamespaceContext) GetNamespaceMappings ¶
func (aContext *NamespaceContext) GetNamespaceMappings() map[string]string
implement get namespace mappings
func (*NamespaceContext) GetPrefixForExpansion ¶
func (aContext *NamespaceContext) GetPrefixForExpansion(expansion string) (string, error)
func (*NamespaceContext) GetPrefixedIdentifier ¶
func (aContext *NamespaceContext) GetPrefixedIdentifier(value string) (string, error)
implement get prefixed identifier
func (*NamespaceContext) IsFullUri ¶
func (aContext *NamespaceContext) IsFullUri(value string) bool
func (*NamespaceContext) StorePrefixExpansionMapping ¶
func (aContext *NamespaceContext) StorePrefixExpansionMapping(prefix string, expansion string)
type NamespaceManager ¶
type NamespaceManager interface { GetNamespaceExpansionForPrefix(prefix string) (string, error) GetPrefixForExpansion(expansion string) (string, error) StorePrefixExpansionMapping(prefix string, expansion string) IsFullUri(value string) bool GetFullURI(value string) (string, error) GetPrefixedIdentifier(value string) (string, error) GetNamespaceMappings() map[string]string AssertPrefixedIdentifierFromURI(URI string) (string, error) AsContext() *Context DoesExpansionExistForPrefix(prefix string) bool }
type Parser ¶
type Parser interface { Parse(data io.Reader, entity func(*Entity) error, continuation func(*Continuation)) error LoadEntityCollection(reader io.Reader) (*EntityCollection, error) GetNamespaceManager() NamespaceManager }
Click to show internal directories.
Click to hide internal directories.