VertexMapper

object VertexMapper: Any

Responsible for marshalling and unmarshalling vertex properties to and from NewNode objects to Map objects.

Methods

mapToVertex

fun mapToVertex(v: Node): NewNodeBuilder

Converts a Node to its respective NewNodeBuilder object.

Parameters

Name Description
v: Node

The Node to deserialize.

ReturnValue

Name Description
NewNodeBuilder

a NewNodeBuilder represented by the information in the givennode.

mapToVertex

fun mapToVertex(v: NewNode): NewNodeBuilder

Converts a NewNode to its respective NewNodeBuilder object.

Parameters

Name Description
v: NewNode

The NewNode to deserialize.

ReturnValue

Name Description
NewNodeBuilder

a NewNodeBuilder represented by the information in the givennode.

mapToVertex

fun mapToVertex(mapToConvert: Map<String, Any>): NewNodeBuilder

Converts a Map containing vertex properties to its respective NewNodeBuilder object.

Parameters

Name Description
mapToConvert: Map<String, Any>

The Map to deserialize.

ReturnValue

Name Description
NewNodeBuilder

a NewNodeBuilder represented by the information in the given map.

checkSchemaConstraints

fun checkSchemaConstraints(fromV: NewNodeBuilder, toV: NewNodeBuilder, edge: String): (fromV: NewNodeBuilder, toV: NewNodeBuilder, edge: String)

Checks if the given edge complies with the CPG schema given the from and two vertices.

Parameters

Name Description
fromV: NewNodeBuilder

The vertex from which the edge connects from.

toV: NewNodeBuilder

The vertex to which the edge connects to.

edge: String

the edge label between the two vertices.

ReturnValue

Name Description
(fromV: NewNodeBuilder, toV: NewNodeBuilder, edge: String)

true if the edge complies with the CPG schema, false if otherwise.

checkSchemaConstraints

fun checkSchemaConstraints(fromLabel: String, toLabel: String, edge: String): Boolean

Checks if the given edge complies with the CPG schema given the from and two vertices.

Parameters

Name Description
fromLabel: String

The vertex label from which the edge connects from.

toLabel: String

The vertex label to which the edge connects to.

edge: String

the edge label between the two vertices.

ReturnValue

Name Description
Boolean

true if the edge complies with the CPG schema, false if otherwise.

extractAttributesFromMap

fun extractAttributesFromMap(propertyMap: MutableMap<String, Any>): MutableMap<String, Any>

Parameters

Name Description
propertyMap: MutableMap<String, Any>

ReturnValue

Name Description
MutableMap<String, Any>