9 #ifdef HAVE_SQL_STORAGE
18 using namespace opencog;
27 fprintf(stderr,
"Error: No atom found\n");
33 fprintf(stderr,
"Error, type mis-match, a=%d b=%d\n", a->
getType(), b->
getType());
38 fprintf(stderr,
"Error, arity mis-match, a=%d b=%d\n", la->
getArity(), lb->
getArity());
45 for (
int i =0; i< la->
getArity(); i++)
47 if (outa[i] != outb[i])
49 fprintf(stderr,
"Error, outgoing set mis-match, "
50 "i=%d a=%lx b=%lx\n", i, outa[i].value(), outb[i].value());
59 fprintf(stderr,
"Error, truth value miscompare, "
60 "ma=%f mb=%f ca=%f cb=%f\n",
61 ta->getMean(), tb->getMean(), ta->getCount(), tb->getCount());
73 void single_atom_test(std::string
id)
78 Atom *a =
new Node(SCHEMA_NODE,
id +
"someNode");
94 printf(
"atom compare success\n");
99 Atom *a2 =
new Node(SCHEMA_NODE,
id +
"otherNode");
103 std::vector<Handle> hvec;
115 printf(
"link compare success\n");
121 void add_to_table(
AtomTable *table, std::string
id)
124 Atom *a =
new Node(SCHEMA_NODE,
id +
"fromNode");
129 Atom *a2 =
new Node(SCHEMA_NODE,
id +
"toNode");
134 Atom *a3 =
new Node(SCHEMA_NODE,
id +
"third wheel");
139 std::vector<Handle> hvec;
153 single_atom_test(
"aaa ");
154 single_atom_test(
"bbb ");
155 single_atom_test(
"ccc ");
156 single_atom_test(
"ddd ");
157 single_atom_test(
"eee ");
166 printf(
"Printing table:\n");
176 add_to_table(table,
"aaa ");
177 add_to_table(table,
"bbb ");
178 add_to_table(table,
"ccc ");
179 add_to_table(table,
"ddd ");
180 add_to_table(table,
"eee ");
182 store->
store(*table);
const HandleSeq & getOutgoingSet() const
int main(int argc, char *argv[])
a TruthValue that stores a mean and the number of observations (strength and confidence) ...
void storeAtom(AtomPtr, bool synchronous=false)
std::shared_ptr< TruthValue > TruthValuePtr
Handle add(AtomPtr, bool async)
void setTruthValue(TruthValuePtr)
Sets the TruthValue object of the atom.
void store(const AtomTable &)
AtomPtr getAtom(const char *, int)
TruthValuePtr getTruthValue()
int atomCompare(Atom *a, Atom *b)
static void addAtom(AtomPtr atom)