model

package module
v0.0.0-...-89bbdfb Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 10 Imported by: 5

Documentation

Overview

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

* Copyright © 2020. TIBCO Software Inc. * This file is subject to the license terms contained * in the license file that is distributed with this file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(key []interface{}) string

func IsSimpleType

func IsSimpleType(val interface{}) bool

func ToString

func ToString(attribute *Attribute) string

Types

type Attribute

type Attribute struct {
	// contains filtered or unexported fields
}

func NewAttribute

func NewAttribute(attributeModel *Attributefinition, value interface{}) *Attribute

func (*Attribute) GetName

func (a *Attribute) GetName() string

func (*Attribute) GetType

func (a *Attribute) GetType() DataType

func (*Attribute) GetValue

func (a *Attribute) GetValue() interface{}

func (*Attribute) SetName

func (a *Attribute) SetName(myName string)

func (*Attribute) SetType

func (a *Attribute) SetType(myType DataType)

func (*Attribute) SetValue

func (a *Attribute) SetValue(myValue interface{}) error

type Attributefinition

type Attributefinition struct {
	// contains filtered or unexported fields
}

func NewAttributeModel

func NewAttributeModel(name string, dataTypeStr string) *Attributefinition

func (*Attributefinition) GetDataType

func (this *Attributefinition) GetDataType() DataType

type BaseEntity

type BaseEntity struct {
	// contains filtered or unexported fields
}

func (*BaseEntity) GetAttribute

func (e *BaseEntity) GetAttribute(name string) *Attribute

func (*BaseEntity) GetAttributes

func (e *BaseEntity) GetAttributes() map[string]*Attribute

func (*BaseEntity) GetKey

func (e *BaseEntity) GetKey() []interface{}

func (*BaseEntity) SetAttribute

func (e *BaseEntity) SetAttribute(name string, attr *Attribute)

func (*BaseEntity) SetKey

func (e *BaseEntity) SetKey(key []interface{})

type DataType

type DataType int
const (
	TypeString DataType = iota
	TypeInteger
	TypeLong
	TypeDouble
	TypeBoolean
	TypeDate
)

func GetDataType

func GetDataType(val interface{}) (DataType, error)

func ToTypeEnum

func ToTypeEnum(typeStr string) (DataType, bool)

func (DataType) String

func (dt DataType) String() string

type Edge

type Edge struct {
	EdgeId
	BaseEntity
	// contains filtered or unexported fields
}

func NewEdge

func NewEdge(myType string, myKey []interface{}, fromNode *Node, toNode *Node) *Edge

func (*Edge) GetFromId

func (this *Edge) GetFromId() *NodeId

func (*Edge) GetToId

func (this *Edge) GetToId() *NodeId

func (*Edge) UpdateFrom

func (this *Edge) UpdateFrom(node Node)

func (*Edge) UpdateTo

func (this *Edge) UpdateTo(node Node)

type EdgeDefinition

type EdgeDefinition struct {
	*EntityDefinition
	// contains filtered or unexported fields
}

func NewEdgeModel

func NewEdgeModel(edgeInfo map[string]interface{}) *EdgeDefinition

type EdgeDirection

type EdgeDirection int
const (
	Nondirectional EdgeDirection = 0
	Directional    EdgeDirection = 1
	Bidirectional  EdgeDirection = 2
)

func ToEdgeDirection

func ToEdgeDirection(direction interface{}) (EdgeDirection, error)

func (EdgeDirection) String

func (this EdgeDirection) String() string

type EdgeId

type EdgeId struct {
	EntityId
	// contains filtered or unexported fields
}

func (*EdgeId) ToString

func (eid *EdgeId) ToString() string

type Entity

type Entity interface {
	SetKey(key []interface{})

	GetKey() []interface{}

	GetAttribute(name string) *Attribute

	SetAttribute(name string, attr *Attribute)

	GetAttributes() map[string]*Attribute
}

type EntityDefinition

type EntityDefinition struct {
	// contains filtered or unexported fields
}

func NewEntityModel

