Skip to main content

Codex - Programmatic Knowledge Graph Framework

What is Codex

Codex is a Python package that provides a simple, yet powerful API designed to make working with the Grakn knowledge graph intuitive.

Why develop Codex

Building, querying, and interrupting results from the Grakn knowledge graph requires expertise in learning the specific query language graql and learning how to use the verbose API. Codex abstracts away the mundane and tedious aspects of using knowledge graphs, so you can focus on organizing your data and getting answers.

Installing Codex

Dependencies

The following are dependencies need to properly run Codex

Installing Codex

Codex is compatible with Python 3.6 or later. The simplest way to install Codex and its dependencies is by...

git clone https://github.com/banjtheman/grakn-codex.git 
cd grakn-codex
pip install grakn-codex

In addition to the python package, Codex leverages Grakn and the Redis docker images to store data.

Quick Start

Here's how you can quickly use Codex

Setup Database

mkdir -p data
mkdir -p redis_data
docker-compose up -d

Load and query

import logging
import pandas as pd
from codex import CodexKg 


#Load csv data
df = pd.read_csv("sample_data/tech_companies.csv")

#Make new codex object
codexkg = CodexKg()

#Create new keyspace
codexkg.create_db("tech_example")

#Load data into Grakn
codexkg.create_entity(df, "Company", entity_key="name")

# Find Company that has a name equal to Google
ans = codexkg.find(
        concept="Company",
        concept_attrs=["name"],
        concept_conds=["equals"],
        concept_values=["Google"],
)

#Display data as a DataFrame
logging.info(ans)

# {'Company':      name  budget
#				0  Google  999.99}

For complete documentation on Codex, tutorials and teaching resources, frequently asked questions, and more, please visit our Wiki.

Codex Workbase

Powered by the Codex API and Streamlit you can use a web based GUI to interact with your data.

To start simply run

streamlit run codex_st.py

You can upload data

You can do queries

You can make rules

Contributing to Codex

Codex is an open source project that is supported by a community who will gratefully and humbly accept any contributions you might make to the project. Large or small, any contribution makes a big difference; and if you've never contributed to an open source project before, we hope you will start with Codex!

If you are interested in contributing, here are some of the many ways to contribute:

  • Submit a bug report or feature request on GitHub Issues.
  • Assist us with user testing.
  • Add to the documentation or help with our website,
  • Write unit or integration tests for our project.
  • Answer questions on our issues, mailing list, Stack Overflow, and elsewhere.
  • Translate our documentation into another language.
  • Write a blog post, tweet, or share our project with others.
  • Teach someone how to use Codex.

As you can see, there are lots of ways to get involved and we would be very happy for you to join us! The only thing we ask is that you abide by the principles of openness, respect, and consideration of others as described in the Python Software Foundation Code of Conduct.

Metadata

Release files for grakn-codex 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grakn-codex 0.0.3
File Size Uploaded Provenance
grakn_codex-0.0.3.tar.gz 25.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for grakn-codex 0.0.3
File Interpreter ABI Platform
grakn_codex-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 53.2 kB

Release files / grakn_codex-0.0.3.tar.gz

Download URL grakn_codex-0.0.3.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
30a7c3ad6b5eeaae5d1756a24a06e963e8b17d373300030c68881466bf561421
BLAKE2b-256 checksum
How to use checksums
064d51e4205e6845b2ff92d4eedcf1bbda050db0785ac5c272725a220e6e8dd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release files / grakn_codex-0.0.3-py3-none-any.whl

Download URL grakn_codex-0.0.3-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41f940a153e149fdbfa35966fcfe3450a5dedc5b34ed1e6d48d0e3f87d6c04c0
BLAKE2b-256 checksum
How to use checksums
bf7194888fee9b33b1f93b102ea95fac9c3d5326d8686492f67348ec679f1606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Security for grakn-codex 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page