singnet / das-query-engine

Query engine and pattern matcher
MIT License
2 stars 2 forks source link

Hyperon DAS

A data manipulation API for Distributed Atomspace (DAS). It allows queries with pattern matching capabilities and traversal of the Atomspace hypergraph.

References and Guides

Installation

Before you start, make sure you have Python >= 3.10 and Pip installed on your system.

You can install and run this project using different methods. Choose the one that suits your needs.

Using-pip

Run the following command to install the project using pip::

pip install hyperon-das

Using-Poetry

If you prefer to manage your Python projects with Poetry, follow these steps:

  1. Install Poetry (if you haven't already):

    pip install poetry
  2. Clone the project repository:

    git clone git@github.com:singnet/das-query-engine.git
    cd das-query-engine
  3. Install project dependencies using Poetry:

    poetry install

    Note: If perhaps you are running over SSH, poetry install might stuck checking the keyring, you can verify this by running poetry install -vvv, then the command will be stuck on the following lines:

    Checking if keyring is available
    [keyring:keyring. backend] Loading KWallet |  
    [keyring:keyring.backend] Loading SecretService |  
    [keyring:keyring. backend] Loading Windows |  
    [keyring: keyring.backend] Loading chainer |  
    [keyring:keyring.backend] Loading libsecret |  
    [keyring:keyring.backend] Loading macOS |  
    Using keyring backend 'SecretService Keyring'

    If that is the case, deactivate keyring and run poetry install again:

    poetry config keyring.enabled false
    poetry install
  4. Activate the virtual environment created by Poetry:

    poetry shell

Now you can run the project within the Poetry virtual environment.

Tests

In the main project directory, you can run the command below to run the unit tests

make unit-tests

Likewise, to run performance tests

make performance-tests

Generating atoms and checking the performance. This test typically takes more than 60 seconds to run with the default settings. Arguments allowed in OPTIONS:

make benchmark-tests OPTIONS="--word_link_percentage=0.01"

or create a MeTTa file using the same options:

make benchmark-tests-metta-file OPTIONS="--word_link_percentage=0.01"

You can do the same to run integration tests

Arguments allowed in OPTIONS:

make integration-tests

or

make integration-tests OPTIONS="--no-destroy"

The integration tests use a remote testing server hosted on Vultr, at the address 45.63.85.59, port 8080. The loaded knowledge base is the animal base, which contains the Nodes and Links listed below:

(: Similarity Type)
(: Concept Type)
(: Inheritance Type)
(: "human" Concept)
(: "monkey" Concept)
(: "chimp" Concept)
(: "snake" Concept)
(: "earthworm" Concept)
(: "rhino" Concept)
(: "triceratops" Concept)
(: "vine" Concept)
(: "ent" Concept)
(: "mammal" Concept)
(: "animal" Concept)
(: "reptile" Concept)
(: "dinosaur" Concept)
(: "plant" Concept)
(Similarity "human" "monkey")
(Similarity "human" "chimp")
(Similarity "chimp" "monkey")
(Similarity "snake" "earthworm")
(Similarity "rhino" "triceratops")
(Similarity "snake" "vine")
(Similarity "human" "ent")
(Inheritance "human" "mammal")
(Inheritance "monkey" "mammal")
(Inheritance "chimp" "mammal")
(Inheritance "mammal" "animal")
(Inheritance "reptile" "animal")
(Inheritance "snake" "reptile")
(Inheritance "dinosaur" "reptile")
(Inheritance "triceratops" "dinosaur")
(Inheritance "earthworm" "animal")
(Inheritance "rhino" "mammal")
(Inheritance "vine" "plant")
(Inheritance "ent" "plant")
(Similarity "monkey" "human")
(Similarity "chimp" "human")
(Similarity "monkey" "chimp")
(Similarity "earthworm" "snake")
(Similarity "triceratops" "rhino")
(Similarity "vine" "snake")
(Similarity "ent" "human")