func NewEntityModel(entityInfo map[string]interface{}) *EntityDefinition

func (*EntityDefinition) GetAttributeDefinitions

func (this *EntityDefinition) GetAttributeDefinitions() map[string]*Attributefinition

type EntityId

type EntityId struct {
	// contains filtered or unexported fields
}

func (*EntityId) GetKeyHash

func (this *EntityId) GetKeyHash() string

func (*EntityId) GetType

func (this *EntityId) GetType() string

func (*EntityId) ToStringBuffer

func (this *EntityId) ToStringBuffer() *strings.Builder

type Graph

type Graph interface {
	GetId() string
	GetModelId() string
	GetModel() map[string]interface{}
	GetNodes() map[NodeId]*Node
	GetEdges() map[EdgeId]*Edge
	UpsertGraph(graph map[string]interface{})
	UpsertNode(nodeType string, nodeKey []interface{}) *Node
	UpsertEdge(edgeType string, edgeKey []interface{}, fromNode *Node, toNode *Node) *Edge
	Merge(graph Graph)
	GetNodeByTypeByKey(nodeType string, nodeId NodeId) *Node
	GetNodesByType(nodeType string) map[NodeId]*Node
	GetEntityKeyNamesForNode(entityName string) []string
	GetEntityKeyNamesForEdge(entityName string) []string
	Clear()
}

func ReconstructGraph

func ReconstructGraph(graphData map[string]interface{}) Graph

type GraphBuilder

type GraphBuilder struct {
	// contains filtered or unexported fields
}

func NewGraphBuilder

func NewGraphBuilder() *GraphBuilder

func (*GraphBuilder) BuildEdge

func (builder *GraphBuilder) BuildEdge(
	graph *Graph,
	model *GraphDefinition,
	nodeMap map[string]*Node,
	edgeType string,
	attributesInfo map[string]interface{},
	allowNullKey bool,
)

func (*GraphBuilder) BuildGraph

func (builder *GraphBuilder) BuildGraph(
	graph *Graph,
	model *GraphDefinition,
	iNodes interface{},
	iEdges interface{},
	allowNullKey bool,
) error

func (*GraphBuilder) BuildGraphLegacy

func (builder *GraphBuilder) BuildGraphLegacy(
	graph *Graph,
	model *GraphDefinition,
	nodes interface{},
	edges interface{},
	allowNullKey bool,
)

func (*GraphBuilder) BuildNode

func (builder *GraphBuilder) BuildNode(
	graph *Graph,
	model *GraphDefinition,
	nodeType string,
	attributesInfo map[string]interface{},
	allowNullKey bool,
) *Node

func (*GraphBuilder) CreateGraph

func (builder *GraphBuilder) CreateGraph(graphId string, model *GraphDefinition) Graph

func (*GraphBuilder) CreateUndefinedGraph

func (builder *GraphBuilder) CreateUndefinedGraph(modelId string, graphId string) Graph

func (*GraphBuilder) Export

func (builder *GraphBuilder) Export(g *Graph, graphModel *GraphDefinition) map[string]interface{}

type GraphDefinition

type GraphDefinition struct {
	// contains filtered or unexported fields
}

func NewGraphModel

func NewGraphModel(id string, graphmodel string) (*GraphDefinition, error)

func (*GraphDefinition) Export

func (gd *GraphDefinition) Export() map[string]interface{}

func (*GraphDefinition) GetEdgeDefinition

func (gd *GraphDefinition) GetEdgeDefinition(edgeType string) *EdgeDefinition

func (*GraphDefinition) GetEdgeDefinitions

func (gd *GraphDefinition) GetEdgeDefinitions() map[string]*EdgeDefinition

func (*GraphDefinition) GetId

func (gd *GraphDefinition) GetId() string

func (*GraphDefinition) GetNodeDefinition

func (gd *GraphDefinition) GetNodeDefinition(nodeType string) *NodeDefinition

func (*GraphDefinition) GetNodeDefinitions

