Fetch the concept represented by a KB value object.
valueConcept = getconval(aValue)
valueConcept - type: con
aValue - type: val
parentConcept - type: con
Given a KB VAL object, fetch the concept that it houses.
In this example, we create a concept like noun and assign it as the value of a word's attribute. First, create the concepts named words and noun as children to the root of the KB (concept), and then make the concept book a child of words.
G("words") = makeconcept(findroot(), "words");
G("noun") = makeconcept(findroot(),"noun");
G("noun_book") = makeconcept(G("words"),"book");
The KB editor at this point looks like:
Next, give book the attribute "is a" and make the concept noun be the value of book's attribute "is a":
G("an_attr") = addattr(G("noun_book"),"is a");
addconval(G("noun_book"), "is a", G("noun"));
The remaining code finds the first child of words named book, gets the concept which is the value of the attribute "is a" and prints out its name ('noun') to output.txt:
G("aConcept") = getconcept(G("words"),"book");
G("anotherConcept") = getconval(findvals(G("aConcept"),"is a"));
"output.txt" << conceptname(G("anotherConcept")) << "\n";
addconval, conval, findvals, conceptname, Knowledge Base Functions