Documentation ¶
Index ¶
- Variables
- func AppendExternalContexts(context interface{}, extraContexts ...string) []interface{}
- type Processor
- func (p *Processor) Compact(input, context map[string]interface{}, opts ...ProcessorOpts) (map[string]interface{}, error)
- func (p *Processor) Frame(view []string, frameDoc map[string]interface{}, opts ...ProcessorOpts) (map[string]interface{}, error)
- func (p *Processor) GetCanonicalDocument(doc map[string]interface{}, opts ...ProcessorOpts) ([]byte, error)
- type ProcessorOpts
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRDFFound = errors.New("invalid JSON-LD context")
ErrInvalidRDFFound is returned when normalized view contains invalid RDF.
Functions ¶
func AppendExternalContexts ¶
func AppendExternalContexts(context interface{}, extraContexts ...string) []interface{}
AppendExternalContexts appends external context(s) to the JSON-LD context which can have one or several contexts already.
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor is JSON-LD processor for aries. processing mode JSON-LD 1.0 {RFC: https://www.w3.org/TR/2014/REC-json-ld-20140116}
func Default ¶
func Default() *Processor
Default returns new JSON-LD processor with default RDF dataset algorithm.
func NewProcessor ¶
NewProcessor returns new JSON-LD processor for aries.
func (*Processor) Compact ¶
func (p *Processor) Compact(input, context map[string]interface{}, opts ...ProcessorOpts) (map[string]interface{}, error)
Compact compacts given json ld object.
func (*Processor) Frame ¶ added in v0.1.5
func (p *Processor) Frame(view []string, frameDoc map[string]interface{}, opts ...ProcessorOpts) (map[string]interface{}, error)
Frame makes a frame from the input view using frameDoc.
func (*Processor) GetCanonicalDocument ¶
func (p *Processor) GetCanonicalDocument(doc map[string]interface{}, opts ...ProcessorOpts) ([]byte, error)
GetCanonicalDocument returns canonized document of given json ld.
type ProcessorOpts ¶
type ProcessorOpts func(opts *processorOpts)
ProcessorOpts are the options for JSON LD operations on docs (like canonicalization or compacting).
func WithDocumentLoader ¶
func WithDocumentLoader(loader ld.DocumentLoader) ProcessorOpts
WithDocumentLoader option is for passing custom JSON-LD document loader.
func WithDocumentLoaderCache ¶ added in v0.1.5
func WithDocumentLoaderCache(cache map[string]interface{}) ProcessorOpts
WithDocumentLoaderCache option is for passing cached contexts to be used by JSON-LD context document loader. Supported value types: map[string]interface{}, string, []byte, io.Reader.
func WithExternalContext ¶
func WithExternalContext(context ...string) ProcessorOpts
WithExternalContext option is for definition of external context when doing JSON-LD operations.
func WithRemoveAllInvalidRDF ¶
func WithRemoveAllInvalidRDF() ProcessorOpts
WithRemoveAllInvalidRDF option for removing all invalid RDF dataset from normalize document.
func WithValidateRDF ¶ added in v0.1.4
func WithValidateRDF() ProcessorOpts
WithValidateRDF option validates result view and fails if any invalid RDF dataset found. This option will take precedence when used in conjunction with 'WithRemoveAllInvalidRDF' option.