示例#1
0
def is_concept_type_of(concept_uri, type_uri):
    query = "ask(instance_of('{}','{}')).".format(concept_uri, type_uri)
    solutions = talker.get_all_solutions(query)
    #solutions contains empty list if the query is false.If the query is true solutions contains an empty dict
    if len(solutions) == 1 and isinstance(solutions[0], dict):
        return True
    else:
        return False
示例#2
0
def load(path_to_narrative_file):
    query = "use_module(library('db/mongo/client')),ensure_loaded('/home/koralewski/catkin_ws/ros_cram/src/knowrob/src/comm/ros/tf/tf_plugin.pl')," \
            "tripledb_drop(), forall(mng_collection(roslog, Coll), mng_drop(roslog, Coll)),"\
            "tripledb_load('package://knowrob/owl/knowrob.owl', [graph(tbox), namespace(knowrob)]),"\
            "remember('{0}').".format(path_to_narrative_file)
    talker.get_all_solutions(query)
示例#3
0
def send_query(query):
    return talker.get_all_solutions(query)
示例#4
0
def objects(subject_uri, predicate_uri):
    query = "ask(triple('{}','{}',O)).".format(subject_uri, predicate_uri)
    solutions = talker.get_all_solutions(query)
    return [(solution.get('O')) for solution in solutions]
示例#5
0
def subjects(predicate_uri, object_uri):
    query = "ask(triple(S,'{}','{}')).".format(predicate_uri, object_uri)
    solutions = talker.get_all_solutions(query)
    return [(solution.get('S')) for solution in solutions]