# Invana

An open source Graph Analytics and Reasoning Engine.

Any data, that is well modelled and has knowledge about all the relationships and weights with in the entities of the system can give better insights for making **Informed Decision**.

Invana let's you model the data as connected Graph of entities and relationships. You can extract insights from data by applying models like reasoning and graph algorithms. These models help you with learning relationships, predicting patterns and perform advanced analytics on connected data.

{% hint style="info" %}
Invana provides solutions for Graph Powered Analytics And Machine Learning.
{% endhint %}

### Features

* [x] &#x20;Object Mapper - Models, PropertyTypes, and Form validation
* [x] &#x20;Execute gremlin queries
* [x] &#x20;Built in QuerySets for performing standard CRUD operations on graph.
* [x] &#x20;Utilities for logging queries and performance.
* [x] &#x20;Django-ORM like search when using OGM(ex: has\_\_id\_\_within=\[200752, 82032, 4320], has\_\_name\_\_startingWith="Per")( Refer [search-usage.md](https://github.com/invanalabs/invana/blob/master/search-usage.md) for more)
* [x] &#x20;Index support
* [ ] &#x20;Query caching support
* [ ] &#x20;Asynchronous Python API.

### Architecture

![Invana architecture](/files/-MZTKRUIchJv1hYXDDpk)

### How Invana works

1. **Model your system** with the labels of entities and relationships.
2. **Import data** using python SDK or GraphQL API.
3. **Setup Functions** on Entities and Relationships to teach and learn patterns with in the Graph.
4. **Query and Visualise** inferences, reasoning and analytics data as force directed graphs.

Setup your first Knowledge Graph & Graph Powered Analytics Engine  with Invana in just few minutes, get started [here](/getting-started)


# Getting Started

Deploy Invana infrastructure using docker compose

