Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyLayer(ctx *ls.Context, g *lpg.Graph, layer *ls.Layer, reinterpretValues bool) error
- func Reingest(ctx *ls.Context, sourceNode *lpg.Node, target ls.GraphBuilder, ...) error
- type ErrMultipleValues
- type ErrReingest
- type ErrReshape
- type NodeMapping
- type NodeTransformAnnotations
- func (nd NodeTransformAnnotations) GetProperty(key string) (interface{}, bool)
- func (nd NodeTransformAnnotations) SetProperty(key string, value interface{})
- func (nd *NodeTransformAnnotations) UnmarshalJSON(in []byte) error
- func (nd *NodeTransformAnnotations) UnmarshalYAML(parse func(interface{}) error) error
- type Reshaper
- type SourceAnnotations
- type TransformScript
Constants ¶
const TRANSFORM = ls.LS + "transform/"
Variables ¶
var EvaluateTerm = ls.NewTerm(TRANSFORM, "evaluate", false, false, ls.SetComposition, EvaluateTermSemantics)
var EvaluateTermSemantics = evaluateTermSemantics{}
var MapContextSemantics = mapContextSemantics{}
var MapContextTerm = ls.NewTerm(TRANSFORM, "mapContext", false, false, ls.OverrideComposition, 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
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
var ValueExprAllTerm = ls.NewTerm(TRANSFORM, "valueExpr.all", false, false, ls.OverrideComposition, ValueExprTermSemantics)
var ValueExprFirstTerm = ls.NewTerm(TRANSFORM, "valueExpr.first", false, false, ls.OverrideComposition, ValueExprTermSemantics)
var ValueExprTerm = ls.NewTerm(TRANSFORM, "valueExpr", 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
var ValueExprTermSemantics = valueExprTermSemantics{}
Functions ¶
func ApplyLayer ¶
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.
Types ¶
type ErrMultipleValues ¶
type ErrMultipleValues struct{}
func (ErrMultipleValues) Error ¶
func (e ErrMultipleValues) Error() string
type ErrReingest ¶
func (ErrReingest) Error ¶
func (e ErrReingest) Error() string
func (ErrReingest) Unwrap ¶
func (e ErrReingest) Unwrap() error
type ErrReshape ¶
func (ErrReshape) Error ¶
func (e ErrReshape) Error() string
func (ErrReshape) Unwrap ¶
func (e ErrReshape) Unwrap() error
type NodeMapping ¶
type NodeMapping struct {
SourceNodeID string `json:"source" yaml:"source"`
SourceNodeIDs []string `json:"sources" yaml:"sources"`
TargetNodeID string `json:"target" yaml:"target"`
TargetNodeIDs []string `json:"targets" yaml:"targets"`
}
func (NodeMapping) GetSources ¶
func (m NodeMapping) GetSources() []string
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
}
type SourceAnnotations ¶
type SourceAnnotations struct {
}
type TransformScript ¶
type TransformScript struct {
// TargetSchemaNodes are keyed by schema node ID, and contains
// transformation elements for each target schema node
TargetSchemaNodes map[string]NodeTransformAnnotations `json:"reshapeNodes,omitempty" yaml:"reshapeNodes,omitempty"`
// Map specifies source schema nodes that map to one or more target schema nodes
Map []NodeMapping `json:"map,omitempty" yaml:"map,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) GetMappingsByTarget ¶
func (t *TransformScript) GetMappingsByTarget(target string) []*NodeMapping
func (*TransformScript) GetProperties ¶
func (t *TransformScript) GetProperties(schemaNode *lpg.Node) ls.CompilablePropertyContainer