コード例 #1
0
def graph_pre_role_inclusion():
    graph = gel.KnowledgeBase('bot', 'top')
    graph.add_concept(gel.Concept('C'))
    graph.add_concept(gel.Concept('D'))

    graph.add_role(gel.Role('i'))
    graph.add_role(gel.Role('j'))
    return graph
コード例 #2
0
def three_concept_graph():
    graph = gel.KnowledgeBase('bot', 'top')
    graph.add_concept(gel.Concept('C'))
    graph.add_concept(gel.Concept('C_prime'))
    graph.add_concept(gel.Concept('D'))
    graph.add_role(gel.Role('i'))
    return graph
コード例 #3
0
def init_bot_graph():
    graph = gel.KnowledgeBase('bot', 'top')
    graph.add_concept(gel.Concept('C'))
    graph.add_concept(gel.IndividualConcept('a'))
    graph.add_role(gel.Role('r'))
    graph.add_axiom('a', 'C', graph.is_a.iri)
    graph.add_axiom('C', 'bot', graph.is_a.iri)
    return graph
コード例 #4
0
def simple_graph():
    graph = gel.KnowledgeBase('bot', 'top')
    graph.add_concept(gel.Concept('C'))
    graph.add_concept(gel.IndividualConcept('a'))
    graph.add_role(gel.Role('r'))

    graph.add_concept(gel.ExistentialConcept('r', 'C'))
    graph.add_axiom('a', 'C', graph.is_a.iri)
    return graph
コード例 #5
0
def concept_with_arrows():
    concept_a = gel.Concept('a')
    concept_b = gel.Concept('b')
    role = gel.Role('r')
    arrow1 = gel.Arrow(concept_b, role)
    concept_a.add_arrow(arrow1)

    concept_c = gel.Concept('c')
    arrow2 = gel.Arrow(concept_c, role)
    concept_a.add_arrow(arrow2)

    return concept_a, [arrow1, arrow2]
コード例 #6
0
def test_kb_far_existential_concept_is_unsatisfiable(empty_kb):
    kb = empty_kb

    kb.add_concept(gel.IndividualConcept('a'))
    kb.add_concept(gel.IndividualConcept('b'))
    kb.add_concept(gel.Concept('B'))
    kb.add_role(gel.Role('r'))

    kb.add_axiom('a', 'b', 'r')
    kb.add_axiom('b', 'B', kb.is_a)

    rB = gel.ExistentialConcept('r', 'B')
    kb.add_concept(rB)
    kb.add_axiom(rB, kb.bot, kb.is_a)

    result = solve(kb)
    assert not result['satisfiable']
コード例 #7
0
def graph_complete_rule_5():
    graph = gel.KnowledgeBase('bot', 'top')
    graph.add_concept(gel.Concept('C'))
    graph.add_concept(gel.Concept('D'))
    graph.add_concept(gel.Concept('C1'))
    graph.add_concept(gel.Concept('C2'))
    graph.add_axiom('C', 'C1', graph.is_a)
    graph.add_axiom('C1', 'C2', graph.is_a)

    graph.add_concept(gel.Concept('D1'))
    graph.add_axiom('D', 'D1', graph.is_a)

    graph.add_role(gel.Role('i'))
    graph.add_concept(gel.Concept('D-1'))
    graph.add_axiom('D-1', 'D', 'i')

    graph.add_concept(gel.IndividualConcept('a'))

    graph.add_axiom('C2', 'a', graph.is_a)
    graph.add_axiom('D1', 'a', graph.is_a)
    graph.add_axiom('a', 'C', graph.is_a)
    graph.add_axiom('a', 'D-1', graph.is_a)
    return graph