histograph / core

Histograph Core: Graph management and inferencing
MIT License
1 stars 3 forks source link

Histograph-Core

Utility that parses NDJSON objects from Redis' histograph-queue, adds it to Neo4j, indexes the data with Elasticsearch and performs inferencing.

Running Histograph-Core

npm i
node index.js --config [cfg.json]

NOTES

Cleaning up before / after running

Input JSON syntax (through Redis)

JSON PIT object:

    {
        "action": ["add", "delete", "update"],
        "type": "pit",
        "source": String,
        "target": ["graph", "es"],          // Optional, omit to send to both
        "data":
            "id": integer,
            "type": String,
            "name": String,
            "uri": String,                  // Optional
            "startDate": xsd:date,          // Optional
            "endDate": xsd:date,            // Optional
            "geometry": GeoJSON string,     // Optional
            "data": {                       // Optional
                ...additional keys/values
            }
        }
    }

JSON Relation object:

    {
        "action": ["add", "delete"],
        "type": "relation",
        "source": String,
        "data": {
            "from": [integer | String], (internal ID or hgID)
            "to": [integer | String], (internal ID or hgID)
            "label": String
        }
    }

I/O examples through Redis

Add PITs:

rpush "histograph-queue" "{'action': 'add', 'type': 'pit', 'source': 'graafje', 'data': {'id': '123', 'name': 'Rutger', 'type': 'Human' } }"
rpush "histograph-queue" "{'action': 'add', 'type': 'pit', 'source': 'graafje', 'data': {'id': '321', 'name': 'Bert', 'type': 'Human' } }"

Add relations:

rpush "histograph-queue" "{'action': 'add', 'type': 'relation', 'source': 'graafje', 'data': { 'from': 123, 'to': 321, 'label': 'hg:absorbedBy' } }"

Delete PITs:

rpush "histograph-queue" "{'action': 'delete', 'type': 'pit', 'source': 'graafje', 'data': { 'id': '321', 'name': 'Bert', 'type': 'Human' } }"

Delete relations:

rpush "histograph-queue" "{'action': 'delete', 'type': 'relation', 'source': 'graafje', 'data': { 'from': 123, 'to': 321, 'label': 'hg:absorbedBy' } }"

Update PITs:

rpush "histograph-queue" "{'action': 'update', 'type': 'pit', 'source': 'graafje', 'data': { 'id': '321', 'name': 'Frits', 'type': 'Human' } }"

Copyright (C) 2015 Waag Society.