ld

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContextNotFound = documentloader.ErrContextNotFound

ErrContextNotFound is returned when JSON-LD context document is not found in the underlying storage.

Functions

This section is empty.

Types

type DocumentLoader

type DocumentLoader = documentloader.DocumentLoader

DocumentLoader is an implementation of ld.DocumentLoader backed by storage.

func NewDocumentLoader

func NewDocumentLoader(ctx provider, opts ...DocumentLoaderOpts) (*DocumentLoader, error)

NewDocumentLoader returns a new DocumentLoader instance.

Embedded contexts (`ldcontext/embed/third_party`) are preloaded into the underlying storage. Additional contexts can be set using WithExtraContexts() option or provided by one or more remote providers. Use multiple WithRemoteProvider() options for setting up more than one remote JSON-LD context provider.

By default, missing contexts are not fetched from the remote URL. Use WithRemoteDocumentLoader() option to specify a custom loader that can resolve context documents from the network.

type DocumentLoaderOpts

type DocumentLoaderOpts = documentloader.Opts

DocumentLoaderOpts configures DocumentLoader during creation.

func WithExtraContexts

func WithExtraContexts(contexts ...ldcontext.Document) DocumentLoaderOpts

WithExtraContexts sets the extra contexts (in addition to embedded) for preloading into the underlying storage.

func WithRemoteDocumentLoader

func WithRemoteDocumentLoader(loader jsonld.DocumentLoader) DocumentLoaderOpts

WithRemoteDocumentLoader specifies loader for fetching JSON-LD context documents from remote URLs. Documents are fetched with this loader only if they are not found in the underlying storage.

func WithRemoteProvider

func WithRemoteProvider(provider RemoteProvider) DocumentLoaderOpts

WithRemoteProvider adds a remote JSON-LD context provider to the list of providers.

type RemoteProvider

type RemoteProvider = documentloader.RemoteProvider

RemoteProvider defines a remote JSON-LD context provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL