NPM module - izara-shared: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 33: Line 33:
</syntaxhighlight>
</syntaxhighlight>


= projectGraphSharedLib =
= neptuneGraphSharedLib =


Helper functions for Project Graph.
Helper functions for Neptune graph database.


== projectGraphSharedLib.createVertexId ==
== neptuneGraphSharedLib.createVertexId ==


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
Line 52: Line 52:


# return conatenate vertexTag + "_" + uniqueId
# return conatenate vertexTag + "_" + uniqueId
== neptuneGraphSharedLib.createVertex ==
<syntaxhighlight lang="JavaScript">
/**
* Create a new statement and any properties
* @param {string} vertexId
* @param {string} vertexLabel
* @param {object} [vertexProperties]
*
* @returns {string} vertexId
*/
</syntaxhighlight>
=== logic ===
# ... up to best queries to create this data
# properties will need to consider whether we add or overwrite, if property already exists
== neptuneGraphSharedLib.createRelationshipStatement ==
<syntaxhighlight lang="JavaScript">
/**
* Create a new statement and any properties
* @param {string} subjectId
* @param {string} edgeLabel
* @param {string} edgeId
* @param {string} objectId
* @param {string} [subjectLabel]
* @param {string} [objectLabel]
* @param {object} [subjectProperties]
* @param {object} [edgeProperties]
* @param {object} [objectProperties]
*
*/
</syntaxhighlight>
=== logic ===
# ... up to best queries to create this data
# properties will need to consider whether we add or overwrite, if property already exists
# probably split into sub-functions for creating vertexs, edge, then relationship

Revision as of 05:47, 21 February 2021

Overview

Shared libraries

dynamodbSharedLib

Helper functions for interacting with DynamoDB resources.

dynamodbSharedLib.createStringSet

/**
 * Creates a string set element for use with documentClient
 * @param {string[]} stringSet
 *
 * @returns {string} String formatted as a string set for Dynamo
 */

configSharedLib

Helper functions for Config tables.

configSharedLib.getConfigValue

/**
 * @param {string} configTag
 * @param {string} configKey
 *
 * @returns {Object} returns the configValue for a single config record, or null if none found
 */

neptuneGraphSharedLib

Helper functions for Neptune graph database.

neptuneGraphSharedLib.createVertexId

/**
 * Creates vertexId from vertexTag and unique id
 * @param {string} vertexTag
 * @param {string} uniqueId
 *
 * @returns {string} vertexId
 */

logic

  1. return conatenate vertexTag + "_" + uniqueId

neptuneGraphSharedLib.createVertex

/**
 * Create a new statement and any properties
 * @param {string} vertexId
 * @param {string} vertexLabel
 * @param {object} [vertexProperties]
 *
 * @returns {string} vertexId
 */

logic

  1. ... up to best queries to create this data
  2. properties will need to consider whether we add or overwrite, if property already exists

neptuneGraphSharedLib.createRelationshipStatement

/**
 * Create a new statement and any properties
 * @param {string} subjectId
 * @param {string} edgeLabel
 * @param {string} edgeId
 * @param {string} objectId
 * @param {string} [subjectLabel]
 * @param {string} [objectLabel]
 * @param {object} [subjectProperties]
 * @param {object} [edgeProperties]
 * @param {object} [objectProperties]
 *
 */

logic

  1. ... up to best queries to create this data
  2. properties will need to consider whether we add or overwrite, if property already exists
  3. probably split into sub-functions for creating vertexs, edge, then relationship