func (gd *GraphDefinition) GetNodeDefinitions() map[string]*NodeDefinition

type GraphImpl

type GraphImpl struct {
	// contains filtered or unexported fields
}

func NewGraphImpl

func NewGraphImpl(modelId string, id string) *GraphImpl

func (*GraphImpl) Clear

func (g *GraphImpl) Clear()

func (*GraphImpl) GetEdge

func (g *GraphImpl) GetEdge(id EdgeId) *Edge

func (*GraphImpl) GetEdges

func (g *GraphImpl) GetEdges() map[EdgeId]*Edge

func (*GraphImpl) GetEntityKeyNamesForEdge

func (g *GraphImpl) GetEntityKeyNamesForEdge(edgeType string) []string

func (*GraphImpl) GetEntityKeyNamesForNode

func (g *GraphImpl) GetEntityKeyNamesForNode(nodeType string) []string

func (*GraphImpl) GetId

func (g *GraphImpl) GetId() string

func (*GraphImpl) GetModel

func (g *GraphImpl) GetModel() map[string]interface{}

func (*GraphImpl) GetModelId

func (g *GraphImpl) GetModelId() string

func (*GraphImpl) GetNode

func (g *GraphImpl) GetNode(id NodeId) *Node

func (*GraphImpl) GetNodeByTypeByKey

func (g *GraphImpl) GetNodeByTypeByKey(nodeType string, nodeId NodeId) *Node

func (*GraphImpl) GetNodes

func (g *GraphImpl) GetNodes() map[NodeId]*Node

func (*GraphImpl) GetNodesByType

func (g *GraphImpl) GetNodesByType(nodeType string) map[NodeId]*Node

func (*GraphImpl) Merge

func (g *GraphImpl) Merge(graph Graph)

func (*GraphImpl) SetEdge

func (g *GraphImpl) SetEdge(id EdgeId, edge *Edge)

func (*GraphImpl) SetModel

func (g *GraphImpl) SetModel(model map[string]interface{})

func (*GraphImpl) SetNode

func (g *GraphImpl) SetNode(id NodeId, node *Node)

func (*GraphImpl) UpsertEdge

func (g *GraphImpl) UpsertEdge(edgeType string, edgeKey []interface{}, fromNode *Node, toNode *Node) *Edge

func (*GraphImpl) UpsertEdgeToo

func (g *GraphImpl) UpsertEdgeToo(edge *Edge)

func (*GraphImpl) UpsertGraph

func (g *GraphImpl) UpsertGraph(graph map[string]interface{})

func (*GraphImpl) UpsertNode

func (g *GraphImpl) UpsertNode(nodeType string, nodeKey []interface{}) *Node

func (*GraphImpl) UpsertNodeToo

func (g *GraphImpl) UpsertNodeToo(node *Node)

type GraphManager

type GraphManager struct {
	// contains filtered or unexported fields
}

func GetGraphManager

func GetGraphManager() *GraphManager

func (*GraphManager) GetGraph

func (this *GraphManager) GetGraph(
	graphType GraphType,
	modelId string,
	graphId string,
) ManagableGraph

type GraphType

type GraphType int
const (
	GRAPH  GraphType = 0
	TGRAPH GraphType = 1
)

type ManagableGraph

type ManagableGraph interface {
}

func CreateGraph

func CreateGraph(
	graphType GraphType,
	modelId string,
	graphId string,
) ManagableGraph

type Node

type Node struct {
	NodeId
	BaseEntity
}

func NewNode

func NewNode(myType string, myKey []interface{}) *Node

type NodeDefinition

type NodeDefinition struct {
	*EntityDefinition
}

func NewNodeModel

func NewNodeModel(nodeInfo map[string]interface{}) *NodeDefinition

type NodeId

type NodeId struct {
	EntityId
}

func NewNodeId

func NewNodeId(nodeType string, nodeKey []interface{}) NodeId

func (*NodeId) FromString

func (this *NodeId) FromString(id string) *NodeId

func (*NodeId) ToString

func (this *NodeId) ToString() string

type TraversalEdge

type TraversalEdge struct {
	Edge
	// contains filtered or unexported fields
}

func NewTraversalEdge

func NewTraversalEdge(edge *Edge, fromNode *TraversalNode, toNode *TraversalNode) *TraversalEdge

func (*TraversalEdge) GetAllNodes

func (this *TraversalEdge) GetAllNodes() []*TraversalNode

func (*TraversalEdge) GetFromNode

func (this *TraversalEdge) GetFromNode() *TraversalNode

func (*TraversalEdge) GetToNode

func (this *TraversalEdge) GetToNode() *TraversalNode

func (*TraversalEdge) Update

func (this *TraversalEdge) Update(edge *Edge)

type TraversalGraph

type TraversalGraph struct {
	// contains filtered or unexported fields
}

func NewTraversalGraph

func NewTraversalGraph(modelId string, id string) *TraversalGraph

func (*TraversalGraph) Clear

func (g *TraversalGraph) Clear()

func (*TraversalGraph) GetEdge

func (g *TraversalGraph) GetEdge(id EdgeId) *TraversalEdge

func (*TraversalGraph) GetEdges

func (g *TraversalGraph) GetEdges() map[EdgeId]*TraversalEdge

func (*TraversalGraph) GetEntityKeyNamesForEdge

func (g *TraversalGraph) GetEntityKeyNamesForEdge(edgeType string) []string

func (*TraversalGraph) GetEntityKeyNamesForNode

func (g *TraversalGraph) GetEntityKeyNamesForNode(nodeType string) []string

func (*TraversalGraph) GetId

func (g *TraversalGraph) GetId() string

func (*TraversalGraph) GetModel

func (g *TraversalGraph) GetModel() map[string]interface{}

func (*TraversalGraph) GetModelId

func (g *TraversalGraph) GetModelId() string

func (*TraversalGraph) GetNode

func (g *TraversalGraph) GetNode(id NodeId) *TraversalNode

func (*TraversalGraph) GetNodeByTypeByKey

func (g *TraversalGraph) GetNodeByTypeByKey(nodeType string, nodeId NodeId) *TraversalNode

func (*TraversalGraph) GetNodes

func (g *TraversalGraph) GetNodes() map[NodeId]*TraversalNode

func (*TraversalGraph) GetNodesByType

func (g *TraversalGraph) GetNodesByType(nodeType string) map[NodeId]*TraversalNode

func (*TraversalGraph) SetEdge

func (g *TraversalGraph) SetEdge(id EdgeId, edge *TraversalEdge)

func (*TraversalGraph) SetModel

func (g *TraversalGraph) SetModel(model map[string]interface{})

func (*TraversalGraph) SetNode

func (g *TraversalGraph) SetNode(id NodeId, node *TraversalNode)

func (*TraversalGraph) UpsertEdge

func (g *TraversalGraph) UpsertEdge(edge *Edge, from *Node, to *Node)

func (*TraversalGraph) UpsertGraph

func (g *TraversalGraph) UpsertGraph(graph Graph)

func (*TraversalGraph) UpsertNode

func (g *TraversalGraph) UpsertNode(node *Node) *TraversalNode

type TraversalNode

type TraversalNode struct {
	Node
	// contains filtered or unexported fields
}

func NewTraversalNode

func NewTraversalNode(node *Node) *TraversalNode

func (*TraversalNode) GetAllEdges

func (this *TraversalNode) GetAllEdges() map[string]*TraversalEdge

func (*TraversalNode) GetEdgeByType

func (this *TraversalNode) GetEdgeByType(edgeType string, outbound bool) map[string]*TraversalEdge

func (*TraversalNode) GetEdges

func (this *TraversalNode) GetEdges(outbound bool) map[string]*TraversalEdge

func (*TraversalNode) SetEdge

func (this *TraversalNode) SetEdge(edge *TraversalEdge, outbound bool) bool

func (*TraversalNode) Update

func (this *TraversalNode) Update(node *Node)

Jump to

Keyboard shortcuts

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