allow the library to query the knowledge base

This commit is contained in:
2023-02-22 00:42:40 -03:00
parent e665ff044f
commit d84f2a944c
11 changed files with 228 additions and 24 deletions

View File

@@ -1,6 +1,9 @@
#ifndef OBELISK_INCLUDE_OBELISK_H
#define OBELISK_INCLUDE_OBELISK_H
#include "knowledge_base.h"
#include <memory>
#include <string>
/**
@@ -17,12 +20,15 @@ namespace obelisk
*/
class Obelisk
{
private:
std::unique_ptr<obelisk::KnowledgeBase> kb_;
public:
/**
* @brief Construct a new Obelisk object.
*
*/
Obelisk() = default;
Obelisk(std::string filename);
/**
* @brief Destroy the Obelisk object.
@@ -45,14 +51,14 @@ namespace obelisk
int getLibVersion();
/**
* @brief Query the Obelisk KnowledgeBase to see if the Fact is true
* @brief Query the obelisk KnowledgeBase to see if a Fact is true
* or not.
*
* @param[in] leftEntity The left entity.
* @param[in] p_obelisk The obelisk object pointer.
* @param[in] left_entity The left entity.
* @param[in] verb The verb.
* @param[in] rightEntity The right entity.
* @return double Returns a value between 0 and 1 depending on
* whether it is true or false.
* @param[in] right_entity The right entity.
* @return double Returns whether or not the Fact is true.
*/
double query(const std::string& leftEntity,
const std::string& verb,

View File

@@ -15,9 +15,10 @@ extern "C"
/**
* @brief Create an obelisk object.
*
* @param[in] filename The obelisk KnowledgeBase file to use.
* @return CObelisk* Returns an obelisk object.
*/
extern CObelisk* obelisk_open();
extern CObelisk* obelisk_open(const char* filename);
/**
* @brief Delete an obelisk object.
@@ -35,6 +36,20 @@ extern "C"
*/
extern char* obelisk_get_version(CObelisk* obelisk);
/**
* @brief Query the obelisk KnowledgeBase to see if a Fact is true or false.
*
* @param[in] obelisk The obelisk object.
* @param[in] left_entity The left entity.
* @param[in] verb The verb.
* @param[in] right_entity The right entity.
* @return double Returns whether the Fact is true or false.
*/
extern double obelisk_query(CObelisk* obelisk,
const char* left_entity,
const char* verb,
const char* right_entity);
/**
* @brief Get the obelisk library so version.
*