Hi Everyone,
I really need your help in order to define the schema (Nodes, edges, properties and attribute) in my javascript codebase using gremlin or neptune client as I am really not getting a concrete idea of how to define since the data would be dynamic.
Please help!
Currently I have defined the nodes as mentioned in below manner but i don't know if it is even correct or not and if it is correct then how to proceed further with relationships and its properties, attribute etc
const gremlin = require('gremlin');
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
async function createNeptuneSchema() {
const ClusterEndpoint = process.env.CLUSTER_ENDPOINT;
const Port = 8182;
const dc = new DriverRemoteConnection(`wss://${ClusterEndpoint}:${Port}/gremlin`, {});
const g = new gremlin.structure.Graph().traversal().withRemote(dc);
// Define vertex labels and properties
await g.addV('Person').property('gender', 'string').property('dob', 'string').next();
await g.addV('Director').property('title', 'string').next();
await g.addV('Shareholder').property('snippet', 'string').next();
await g.addV('Beneficial Owner').property('publishDate', 'string').next();
await g.addV('Owner').property('content', 'string').next();
await g.addV('Link').property('source', 'string').next();
await g.addV('Search Engine Result').property('name', 'string').next();
await g.addV('Adverse a').property('registrationDate', 'string').next();
await g.addV('Website').property('updatedDate', 'string').next();
await g.addV('News').property('lat', 'string').property('lng', 'string').next();
await g.addV('Domain').property('status', 'string').next();
await g.addV('Country').property('line1', 'string').property('line2', 'string').property('town', 'string').property('postcode', 'string').next();
await g.addV('Company').property('offence', 'string').property('enforcementAgency', 'string').property('enforcementType', 'string').next();
await g.addV('Location').property('politicalPosition', 'string').next();
await g.addV('Address').property('designationAct', 'string').property('issuingAuthority', 'string').next();
await g.addV('Fitness Probity').property('otherInfo', 'string').next();
await g.addV('PEP Record').property('type', 'string').property('value', 'string').next();
await g.addV('Sanction').property('countryCode', 'string').property('number', 'string').next();
await g.addV('Search Node').property('platform', 'string').property('username', 'string').next();
await g.addV('Email').property('category', 'string').next();
await g.addV('Phone').property('number', 'string').next();
await g.addV('Alias Name').property('otherInfo', 'string').next();
await g.addV('Social Profile').property('username', 'string').next();
await g.addV('Username').property('platform', 'string').next();
await g.addV('Facebook').property('category', 'string').next();
await g.addV('Twitter').property('category', 'string').next();
await g.addV('Education Institute').property('type', 'string').next();
await g.addV('Risk').property('value', 'string').next();
await g.addV('Extra').next();
await g.addV('Notes').next();
// Define edge label and property
console.log('Schema creation complete.');
dc.close();
}
module.exports = createNeptuneSchema;
Thank you so much for your response Taylor