Пример #1
0
 def post_terms(self, term, ttype):
     msg = '%s is a %s.' % (term, ttype)
     try:
         schemata.create_data(term, ttype)
     except schemata.SchemaNotFound:
         pass
     resp = ask_kb(self.config, msg)
     if resp == term:
         un = request.environ.get('REMOTE_USER')
         resp = ask_kb(self.config,
                       '(want %s, do (initialize %s, obj %s))' % (un, un, term))
     return resp
Пример #2
0
def list_folder(tserver, match, fact):
    name = match['Folder1']
    user = match['Person1']
    q = '(is-placed Content1, in %s)?' % name
    resp = ask_kb(tserver.config, q)
    resp = json.loads(resp)
    data = get_data(name)
    template = get_template('templates/list-folder.html')
    return template.render(contents=resp, data=data, user=user, name=name)
Пример #3
0
 def get_terms(self, type_name):
     msg = 'lexicon:get-words:' + type_name
     return ask_kb(self.config, msg)
Пример #4
0
 def post_fact(self, facts):
     msg = facts + '.'
     return ask_kb(self.config, msg)
Пример #5
0
 def get_facts(self, facts):
     msg = facts + '?'
     resp = ask_kb(self.config, msg)
     resp = json.loads(resp)
     return serve_template('question.html',
                            facts=facts, resp=resp)
Пример #6
0
 def get_verb(self, name):
     msg = 'lexicon:get-verb:' + name
     return ask_kb(self.config, msg)
Пример #7
0
 def get_subterms(self, superterm):
     msg = 'lexicon:get-subwords:' + superterm
     return ask_kb(self.config, msg)