neo4j-knowledge-graph

https://wwlib.github.io/neo4j-knowledge-graph/

https://github.com/wwlib/neo4j-knowledge-graph

https://wwlib.github.io

An example of a simple, queryable knowledge graph implemented using neo4j with a node command line interface implemented in TypeScript.

Note: Based on a python example created by Roberto Pieraccini (http://robertopieraccini.com/home/)

Note: A nice tool for viewing and live-editing neo4j graphs is called Graph Editor and is available at http://wwlib.org/graph-editor/

Docs

https://wwlib.github.io/neo4j-knowledge-graph/neo4j-knowledge-graph-intro.html

Neo4j Setup

Create an empty graph using the Neo4j Desktop app (https://neo4j.com/download-neo4j-now/).

To create the animals graph, copy the contents of docs/animals.cypher into the neo4j browser cypher/query field. (http://localhost:7474/browser/)

Verify the nodes/relationships with this cypher/query: match (n) return n

NLU

neo4j-knowledge-graph can be used with either node-nlp or Microsoft's LUIS NLU.

node-nlp

By default, node-nlp is used to parse utterances (text input) for intents and entites.

LUIS

To use LUIS, create a LUIS app (https://www.luis.ai/) and configure it by importing docs/luis-knowledge-graph.json.

Configuration

Copy data/config-example.json to data/config.json and fill out the fields for Neo4j and LUIS (optional).

{
   "luis": {
        "endpoint": "",
        "appId": "",
        "subscriptionKey": ""
    },
    "neo4j": {
        "url": "bolt://localhost:7687",
        "user": "neo4j",
        "password": ""
    }
}

Installation and Running


yarn
yarn start

Running

yarn start
or
yarn debug

CLI

? Ask a do-you-like question or say "[user] likes [something]".
do you like penguins
do you like bats
do you like mammals

Test Apps

yarn test-luis-controller --help

Usage: yarn test-luis-controller [options]

An application testing LUIS requests

Options:

  -V, --version            output the version number
  -q, --query <query>      The query to test
  -h, --help               output usage information

yarn test-neo4j --help

Usage: yarn test-neo4j [options]

An application for testing neo4j cyphers

Options:

  -V, --version          output the version number
  -c, --cypher <cypher>  Specify the cypher to test
  --d3                   Parse results with D3Helper
  -h, --help             output usage information

yarn test-dialog-manager --help

Usage: yarn test-dialog-manager [options]

An application for testing the DialogManager class

Options:

  -V, --version            output the version number
  -q, --query <query>      The query to test
  -c, --context <context>
  -n, --nlu <nlu>          luis, node-nlp (default)
  -h, --help               output usage information