Example #1
0
    def test_get_database(self):
        req = GetDatabaseRequest()
        req.write = True
        db = Database()
        obj = db.onto.search(id='25')
        print(obj)
        res = self._getdatsrv.call(req)

        db.change_onto(res.path)
        obj = db.onto.search(id='25')
        print(obj)
This source code is licensed under the BSD-3-Clause license found in the
LICENSE file in the root directory of this source tree.

@author: Zdenek Kasner
"""
from nlp_crow.database.Database import Database
from nlp_crow.database.DatabaseAPI import DatabaseAPI
from nlp_crow.modules.LocationGrounder import LocationGrounder
from nlp_crow.modules.ObjectGrounder import ObjectGrounder

import owlready2 as ow
import logging

from nlp_crow.templates.TemplateFactory import TemplateType

db = Database()


# with db.onto as onto:
class ProgramRunner:
    """
    Grounds object and location placeholders in the template so that they refer
    to real objects and locations in the workspace. The result can be used to
    create instructions for the robot.
    """
    def __init__(self, language='en'):
        self.logger = logging.getLogger(__name__)

        self.og = ObjectGrounder()
        self.lg = LocationGrounder()
        self.db_api = DatabaseAPI()