Roboy ScientIO
About
Roboy ScientIO (from Lat. scientia - knowledge and Input/Output) - a Knowledge Graph Engine to organise and query complex data.
Dependencies
To use ScientIO, you will need to have one of it's supported back-ends installed. Currently, the only supported back-end is Neo4j, which may be run in a number of ways (if you don't have a remote instance available). We recommend simply running it through docker - like this:
docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
neo4j:3.0
Installation
Via PIP
The easiest way to install ScientIO is through pip:
pip install scientio
For developers
First, install dependencies:
pip install -r requirements.txt
Then, you may open the repository in any IDE, and mark the
src folder as a sources root.
Basic ScientIO use-cases
Supplying an ontology description
The ontology description is a collection of named entity types, where each type may declare a specific set of properties and relationships like this:
# my_ontology.yml
!OType
entity: Alien # The name of the ontology type
---
!OType
entity: Vulcan # Declare a more specific Alien type
meta: [Alien]
properties: # Allowed properties for every Vulcan
- name
- homeworld
- ear_pointiness
---
!OType
entity: Human # Declare a more specific Alien type
meta: [Alien]
properties: # Allowed properties for every Human
- name
- homeworld
relationships: [captain_of] # Allowed relationships for every Human
Creating some nodes
from scientio.ontology.ontology import Ontology
from scientio.session import Session
from scientio.ontology.node import Node
# Load the ontology from a yaml file
onto = Ontology(path_to_yaml="my_ontology.yml")
# Create a session (with default Neo4j backend)
sess = Session(
ontology=onto,
neo4j_address="bolt://localhost:7687",
neo4j_username="neo4j",
neo4j_password="test")
# Get human/vulcan types from ontology
human_type = onto.get_type("Human")
vulcan_type = onto.get_type("Vulcan")
# Create a transient human named "Kirk"
kirk = Node(metatype=human_type)
kirk.set_name("Kirk")
# Create a transient vulcan named "Spock"
spock = Node(metatype=vulcan_type)
spock.set_name("Spock")
# Persist kirk and spock
sess.create(kirk)
sess.create(spock)
Add a relationship between your nodes
from scientio.ontology.ontology import Ontology
from scientio.session import Session
from scientio.ontology.node import Node
# Load the ontology from a yaml file
onto = Ontology(path_to_yaml="my_ontology.yml")
# Create a session (with default Neo4j backend)
sess = Session(
ontology=onto,
neo4j_address="bolt://localhost:7687",
neo4j_username="neo4j",
neo4j_password="test")
# Get human/vulcan types from ontology
human_type = onto.get_type("Human")
vulcan_type = onto.get_type("Vulcan")
# Create query templates to get the actual kirk/spock
kirk = Node(metatype=human_type)
spock = Node(metatype=vulcan_type)
# Query Kirk and Spock from the database, using
# the query nodes we created previously. We're just
# gonna assume that the first human is Kirk, and the first
# vulcan is Spock.
kirk = sess.retrieve(request=kirk)[0]
spock = sess.retrieve(request=spock)[0]
# Add a relationship between Kirk and Spock
kirk.add_relationships({"captain_of": {spock.get_id()}})
# Make sure that the new relationship is persisted
sess.update(kirk)
Release files for scientio 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scientio-0.9.0.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scientio-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.5 kB
Release files / scientio-0.9.0.tar.gz
| Download URL | scientio-0.9.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbded3d7e452cc5edeff32c59fa546a9c1546acc177224dcea70791045083397
|
|
BLAKE2b-256 checksum How to use checksums |
d9745c7fcb62c20ce72f4484843d238d0ffde8552e3e6bb22f19ade3ccab6c33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
|
Release files / scientio-0.9.0-py3-none-any.whl
| Download URL | scientio-0.9.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3957fb2189a65ac5c221a60f99c060a54398447502b40f0c4c255e512d3b959c
|
|
BLAKE2b-256 checksum How to use checksums |
576be55ce1569ddba3a1246a2f284b0a364369a88f8fab5a384c8c41a2879773
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
|