2025-03-27 Graph Use Case/CreateNode: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
= CreateNode Function =
= Overview =
== Overview ==
= Using Case =
== Using Case ==
== CreateNode with identifiers ==
=== CreateNode with identifiers ===
'''Example Param'''
'''Example Param'''
<source lang="json">
<source lang="json">
Line 30: Line 29:
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
{
returnValue: {
  returnValue: {
  queryResult: {
    queryResult: {
    createdNode: {
      returnCreateNode: {
      objType: {
        objType: {
        serviceTag: 'xxxx',
          serviceTag: 'xxxx',
          objectType: 'yyyy'
            objectType: 'yyyy'
      },
        },
      properties: { //properties }
        properties: { //properties }
    },
        },
    existsNode: null,
        existsNode: { },
      userNode: {
        userNode: { // if has userNode send to createNode
      objType: { serviceTag: 'UserAccount', objectType: 'user' },
          objType: { serviceTag: 'UserAccount', objectType: 'user' },
      properties: { userId: 'xxxx' }
          properties: { userId: 'xxxx' }
    }
        }
  },
      }
  objType: { objectType: 'xxxx', serviceTag: 'yyyy' },
    },
  objInstanceFull: {
    requestParams: {
    identifiers: { xxxx: 'yyyy' },
      // return example send param
    fields: { // fields properties }
    }
  },
  },
  relationships: [],
  status: "string", // "complete' or "error"
    settings: { updatePropertiesOnMatch: false }
  errorsFound: [],
}
  graphServiceTag: "GraphHandler"
}
}
</syntaxhighlight>
</syntaxhighlight>


=== CreateNode with versionedData ===
== CreateNode with versionedData ==
'''Example Param'''
'''Example Param'''
<source lang="json">
<source lang="json">
{
{
  "objType": {
  "objType": {
   "serviceTag": "xxxx"
   "serviceTag": "xxxx",
   "objectType": "yyyy",
   "objectType": "yyyy"
  },
  },
  "objInstanceFull": {
  "objInstanceFull": {
Line 72: Line 71:
     "if send any fields of versionedData will be hook properties then return all "
     "if send any fields of versionedData will be hook properties then return all "
  },
  },
  “Relationship”: [],
  "Relationship": [],
  "originTimestamp": 1234567890,
  "originTimestamp": 1234567890,
  "callingFlow": "string"
  "callingFlow": "string"
Line 82: Line 81:
   returnValue: {
   returnValue: {
     queryResult: {
     queryResult: {
       objTypes: [
       returnCreateNode: {
        {
          serviceTag: "xxxx",
          objectType: "yyyy"
        }
      ],
      objInstanceFull: {
        identifiers: {
          //identifiers
        },
        fields: {
        // fields of main node
        }
      },
      existsNode: {},
      userNode: {
         objTypes: [
         objTypes: [
           {
           {
             serviceTag: "UserAccount",
             serviceTag: "xxxx",
             objectType: "user"
             objectType: "yyyy"
           }
           }
         ],
         ],
        properties: {
          objInstanceFull: {
           userId: "xxxx"
           identifiers: {
        }
            //identifiers
      },
          },
      additionalReturn: {},
          fields: {
      relationships: []
            // fields of main node
    },
          }
    objType: {
        },
      objectType: "xxxx",
        existsNode: { },
      serviceTag: "yyyy"
        userNode: {
    },
          objTypes: [
    objInstanceFull: {
            {
      identifiers: {
              serviceTag: "UserAccount",
         // identifiers
              objectType: "user"
      },
            }
      fields: {
          ],
        //fields of main Node and versionedData
            properties: {
            userId: "xxxx"
          }
         },
        relationships: []
       }
       }
     },
     },
     relationships: [],
     requestParams: {
    settings: {
       // return example send param
       updatePropertiesOnMatch: true
     }
     }
   },
   },
Line 134: Line 121:
</syntaxhighlight>
</syntaxhighlight>


=== CreateNode with belongTo ===
== CreateNode with targetNode ==
* Params like create basicNode & versionedData but in objectSchema optional has belongTo If in objectSchema have belongTo will create query and return dataStructure of belongTo
* Must send : x-correlation-base-user-id : xxxx AND x-correlation-target-id : yyyy ( identifiers of  that node)
 
=== CreateNode with extendObjtype ===
* create objectSchema that have objectType for create main node eg. objectType: objectA then upload To S3
* create objectSchemathat have extendObjtype for existParentNode eg. objectType: objectB then upload To S3
* Send parameter with identifiers’s objectType of extendObjtype for create Node
 
=== CreateNode with targetNode ===
'''Example Param'''
'''Example Param'''
<source lang="json">
<source lang="json">
Line 156: Line 134:
     },
     },
     "fields": {
     "fields": {
       // fields
       "//fields"
     }
     }
   },
   },
