transform

package
v1.0.0-beta21 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TRANSFORM = ls.LS + "transform/"

Variables

View Source
var EvaluateTermSemantics = evaluateTermSemantics{}
View Source
var MapContextSemantics = mapContextSemantics{}

MapContextTerm gives an opencypher expression that results in a node. That node will be used as the context for the map operations under that node

View Source
var MapPropertyTerm = ls.NewTerm(TRANSFORM, "mapProperty", false, false, ls.OverrideComposition, nil)

MapPropertyTerm defines the name of the property in the source graph nodes that contain the mapped schema node id. The contents of the nodes under the mapContext that have prop:schemaNodeId will be assigned to the current node

View Source
var SourceTerm = ls.NewTerm(TRANSFORM, "source", false, false, ls.OverrideComposition, nil)
View Source
var SourcesTerm = ls.NewTerm(TRANSFORM, "sources", false, true, ls.OverrideComposition, nil)
View Source
var ValueExprAllTerm = ls.NewTerm(TRANSFORM, "valueExpr.all", false, false, ls.OverrideComposition, ValueExprTermSemantics)
View Source
var ValueExprFirstTerm = ls.NewTerm(TRANSFORM, "valueExpr.first", false, false, ls.OverrideComposition, ValueExprTermSemantics)

ValueExprTerm defines one or more opencypher expressions that defines the value of the node. The first one that returns nonempty resultset will be evaluated

View Source
var ValueExprTermSemantics = valueExprTermSemantics{}

Functions

func ApplyLayer

func ApplyLayer(ctx *ls.Context, g *lpg.Graph, layer *ls.Layer, reinterpretValues bool) error

ApplyLayer applies the given layer onto the graph.

The annotations of the given layer will be composed with all matching nodes of the graph. If reinterpretValues is set, the operation will get the node value, compose, and set it back, so this can be used for type conversions.

func Reingest

func Reingest(ctx *ls.Context, sourceNode *lpg.Node, target ls.GraphBuilder, variant *ls.Layer) error

Types

type ErrMultipleValues

type ErrMultipleValues struct{}

func (ErrMultipleValues) Error

func (e ErrMultipleValues) Error() string

type ErrReingest

type ErrReingest struct {
	Wrapped      error
	NodeID       string
	SchemaNodeID string
	Msg          string
}

func (ErrReingest) Error

func (e ErrReingest) Error() string

func (ErrReingest) Unwrap

func (e ErrReingest) Unwrap() error

type ErrReshape

type ErrReshape struct {
	Wrapped      error
	SchemaNodeID string
}

func (ErrReshape) Error

func (e ErrReshape) Error() string

func (ErrReshape) Unwrap

func (e ErrReshape) Unwrap() error

type NodeTransformAnnotations

type NodeTransformAnnotations map[string]interface{}

NodeTransformAnnotations contains a term, and one or more annotations

func (NodeTransformAnnotations) GetProperty

func (nd NodeTransformAnnotations) GetProperty(key string) (interface{}, bool)

func (NodeTransformAnnotations) SetProperty

func (nd NodeTransformAnnotations) SetProperty(key string, value interface{})

func (*NodeTransformAnnotations) UnmarshalJSON

func (nd *NodeTransformAnnotations) UnmarshalJSON(in []byte) error

func (*NodeTransformAnnotations) UnmarshalYAML

func (nd *NodeTransformAnnotations) UnmarshalYAML(parse func(interface{}) error) error

type Reshaper

type Reshaper struct {
	TargetSchema *ls.Layer
	Builder      ls.GraphBuilder
	Script       *TransformScript
	// contains filtered or unexported fields
}

func (Reshaper) Reshape

func (reshaper Reshaper) Reshape(ctx *ls.Context, sourceGraph *lpg.Graph, ingester *ls.Ingester) error

type TransformScript

type TransformScript struct {
	// TargetSchemaNodes are keyed by schema node ID, and contains
	// transformation elements for each target schema node
	//
	// The schema node ID can be a suffix of the schema node path,
	// elements separated by space
	TargetSchemaNodes map[string]NodeTransformAnnotations `json:"reshapeNodes,omitempty" yaml:"reshapeNodes,omitempty"`
	// contains filtered or unexported fields
}

TransformScript combines transformation related annotations into a single unit where they can be reached using schema node ids.

func (*TransformScript) Compile

func (t *TransformScript) Compile(ctx *ls.Context) error

func (*TransformScript) GetProperties

func (t *TransformScript) GetProperties(schemaPath []*lpg.Node) ls.CompilablePropertyContainer

func (*TransformScript) GetSources

func (t *TransformScript) GetSources(schemaPath []*lpg.Node) []string

GetSources returns the "source" or "sources" property

func (*TransformScript) Validate

func (t *TransformScript) Validate(targetSchema *ls.Layer) error

Jump to

Keyboard shortcuts

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