2025-01-23 - Standard Object and Relationship Data Structures
Overview
Standard structure and definition of object.
Definition
objType
{
serviceTag: "xxx",
objectType: "yyy"
}
use to identify which serviceTag that object schema located
- serviceTag: service tag that stored object schema
- objectType: name of object schema
objTypeConcat
<serviceTag>_<objectType>
- objTypeConcat: "serviceTag" + "_" + "objectType"
- now use as the name of node label in graph database
objTypeId
- hash of objType object
relType
{
serviceTag: "xxx",
relationshipTag: "yyy"
}
use to identify which serviceTag that relationship schema located
- serviceTag: service tag that stored object schema
- relationshipTag: name of relationship schema
relTypeConcat
<serviceTag>_<relationshipTag>
- relTypeConcat: "serviceTag" + "_" + "relationshipTag"
- now use as the name of relationshipType in graph database
relTypeId
- hash of relType object
relTypeAndDirection
{
relType: {
serviceTag: "xxx",
relationshipTag: "yyy"
},
relationshipDirection: "to", // "from" || "to"
relationshipProperties: {}
}
linkType
{
firstObjType: {
serviceTag: "xx",
objectType: "yy",
},
secondObjType: {
serviceTag: "xxx",
objectType: "yyy"
},
relType: {
serviceTag: "xxxx",
relationshipTag: "yyyy"
},
relationshipDirection: "to" // "from" || "to"
}
use to identify relationship between 2 objectSchema
linkTypeId
create hash id from linkType
pathLinkType
{
objType: {
serviceTag: "xxx",
objectType: "yyy"
},
relType: {
serviceTag: "xxxx",
relationshipTag: "yyyy"
},
relationshipDirection: "to" // "from" || "to"
}
- pathLinkType is used at each step of traversal/path
- when joined with the previous objType/baseObjType can be used to create linkType (and request linkConfig)
flowType
{
serviceTag: "xxx",
flowTag: "yyy"
}
use to identify which serviceTag that flow schema is located
identifiers
An object that has fieldName’s identifiers inside
example identifiers
- example identifiers inside objectSchema
identifiers:[
{
type: "partitionKey",
fieldNames: ["xx","yy"],
name: "zz"
}
]
- example identifiers object
{
xx:"xx value",
yy:"yy value"
}
The example above identifiers is the value of fieldNames that part of identifiers
identifiersBase
concatenated identifiers object
example identifiersBase
- example identifiers inside objectSchema
identifiers:[
{
type: "partitionKey",
fieldNames: ["xx","yy"],
name: "zz"
}
]
- example identifiersBase object
{
zz:"xxValue_yyValue",
}
The example above identifiersBase is the value of each identifier of objectSchema
identifiersId
hash of identifiers object
identifiersConcat
string that concatenate all identifiers
- Note!: Will ordered concatenate value by objectSchema.identifiers array
objInstanceBase
result from dynamoDB that contains relevant and not relevant data of objectSchema
- identifiers from in objInstanceBase will concatenated or not concatenated depending on objectSchema
- izContext field not relevant with objectSchema but it contains inside objInstanceBase
objInstance
similar objInstanceBase but split concatenateIdentifier to each fieldName
objInstanceFull
object that separated fields and identifiers and identifiers cannot concatenated
{
identifiers:{
//... identifiers fieldName of objectSchema
},
fields:{
//.. data of objectSchema
}
}
- identifiers: contains identifiers data
- fields: another data except
example data
example objectSchema
// example objectSchema
{
fieldNames:{
id:{
type:”string”,
// … another fieldName settings
},
createTime: {}, // filedName settings
location: {}, // filedName settings
value: {}, // filedName settings
},
identifiers:[
{
type: "partitionKey",
fieldNames: ["id","createTime"], // composite partition keys in DynamoDB
deliminator: "_", // optional, defaults to "_"
name: "createId" // name of field in database
},
{
type: "sortKey",
fieldName: “location”
}
]
}
objInstanceBase
// example objInstanceBase data
{
createId:"id_createTime",
location:"cnx",
value:199,
errorsFound:[],
izContext:{
// ...izContext
},
}
Normally objInstanceBase is the result from dynamoDB and it will include data that is not relevant to objectSchema. In example above errorsFound and izContext not contain in objectSchema.
objInstance
// example objInstance data
{
id:"id",
createTime:"createTime"
location:"cnx",
value:199,
errorsFound:[],
izContext:{
// ...izContext
},
}
objInstance is object that already refactored identifiers but another fields same as objInstanceBase
objInstanceFull
// example objInstanceFull data
{
identifiers:{
id:"id",
createTime:"createTime"
location:"cnx",
},
fields:{
value:199,
}
}
identifiersBase
// example identifiersBase data
{
createId:"id_createTime",
location:"cnx"
}
identifiers
// example identifiers data
{
id: "id",
createTime: "createTime",
location: "cnx"
}