Line 166: Line 144:
       },
       },
       "relationshipProperties": {
       "relationshipProperties": {
         // optional
         "// optional"
       },
       },
"relationshipDirection": "from"  
      "relationshipDirection": "from"  
       "targetObjType": {
       "targetObjType": {
         "serviceTag": "xxxx",
         "serviceTag": "xxxx",
Line 187: Line 165:
'''Exmaple Output'''
'''Exmaple Output'''
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
{
  returnValue: {
    queryResult: {
      returnCreateNode: {
        objTypes: [
          {
            serviceTag: "xxxx",
            objectType: "yyyy"
          }
        ],
          objInstanceFull: {
          identifiers: {
            //identifiers
          },
          fields: {
            // fields of npde
          }
        },
        existsNode: { },
        userNode: {
          objTypes: [
            {
              serviceTag: "UserAccount",
              objectType: "user"
            }
          ],
            properties: {
            userId: "xxxx"
          }
        },
        relationships: [
          {
            objTypes: [
              { serviceTag: 'string', objectType: 'string' }
            ],
            objInstanceFull: {
              identifiers: {
                // identifiers
              }
            },
            relType: {
              serviceTag: 'string',
              relationshipTag: 'rel'
            },
            relationshipProperties: {
              // properties
            }
          }
        ]
      }
    },
    requestParams: {
      // return example send param
    }
  },
  status: "complete",
    errorsFound: [],
      graphServiceTag: "GraphHandler"
}
</syntaxhighlight>


</syntaxhighlight>
== CreateNode with belongTo ==
* Params like create basicNode & versionedData but in objectSchema optional has belongTo If in objectSchema have belongTo will create query and return dataStructure of belongTo
* Must send : x-correlation-base-user-id : xxxx AND x-correlation-target-id : yyyy ( identifiers of  that node)
 
== CreateNode with extendObjtype ==
* create objectSchema that have objectType for create main node eg. objectType: objectA then upload To S3
* create objectSchemathat have extendObjtype for existParentNode eg. objectType: objectB then upload To S3
* Send parameter with identifiers’s objectType of extendObjtype for create Node
 
== CreateNode with extendObjtype and targetNode ==
* create objectSchema that have objectType for create main node eg. objectType: objectA
* createNode extend with relationship that have relationshipSchema : requiredOnCreate = true to targetNode
 
== CreateNode With systemGenerated ==
* not send userNode or userId when createNode


[[Category:Working documents| 2025-03-27]]
[[Category:Working documents| 2025-03-27]]

Latest revision as of 03:23, 25 September 2025

Overview

Using Case

CreateNode with identifiers

Example Param

{
 "objType":{
    "serviceTag": "xxxx",
    "objectType": "yyyy",
 },
 "objInstanceFull":{
    "identifiers":{
       "xxxx" : "yyyy"
    },
    "fields":{
      // "optional"
      "xxxx" : "yyyy"
    }
 },
"relationships":[],
 "originTimestamp": 1234567890,
 "settings":{
    "updatePropertiesOnMatch": false 
 }
}

Example Output

{
  returnValue: {
    queryResult: {
      returnCreateNode: {
        objType: {
          serviceTag: 'xxxx',
            objectType: 'yyyy'
        },
        properties: { //properties }
        },
        existsNode: { },
        userNode: { // if has userNode send to createNode
          objType: { serviceTag: 'UserAccount', objectType: 'user' },
          properties: { userId: 'xxxx' }
        }
      }
    },
    requestParams: {
      // return example send param
    }
  },
  status: "string", // "complete' or "error"
  errorsFound: [],
  graphServiceTag: "GraphHandler"
}

CreateNode with versionedData

Example Param

{
 "objType": {
   "serviceTag": "xxxx",
   "objectType": "yyyy"
 },
 "objInstanceFull": {
   "identifiers": {
     "xxxx": "yyyy"
   },
   "fields": {
     "can send all fields of versionedData",
     "if send any fields of versionedData will be hook properties then return all "
 },
 "Relationship": [],
 "originTimestamp": 1234567890,
 "callingFlow": "string"
}

Exmaple Output

{
  returnValue: {
    queryResult: {
      returnCreateNode: {
        objTypes: [
          {
            serviceTag: "xxxx",
            objectType: "yyyy"
          }
        ],
          objInstanceFull: {
          identifiers: {
            //identifiers
          },
          fields: {
            // fields of main node
          }
        },
        existsNode: { },
        userNode: {
          objTypes: [
            {
              serviceTag: "UserAccount",
              objectType: "user"
            }
          ],
            properties: {
            userId: "xxxx"
          }
        },
        relationships: []
      }
    },
    requestParams: {
      // return example send param
    }
  },
  status: "complete",
  errorsFound: [],
  graphServiceTag: "GraphHandler"
}

CreateNode with targetNode

Example Param

{
   "objType": {
     "serviceTag": "xxxx",
     "objectType": "yyyy"
   },
   "objInstanceFull": {
     "identifiers": {
       "xxxx": "yyyy"
     },
     "fields": {
       "//fields"
     }
   },
   "relationships": [
     {
       "relType": {
         "serviceTag": "xxxx",
         "relationshipTag": "yyyy"
       },
       "relationshipProperties": {
        "// optional"
       },
      "relationshipDirection": "from" 
       "targetObjType": {
         "serviceTag": "xxxx",
         "objectType": "yyyy"
       },
       "targetIdentifiers": {
         "xxxx": "yyyy"
       }
     }
   ],
   "originTimestamp": 1234567890,
   "settings": {
     "updatePropertiesOnMatch": true
   }
 }

Exmaple Output

{
  returnValue: {
    queryResult: {
      returnCreateNode: {
        objTypes: [
          {
            serviceTag: "xxxx",
            objectType: "yyyy"
          }
        ],
          objInstanceFull: {
          identifiers: {
            //identifiers
          },
          fields: {
            // fields of npde
          }
        },
        existsNode: { },
        userNode: {
          objTypes: [
            {
              serviceTag: "UserAccount",
              objectType: "user"
            }
          ],
            properties: {
            userId: "xxxx"
          }
        },
        relationships: [
          {
            objTypes: [
              { serviceTag: 'string', objectType: 'string' }
            ],
            objInstanceFull: {
              identifiers: {
                // identifiers
              }
            },
            relType: {
              serviceTag: 'string',
              relationshipTag: 'rel'
            },
            relationshipProperties: {
              // properties
            }
          }
        ]
      }
    },
    requestParams: {
      // return example send param
    }
  },
  status: "complete",
    errorsFound: [],
      graphServiceTag: "GraphHandler"
}

CreateNode with belongTo

  • Params like create basicNode & versionedData but in objectSchema optional has belongTo If in objectSchema have belongTo will create query and return dataStructure of belongTo
  • Must send : x-correlation-base-user-id : xxxx AND x-correlation-target-id : yyyy ( identifiers of that node)

CreateNode with extendObjtype

  • create objectSchema that have objectType for create main node eg. objectType: objectA then upload To S3
  • create objectSchemathat have extendObjtype for existParentNode eg. objectType: objectB then upload To S3
  • Send parameter with identifiers’s objectType of extendObjtype for create Node

CreateNode with extendObjtype and targetNode

  • create objectSchema that have objectType for create main node eg. objectType: objectA
  • createNode extend with relationship that have relationshipSchema : requiredOnCreate = true to targetNode

CreateNode With systemGenerated

  • not send userNode or userId when createNode