Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

## What is the goal of this PR?
In some cases, a concludable that is being resolved may have all of its retrievable variables (named and anonymous) fully bound. This means that only a single answer is required to prove the concludable holds, rather than all possible ways. We add short circuiting to prevent exploring further rules in a concludable when a single answer has been found.

## What are the changes implemented in this PR?
* Concludables `RequestState` can record whether a single answer is required
* When producing an answer from a `ConcludableResolver`, we may short circuit and remove all possible downstream answer producers if only 1 answer is required

## ADR: why only short circuit in fully bound concludables
We could short circuit when any of our resolvers end up in a fully bound state. However, it's only useful in concludables:
* A fully bound `Retrievable` will only find exactly 1 answer, so short circuiting would not speed anything up
* `Negation` resolvers only ever look for 1 answer
* all `Conjunction` resolvers will very rarely be fully bound. Even if they are, if retrievables and concludables only return 1 answer when they are fully bound, then the conjunction too will only return 1 answer - so it doesn't add anything here

We could implement this optimisation for disjunctions, however, it is not worth our time at this moment as a fully bound disjunction is uncommon.
5762344

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Mar 4, 2021

README.md

Grabl CircleCI GitHub release Discord Discussion Forum Stack Overflow Stack Overflow

Grakn is a distributed knowledge graph: a logical database to organise large and complex networks of data as one body of knowledge.

Get Started Documentation Discussion
Whether you are new to coding or an experienced developer, it’s easy to learn and use Grakn. Get set up quickly with quickstart tutorial. Documentation for Grakn’s development library and Graql language API, along with tutorials and guides, are available online. Visit our documentation portal. When you’re stuck on a problem, collaborating helps. Ask your question on StackOverflow or discuss it on our Discussion Forum.

Meet Grakn and Graql

Grakn is a distributed knowledge graph: a logical database to organise large and complex networks of data as one body of knowledge. Grakn provides the knowledge engineering tools for developers to easily leverage the power of Knowledge Representation and Automated Reasoning when building complex systems. Ultimately, Grakn serves as the knowledge-base foundation for intelligent systems.

Graql is Grakn's reasoning and analytics query language. It provides an expressive knowledge schema language through an enhanced entity-relationship model, transactional queries that perform deductive reasoning in real-time, and analytical queries* with native distributed Pregel and MapReduce algorithms. Graql provides a strong abstraction over low-level data constructs and complex relationships. (* analytics queries are temporarily unavailable in 2.0.0)

Graql is distributed as an open-source technology, while Grakn comes in two forms: Grakn Core - open-source, and Grakn Cluster - our enterprise distributed knowledge graph.

Knowledge Schema

Grakn provides an enhanced entity-relationship schema to model complex datasets. The schema allows users to model type hierarchies, hyper-entities, hyper-relationships, and rules. The schema can be updated and extended at any time in the database lifecycle. Hyper-entities are entities with multiple instances of a given attribute, and hyper-relationships are nested relationships, cardinality-restricted relationships, or relationships between any number of entities. This enables the creation of complex knowledge models very easily and allows them to evolve flexibly.

Under the hood, Grakn has an expressive knowledge representation system based on hypergraph data structures (that generalises an edge to be a set of vertices - non-binary). Graql is Grakn’s reasoning (through OLTP) and analytics (through OLAP) declarative query language.

Logical Inference

Grakn’s query language performs logical inference through deductive reasoning of entity types and relationships, to infer implicit facts, associations, and conclusions in real-time, during runtime of OLTP queries. The inference is performed through entity and relationship type reasoning, as well as rule-based reasoning. This allows the discovery of facts that would otherwise be too hard to find, the abstraction of complex relationships into its simpler conclusion, as well as translation of higher-level queries into the lower level and more complex data representation.

Distributed Analytics (temporarily unavailable in 2.0.0)

Grakn’s query language performs distributed Pregel and MapReduce (BSP) algorithms abstracted as OLAP queries. These types of queries usually require custom development of distributed algorithms for every use case. However, Grakn creates an abstraction of these distributed algorithms and incorporates them as part of the language API. This enables large scale computation of BSP algorithms through a declarative language without the need of implementing the algorithms.

Higher-Level Language

With the expressivity of the schema, inference through OLTP, and distributed algorithms through OLAP, Grakn provides a strong abstraction over low-level data constructs and complicated relationships through its query language. The language provides a higher-level schema, OLTP, and OLAP query language, which makes working with complex data a lot easier. When developers can achieve more by writing less code, the productivity rate increases by orders of magnitude.

Download and Running Grakn Core

To run Grakn Core (which you can download from the Download Centre or GitHub Releases), you need to have Java 8 (OpenJDK or Oracle Java) installed.

You can visit the Setup Guide to help your installation.

Compiling Grakn Core from Source

Note: You don't need to compile Grakn Core from the source if you just want to use Grakn. See the "Download and Running Grakn Core" section above.

  1. Make sure you have the following dependencies installed on your machine:
    • Java 8 or higher
    • Python 3 and Pip 18.1 or higher
    • Bazel 3.3.1 or higher. We use Bazelisk to manage Bazel versions which runs the build with the Bazel version specified in .bazelversion. In order to install it, follow the platform-specific guide:
      • macOS (Darwin): brew install bazelbuild/tap/bazelisk
      • Linux: wget https://github.com/bazelbuild/bazelisk/releases/download/v1.4.0/bazelisk-linux-amd64 -O /usr/local/bin/bazel
  2. Depending on your Operating System, you can build Grakn with either one of the following commands:
$ bazel build //:assemble-linux-targz

Outputs to: bazel-bin/grakn-core-all-linux.tar.gz

$ bazel build //:assemble-mac-zip

Outputs to: bazel-bin/grakn-core-all-mac.zip

$ bazel build //:assemble-windows-zip

Outputs to: bazel-bin/grakn-core-all-windows.zip

Contributions

Grakn & Graql has been built using various open-source Graph and Distributed Computing frameworks throughout its evolution. Today Grakn & Graql is built using RocksDB, ANTLR, SCIP, Bazel, GRPC, and ZeroMQ, and Caffeine. In the past, Grakn was enabled by various open-source technologies and communities that we are hugely thankful to: Apache Cassandra, Apache Hadoop, Apache Spark, Apache TinkerPop, and JanusGraph. Thank you!

Licensing

This product includes software developed by Grakn Labs Ltd. It's released under the GNU Affero GENERAL PUBLIC LICENSE, Version 3, 29 June 2007. For license information, please see LICENSE. Grakn Labs Ltd also provides a commercial license for Grakn Cluster - get in touch with our team at [email protected].

Copyright (C) 2021 Grakn Labs