integrate obelisk into alai
This commit is contained in:
128
obelisk/include/models/action.h
Normal file
128
obelisk/include/models/action.h
Normal file
@@ -0,0 +1,128 @@
|
||||
#ifndef OBELISK_MODELS_ACTION_H
|
||||
#define OBELISK_MODELS_ACTION_H
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The Action model represents an action to take when a fact is true
|
||||
* or false.
|
||||
*
|
||||
*/
|
||||
class Action
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the Action in the KnowledgeBase.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The name of the Action.
|
||||
*
|
||||
*/
|
||||
std::string name_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Action object.
|
||||
*
|
||||
*/
|
||||
Action() :
|
||||
id_(0),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Action object.
|
||||
*
|
||||
* @param[in] id The ID of the Action.
|
||||
*/
|
||||
Action(int id) :
|
||||
id_(id),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Action object.
|
||||
*
|
||||
* @param[in] name The name of the Action.
|
||||
*/
|
||||
Action(std::string name) :
|
||||
id_(0),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Action object.
|
||||
*
|
||||
* @param[in] id The ID of the Action.
|
||||
* @param[in] name The name of the Action.
|
||||
*/
|
||||
Action(int id, std::string name) :
|
||||
id_(id),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the Action table in the KnowledgeBase.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the Action.
|
||||
*
|
||||
* @return int& Returns the ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the Action.
|
||||
*
|
||||
* @param[in] id Set the ID of the Action.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the Action.
|
||||
*
|
||||
* @return std::string& The Action name.
|
||||
*/
|
||||
std::string& getName();
|
||||
|
||||
/**
|
||||
* @brief Set the name of the Action.
|
||||
*
|
||||
* @param[in] name The name of the Action.
|
||||
*/
|
||||
void setName(std::string name);
|
||||
|
||||
/**
|
||||
* @brief Select an Action from the datbase based on the object
|
||||
* name.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectByName(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert an Action into the KnowledgeBase based on the
|
||||
* object's fields.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
128
obelisk/include/models/entity.h
Normal file
128
obelisk/include/models/entity.h
Normal file
@@ -0,0 +1,128 @@
|
||||
#ifndef OBELISK_MODELS_ENTITY_H
|
||||
#define OBELISK_MODELS_ENTITY_H
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The Entity model represents either a left or right side entity,
|
||||
* typically used in facts and rules.
|
||||
*
|
||||
*/
|
||||
class Entity
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the Entity in the KnowledgeBase.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The name of the Entity.
|
||||
*
|
||||
*/
|
||||
std::string name_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Entity object.
|
||||
*
|
||||
*/
|
||||
Entity() :
|
||||
id_(0),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Entity object.
|
||||
*
|
||||
* @param[in] id The ID of the Entity.
|
||||
*/
|
||||
Entity(int id) :
|
||||
id_(id),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Entity object.
|
||||
*
|
||||
* @param[in] name The name of the Entity.
|
||||
*/
|
||||
Entity(std::string name) :
|
||||
id_(0),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Entity object.
|
||||
*
|
||||
* @param[in] id The ID of the Entity.
|
||||
* @param[in] name The name of the Entity.
|
||||
*/
|
||||
Entity(int id, std::string name) :
|
||||
id_(id),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the table in the KnowledgeBase.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the Entity.
|
||||
*
|
||||
* @return int& Returns the ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the Entity.
|
||||
*
|
||||
* @param[in] id The ID of the Entity.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the Entity.
|
||||
*
|
||||
* @return std::string& The name of the Entity.
|
||||
*/
|
||||
std::string& getName();
|
||||
|
||||
/**
|
||||
* @brief Set the name of the Entity.
|
||||
*
|
||||
* @param[in] name The name of the Entity.
|
||||
*/
|
||||
void setName(std::string name);
|
||||
|
||||
/**
|
||||
* @brief Select an Entity from the KnowledgeBase based on the
|
||||
* object's name.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectByName(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert an Entity into the KnowledgeBase based on the
|
||||
* object's fields.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
247
obelisk/include/models/fact.h
Normal file
247
obelisk/include/models/fact.h
Normal file
@@ -0,0 +1,247 @@
|
||||
#ifndef OBELISK_MODELS_FACT_H
|
||||
#define OBELISK_MODELS_FACT_H
|
||||
|
||||
#include "models/action.h"
|
||||
#include "models/entity.h"
|
||||
#include "models/fact.h"
|
||||
#include "models/verb.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The Fact model represents truth in the releationship between two
|
||||
* entities separated by a verb.
|
||||
*
|
||||
*/
|
||||
class Fact
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the Fact in the KnowledgeBase.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The Entity from the left side of the expression.
|
||||
*
|
||||
*/
|
||||
obelisk::Entity leftEntity_;
|
||||
|
||||
/**
|
||||
* @brief The Entity from the right side of the expression.
|
||||
*
|
||||
*/
|
||||
obelisk::Entity rightEntity_;
|
||||
|
||||
/**
|
||||
* @brief The Verb that represents the relationship in the
|
||||
* expression.
|
||||
*
|
||||
*/
|
||||
obelisk::Verb verb_;
|
||||
|
||||
/**
|
||||
* @brief Whether or not the fact is considered true or not.
|
||||
*
|
||||
*/
|
||||
double isTrue_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Fact object.
|
||||
*
|
||||
*/
|
||||
Fact() :
|
||||
id_(0),
|
||||
leftEntity_(),
|
||||
rightEntity_(),
|
||||
verb_(),
|
||||
isTrue_(0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Fact object.
|
||||
*
|
||||
* @param[in] id The ID of the Fact in the KnowledgeBase.
|
||||
*/
|
||||
Fact(int id) :
|
||||
id_(id),
|
||||
leftEntity_(),
|
||||
rightEntity_(),
|
||||
verb_(),
|
||||
isTrue_(0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Fact object.
|
||||
*
|
||||
* @param[in] leftEntity The Entity on the left side of the
|
||||
* expression.
|
||||
* @param[in] rightEntity The Entity on the right side of the
|
||||
* expression.
|
||||
* @param[in] verb The Verb separating the entities.
|
||||
* @param[in] isTrue Whether or not the fact is true.
|
||||
*/
|
||||
Fact(obelisk::Entity leftEntity,
|
||||
obelisk::Entity rightEntity,
|
||||
obelisk::Verb verb,
|
||||
double isTrue = 0) :
|
||||
id_(0),
|
||||
leftEntity_(leftEntity),
|
||||
rightEntity_(rightEntity),
|
||||
verb_(verb),
|
||||
isTrue_(isTrue)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Fact object.
|
||||
*
|
||||
* @param[in] id The ID of the Fact in the KnowledgeBase.
|
||||
* @param[in] leftEntity The Entity on the left side of the
|
||||
* expression.
|
||||
* @param[in] rightEntity The Entity on the right side of the
|
||||
* expression.
|
||||
* @param[in] verb The Verb separating the entities.
|
||||
* @param[in] isTrue Whether or not the fact is true.
|
||||
*/
|
||||
Fact(int id,
|
||||
obelisk::Entity leftEntity,
|
||||
obelisk::Entity rightEntity,
|
||||
obelisk::Verb verb,
|
||||
double isTrue = 0) :
|
||||
id_(id),
|
||||
leftEntity_(leftEntity),
|
||||
rightEntity_(rightEntity),
|
||||
verb_(verb),
|
||||
isTrue_(isTrue)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the Fact table in the KnowledgeBase.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the Fact
|
||||
*
|
||||
* @return int& Returns the ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the Fact.
|
||||
*
|
||||
* @param[in] id Set the ID of the Fact.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the left Entity object.
|
||||
*
|
||||
* @return Entity& The left Entity.
|
||||
*/
|
||||
Entity& getLeftEntity();
|
||||
|
||||
/**
|
||||
* @brief Set the left Entity object.
|
||||
*
|
||||
* @param[in] leftEntity The left Entity to set.
|
||||
*/
|
||||
void setLeftEntity(obelisk::Entity leftEntity);
|
||||
|
||||
/**
|
||||
* @brief Get the right Entity object.
|
||||
*
|
||||
* @return Entity& The right Entity.
|
||||
*/
|
||||
Entity& getRightEntity();
|
||||
|
||||
/**
|
||||
* @brief Set the right Entity object.
|
||||
*
|
||||
* @param[in] rightEntity The right Entity to set.
|
||||
*/
|
||||
void setRightEntity(obelisk::Entity rightEntity);
|
||||
|
||||
/**
|
||||
* @brief Get the Verb object.
|
||||
*
|
||||
* @return Verb& The Verb.
|
||||
*/
|
||||
Verb& getVerb();
|
||||
|
||||
/**
|
||||
* @brief Set the Verb object.
|
||||
*
|
||||
* @param[in] verb The Verb.
|
||||
*/
|
||||
void setVerb(obelisk::Verb verb);
|
||||
|
||||
/**
|
||||
* @brief Gets the isTrue value.
|
||||
*
|
||||
* @return true If the Fact is considered true.
|
||||
* @return false If the Fact is considered false.
|
||||
*/
|
||||
double& getIsTrue();
|
||||
|
||||
/**
|
||||
* @brief Set the Fact as true or false.
|
||||
*
|
||||
* @param[in] isTrue Whether or not the Fact is true.
|
||||
*/
|
||||
void setIsTrue(double isTrue);
|
||||
|
||||
/**
|
||||
* @brief Select the Fact from the KnowledgeBase by IDs of the
|
||||
* sub-objects.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectById(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Select the Fact from the KnowledgeBase by the name's of
|
||||
* the entities and verb.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectByName(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Select an Action from the KnowledgeBase using the provided
|
||||
* Fact.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
* @param[out] action The Action to take based on the provided fact.
|
||||
*/
|
||||
void selectActionByFact(sqlite3* dbConnection,
|
||||
obelisk::Action& action);
|
||||
|
||||
/**
|
||||
* @brief Insert the Fact into the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Update whether or not the fact is true in the
|
||||
* KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection.
|
||||
*/
|
||||
void updateIsTrue(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
163
obelisk/include/models/rule.h
Normal file
163
obelisk/include/models/rule.h
Normal file
@@ -0,0 +1,163 @@
|
||||
#ifndef OBELISK_MODELS_RULE_H
|
||||
#define OBELISK_MODELS_RULE_H
|
||||
|
||||
#include "models/fact.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The Rule model represents a truth relation between 2 Facts.
|
||||
*
|
||||
*/
|
||||
class Rule
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the Rule in the KnowledgeBase.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The Fact that depends on the Fact reason being true.
|
||||
*
|
||||
*/
|
||||
obelisk::Fact fact_;
|
||||
|
||||
/**
|
||||
* @brief The Fact that makes the other Fact true or false.
|
||||
*
|
||||
*/
|
||||
obelisk::Fact reason_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Rule object.
|
||||
*
|
||||
*/
|
||||
Rule() :
|
||||
id_(0),
|
||||
fact_(),
|
||||
reason_()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Rule object.
|
||||
*
|
||||
* @param[in] id The ID of the Rule in the KnowledgeBase.
|
||||
*/
|
||||
Rule(int id) :
|
||||
id_(id),
|
||||
fact_(),
|
||||
reason_()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Rule object.
|
||||
*
|
||||
* @param[in] fact The Fact.
|
||||
* @param[in] reason The reason Fact.
|
||||
*/
|
||||
Rule(obelisk::Fact fact, obelisk::Fact reason) :
|
||||
id_(0),
|
||||
fact_(fact),
|
||||
reason_(reason)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Rule object.
|
||||
*
|
||||
* @param[in] id The ID of the Rule.
|
||||
* @param[in] fact The Fact.
|
||||
* @param[in] reason The reason Fact.
|
||||
*/
|
||||
Rule(int id, obelisk::Fact fact, obelisk::Fact reason) :
|
||||
id_(id),
|
||||
fact_(fact),
|
||||
reason_(reason)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the Rule table in the KnowledgeBase.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the Rule.
|
||||
*
|
||||
* @return int& The ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the Rule.
|
||||
*
|
||||
* @param[in] id The ID.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the Fact object.
|
||||
*
|
||||
* @return obelisk::Fact& The Fact.
|
||||
*/
|
||||
obelisk::Fact& getFact();
|
||||
|
||||
/**
|
||||
* @brief Set the Fact object.
|
||||
*
|
||||
* @param[in] fact The Fact.
|
||||
*/
|
||||
void setFact(obelisk::Fact fact);
|
||||
|
||||
/**
|
||||
* @brief Get the reason Fact object.
|
||||
*
|
||||
* @return obelisk::Fact& The reason Fact.
|
||||
*/
|
||||
obelisk::Fact& getReason();
|
||||
|
||||
/**
|
||||
* @brief Set the reason Fact object.
|
||||
*
|
||||
* @param[in] reason The reason Fact.
|
||||
*/
|
||||
void setReason(obelisk::Fact reason);
|
||||
|
||||
/**
|
||||
* @brief Select the Rule from the KnowledgeBase by IDs of the
|
||||
* sub-objects.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectById(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Get the rules that match the reason.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
* @param[out] rules The rules to fill in from the database.
|
||||
*/
|
||||
static void selectByReason(sqlite3* dbConnection,
|
||||
int reasonId,
|
||||
std::vector<obelisk::Rule>& rules);
|
||||
|
||||
/**
|
||||
* @brief Insert the Rule into the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
185
obelisk/include/models/suggest_action.h
Normal file
185
obelisk/include/models/suggest_action.h
Normal file
@@ -0,0 +1,185 @@
|
||||
#ifndef OBELISK_MODELS_SUGGEST_ACTION_H
|
||||
#define OBELISK_MODELS_SUGGEST_ACTION_H
|
||||
|
||||
#include "models/action.h"
|
||||
#include "models/fact.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The SuggestAction model representas the actions to take depending
|
||||
* on if the Fact is true or false.
|
||||
*
|
||||
*/
|
||||
class SuggestAction
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the SuggestAction.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The Fact to check the truth of.
|
||||
*
|
||||
*/
|
||||
obelisk::Fact fact_;
|
||||
|
||||
/**
|
||||
* @brief The Action to take if the Fact is true.
|
||||
*
|
||||
*/
|
||||
obelisk::Action trueAction_;
|
||||
|
||||
/**
|
||||
* @brief The Action to take if the Fact is false.
|
||||
*
|
||||
*/
|
||||
obelisk::Action falseAction_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new SuggestAction object.
|
||||
*
|
||||
*/
|
||||
SuggestAction() :
|
||||
id_(0),
|
||||
fact_(),
|
||||
trueAction_(),
|
||||
falseAction_()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new SuggestAction object.
|
||||
*
|
||||
* @param[in] id The ID of the SuggestAction in the KnowledgeBase.
|
||||
*/
|
||||
SuggestAction(int id) :
|
||||
id_(id),
|
||||
fact_(),
|
||||
trueAction_(),
|
||||
falseAction_()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new SuggestAction object.
|
||||
*
|
||||
* @param[in] fact The Fact.
|
||||
* @param[in] trueAction The true Action.
|
||||
* @param[in] falseAction The false Action.
|
||||
*/
|
||||
SuggestAction(obelisk::Fact fact,
|
||||
obelisk::Action trueAction,
|
||||
obelisk::Action falseAction) :
|
||||
id_(0),
|
||||
fact_(fact),
|
||||
trueAction_(trueAction),
|
||||
falseAction_(falseAction)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new SuggestAction object.
|
||||
*
|
||||
* @param[in] id The ID of the SuggestAction in the KnowledgeBase.
|
||||
* @param[in] fact The Fact.
|
||||
* @param[in] trueAction The true Action.
|
||||
* @param[in] falseAction The false Action.
|
||||
*/
|
||||
SuggestAction(int id,
|
||||
obelisk::Fact fact,
|
||||
obelisk::Action trueAction,
|
||||
obelisk::Action falseAction) :
|
||||
id_(id),
|
||||
fact_(fact),
|
||||
trueAction_(trueAction),
|
||||
falseAction_(falseAction)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the SuggestAction table in the database.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the SuggestAction.
|
||||
*
|
||||
* @return int& Returns the ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the SuggestAction.
|
||||
*
|
||||
* @param[in] id The new ID.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the Fact object.
|
||||
*
|
||||
* @return obelisk::Fact& Returns the Fact.
|
||||
*/
|
||||
obelisk::Fact& getFact();
|
||||
|
||||
/**
|
||||
* @brief Set the Fact object.
|
||||
*
|
||||
* @param[in] fact The new Fact.
|
||||
*/
|
||||
void setFact(obelisk::Fact fact);
|
||||
|
||||
/**
|
||||
* @brief Get the true Action object.
|
||||
*
|
||||
* @return obelisk::Action& Returns the true Action.
|
||||
*/
|
||||
obelisk::Action& getTrueAction();
|
||||
|
||||
/**
|
||||
* @brief Set the true Action object.
|
||||
*
|
||||
* @param[in] trueAction The new true Action.
|
||||
*/
|
||||
void setTrueAction(obelisk::Action trueAction);
|
||||
|
||||
/**
|
||||
* @brief Get the false Action object.
|
||||
*
|
||||
* @return obelisk::Action& Returns the false Action.
|
||||
*/
|
||||
obelisk::Action& getFalseAction();
|
||||
|
||||
/**
|
||||
* @brief Set the false Action object.
|
||||
*
|
||||
* @param[in] falseAction The new false Action.
|
||||
*/
|
||||
void setFalseAction(obelisk::Action falseAction);
|
||||
|
||||
/**
|
||||
* @brief Select the SuggestAction from the KnowledgeBase by IDs of
|
||||
* the sub-objects.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectById(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert the SuggestAction into the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
126
obelisk/include/models/verb.h
Normal file
126
obelisk/include/models/verb.h
Normal file
@@ -0,0 +1,126 @@
|
||||
#ifndef OBELISK_MODELS_VERB_H
|
||||
#define OBELISK_MODELS_VERB_H
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace obelisk
|
||||
{
|
||||
/**
|
||||
* @brief The Verb model represents a verb which is used to connnect
|
||||
* entities.
|
||||
*
|
||||
*/
|
||||
class Verb
|
||||
{
|
||||
private:
|
||||
/**
|
||||
* @brief The ID of the Verb in the KnowledgeBase.
|
||||
*
|
||||
*/
|
||||
int id_;
|
||||
|
||||
/**
|
||||
* @brief The name of the Verb.
|
||||
*
|
||||
*/
|
||||
std::string name_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Verb object.
|
||||
*
|
||||
*/
|
||||
Verb() :
|
||||
id_(0),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Verb object.
|
||||
*
|
||||
* @param[in] id The ID of the Verb.
|
||||
*/
|
||||
Verb(int id) :
|
||||
id_(id),
|
||||
name_("")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Verb object.
|
||||
*
|
||||
* @param[in] name The name of the Verb.
|
||||
*/
|
||||
Verb(std::string name) :
|
||||
id_(0),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Construct a new Verb object.
|
||||
*
|
||||
* @param[in] id The ID of the Verb.
|
||||
* @param[in] name The name of the Verb.
|
||||
*/
|
||||
Verb(int id, std::string name) :
|
||||
id_(id),
|
||||
name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create the Verb table in the KnowledgeBase.
|
||||
*
|
||||
* @return const char* Returns the query used to create the table.
|
||||
*/
|
||||
static const char* createTable();
|
||||
|
||||
/**
|
||||
* @brief Get the ID of the Verb.
|
||||
*
|
||||
* @return int& Returns the ID.
|
||||
*/
|
||||
int& getId();
|
||||
|
||||
/**
|
||||
* @brief Set the ID of the Verb.
|
||||
*
|
||||
* @param[in] id Set the ID of the Verb.
|
||||
*/
|
||||
void setId(int id);
|
||||
|
||||
/**
|
||||
* @brief Get the name of the Verb.
|
||||
*
|
||||
* @return std::string& The Verb name.
|
||||
*/
|
||||
std::string& getName();
|
||||
|
||||
/**
|
||||
* @brief Set the name of the Verb.
|
||||
*
|
||||
* @param[in] name The Verb name.
|
||||
*/
|
||||
void setName(std::string name);
|
||||
|
||||
/**
|
||||
* @brief Select a verb by name from the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void selectByName(sqlite3* dbConnection);
|
||||
|
||||
/**
|
||||
* @brief Insert a new verb into the KnowledgeBase.
|
||||
*
|
||||
* @param[in] dbConnection The database connection to use.
|
||||
*/
|
||||
void insert(sqlite3* dbConnection);
|
||||
};
|
||||
} // namespace obelisk
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user