Invana Graph Analytics System can be deployed in your local or cloud using [docker compose](https://docs.docker.com/compose/).

### Features

1.

### Install using Docker

You can use the following templates to setup Invana with supported graph databases as graph processing engine.

{% tabs %}
{% tab title="Using JanusGraph" %}

```
git clone git@github.com:invanalabs/docker-templates.git
cd docker-templates/invana-with-janusgraph
docker-compose up
```

{% endtab %}

{% tab title="Using Neo4j" %}

```
git clone git@github.com:invanalabs/docker-templates.git
cd docker-templates/invana-with-neo4j
docker-compose up
```

{% endtab %}

{% tab title="Using ArcadeDB" %}

```
git clone git@github.com:invanalabs/docker-templates.git
cd docker-templates/invana-with-arcadedb
docker-compose up
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
In theory, you can run any Apache TinkerPop supported graph database as graph processing engine with Invana.
{% endhint %}

| Invana Engine           | http\://\<ip-address>:8200 |
| ----------------------- | -------------------------- |
| Invana Studio           | http\://\<ip-address>:8300 |
| Apache TinkerPop Server | http\://\<ip-address>:8182 |

Docker compose will expose the following services, that lets you visualise and browse through the graph data.

### Graph databases

1. [JanusGraph](https://janusgraph.org)

### Usage&#x20;

* [x] Python API&#x20;
* [ ] GraphQL API&#x20;
* [ ] REST API

Let's start with a story of graph.

{% content-ref url="/pages/-MZSxJ1iiEdG4HIA\_Sdp" %}
[Broken mention](broken://pages/-MZSxJ1iiEdG4HIA_Sdp)
{% endcontent-ref %}


# Introduction

Open source projects that power Invana infrastructure

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Invana Studio</strong></td><td></td><td></td><td><a href="/pages/QEdF6vBdHpwe8yJlhEGb">/pages/QEdF6vBdHpwe8yJlhEGb</a></td><td></td></tr><tr><td><strong>Invana Engine</strong></td><td></td><td></td><td><a href="/pages/MYE2qSlApEo6uS28oSq8">/pages/MYE2qSlApEo6uS28oSq8</a></td><td></td></tr><tr><td><a data-footnote-ref href="#user-content-fn-1"><strong>Python API</strong></a></td><td></td><td></td><td><a href="/pages/-MYs8-xRrI9VAX-_1JIJ">/pages/-MYs8-xRrI9VAX-_1JIJ</a></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

[^1]:


# Python API

Python API for modelling and managing graphs

### Installation

```
pip install invana 
```

### Features

* [x] &#x20;Object Mapper - Models, PropertyTypes, and Form validation
* [x] &#x20;Execute gremlin queries
* [x] &#x20;Built in QuerySets for performing standard CRUD operations on graph.
* [x] &#x20;Utilities for logging queries and performance.
* [x] &#x20;Django-ORM like search when using OGM(ex: has\_\_id\_\_within=\[200752, 82032, 4320], has\_\_name\_\_startingWith="Per")( Refer [search-usage.md](https://github.com/invanalabs/invana/blob/master/search-usage.md) for more)
* [x] &#x20;Index support
* [ ] &#x20;Query caching support
* [ ] &#x20;Asynchronous Python API.

### License

Apache License, Version 2.0


# Modelling using OGM

### Create Vertex Model

```python
from invana.ogm import models, fields


graph = InvanaGraph("ws://megamind-ws:8182/gremlin", traversal_source="g")


class Project(models.VertexModel):
    graph = graph
    properties = {
        'name': fields.StringProperty(max_length=10, trim_whitespaces=True),
        'description': fields.StringProperty(allow_null=True, min_length=10),
        'rating': fields.FloatProperty(allow_null=True),
        'is_active': fields.BooleanProperty(default=True),
        'created_at': fields.DateTimeProperty(default=lambda: datetime.now())
    }
 
```


# Data Types

### StringProperty

```python
// Some code

class Project(VertexModel):
    graph = graph
    properties = {
        'name': StringProperty(min_length=1, max_length=10, trim_whitespaces=True)
    }
```

### **IntegerProperty**

```python
// Some code
from invana.ogm import fields  
class Project(VertexModel):
    graph = graph
    properties = {
        'age': fields.IntegerProperty(min_value=1, max_value=100)
    }
```

### FloatProperty

```python
// Some code
from invana.ogm import fields  
class Project(VertexModel):
    graph = graph
    properties = {
        'rating': fields.FloatProperty(min_value=1, max_value=100)
    }
```

### BooleanProperty

```python
// Some code
from invana.ogm import fields  
class Project(VertexModel):
    graph = graph
    properties = {
        'is_active': fields.BooleanProperty(default=True)
    }
```

### DateTimeProperty

```python
// Some code
from invana.ogm import fields  
class Project(VertexModel):
    graph = graph
    properties = {
        'created_at': fields.DateTimeProperty(default=lambda: datetime.now())
    }
```


# Indexes


# Search


# Schema Management


# Event Triggers


# Invana Engine


# Installation

Invana Engine is served over GraphQL, so it can be used without Invana Studio. For any such use cases, below are the docker-based and standalone installation methods.

Invana Engine connects to the Apache TinkerPop's Gremlin Server's for communicating with the Graph Database. Below is the simple representation of how Invana Engine connects to a Graph Database.

![](/files/-MZJpqSv74FhVEOMJEXV)

### Running using Docker

```
$ docker run -p 8200:8200 -d  -e GREMLIN_SERVER_URL=ws://xx.xx.xx.xx:8182/gremlin --name invana-engine invanalabs/invana-engine 
```

Invana Engine will be available at http\://\<ip-address:8200>. Following Docker environment variables are supported:

* **GREMLIN\_SERVER\_URL**: http or ws gremlin url. ex: ws\://xx.xx.xx.xx:8182/gremlin or <http://xx.xx.xx.xx:8182/gremlin>
* **GREMLIN\_TRAVERSAL\_SOURCE**(optional): defaults: 'g'
* **GREMLIN\_SERVER\_USERNAME**(optional): gremlin username. ex: myusername
* **GREMLIN\_SERVER\_PASSWORD**(optional): gremlin password. ex: mypassword
* **SERVER\_PORT**(optional, available in standalone python mode only): port on which invana engine server is available: defaults to 8200

{% hint style="info" %}
You can explore docker compose templates from [here](https://github.com/invanalabs/invana-engine/tree/develop/docker-templates) to deploy Invana Engine with Analytics Infrastructure with any of Invana supported Graph databases.
{% endhint %}

### Running using Python server (standalone)

```
pip3 install invana-engine

export GREMLIN_SERVER_URL=ws://xx.xx.xx.xx:8182/gremlin
invana-engine-start
```

{% hint style="warning" %}
Running python server via this implementation is not designed for production setup.&#x20;
{% endhint %}


# Invana Studio


# Guides

Learn how to setup Invana and start building knowledge graphs with your apps


