Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cgkb

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cgkb - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

src/cgkb.js

64

index.js

@@ -0,63 +1,5 @@

const _ = require('lodash')
const path = require('path')
const kb = require(path.join(__dirname, 'src', 'kb'))
const nlp = require(path.join(__dirname, 'src', 'nlp'))
const nlpServer = require(path.join(__dirname, 'src', 'nlp-server'))
const cgkb = require(path.join(__dirname, 'src', 'cgkb'))
module.exports = {
kb: kb,
nlp: nlp,
nlpServer: nlpServer
}
// -------------------------------------------------------------
// demo
// suggested prop keys
// var prop = {
// label: 'entity type:, PERSON etc. Easy for edge visualization',
// name: 'easy for node visualization',
// type: 'data type',
// // <any key>: as long as you keep track of the schema
// }
// var propA = { name: "Alice", email: "alice@example.com", label: "PERSON" }
// var propB = { name: "Bob", email: "bob@example.com", label: "PERSON" }
// var propAB = { name: "love-love", label: "LOVE" }
// var propBA = { name: "friend-love", label: "LOVE" }
// var graph = [
// [propA, propB, propAB],
// [propB, propA, propBA]
// ]
// var qp = addGraph(graph)
// var qp = getGraph(graph)
// var qp = removeGraph([propA, propB])
// db.cypherAsync(qp)
// .then((res) => {
// console.log(res)
// })
// var label = "PERSON"
// var prop = { name: "Alice", email: "alice@example.com", label: label }
// var setProp = { name: "Alice", email: "bob@example.com", label: "STORY" }
// var timestamp = new Date().toJSON()
// var edgeProp = { name: "Evolution", label: "BECOME" }
// var setEdgeProp = { name: "Devolution", label: "WAS" }
// ohh shit allow for label update too
// var qp = addNode(prop, timestamp)
// var qp = getNode(prop)
// var qp = removeNode(prop)
// var qp = updateNode(prop, setProp, timestamp)
// var qp = addEdge(prop, setProp, edgeProp)
// var qp = getEdge(prop, setProp, edgeProp)
// var qp = updateEdge(prop, setProp, edgeProp, setEdgeProp)
// var qp = removeEdge(prop, setProp, {})
// console.log(qp)
// db.cypherAsync(qp)
// .then((res) => {
// console.log(res)
// })
module.exports = cgkb
{
"name": "cgkb",
"version": "1.0.2",
"version": "1.0.3",
"description": "Contextual Graph Knowledge Base",

@@ -31,2 +31,3 @@ "main": "index.js",

"bluebird": "^3.4.6",
"co": "^4.6.0",
"config": "^1.21.0",

@@ -33,0 +34,0 @@ "lodash": "^4.16.4",

@@ -158,11 +158,11 @@ const _ = require('lodash')

// a good idea to separate them into indep script
function clearDb() {
function clear() {
return db.cypherAsync(`MATCH (u) DETACH DELETE u`)
}
function clearTestDb() {
function clearTest() {
return db.cypherAsync(`MATCH (a) WHERE ANY(x IN labels(a) WHERE x =~ "(?i)^test_.*") DETACH DELETE a`)
}
// clearDb()
// clear()
// .then(console.log)

@@ -184,4 +184,4 @@

removeGraph: removeGraph,
clearDb: clearDb,
clearTestDb: clearTestDb
clear: clear,
clearTest: clearTest
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc