5.1.1 branchOfCG

Introduction

A branch of a CG is two concepts connected by a relation. The two patterns available are:

[C1]-Rel->[C2]

and

[C2]<-Rel-[C1]

Signature

The signature of branchOfCG/2 is as follows:

branchOfCG(B,G)

where B is a branch (as described above) and G is a graph.

Operation

The branchOfCG/2 predicate is used for finding out whether a branch is part of a CG.

This is done using matching. This means that you can use variables in the branch.

The process only works at the outermost level of the graph G. That is, branchOfCG will not find branches that are nested inside concepts of G.

Example

//
// branchOfCG example
//
// Available in the AAU directory as branchOfCG.plgCG
//
// Ulrik Petersen
// Created: September 19, 2003
// Last update: September 19, 2003

// Type hierarchy
Entity > Animal, Act, Proposition.

// Catalog of instances
Act = Say.
Animal = Dolly.

// Dolly says to Dollay: "B-a-a-a-a-a"
graph(gr1, [Act : Say]-
                -AGNT->[Animal : Dolly],
                -RCPT->[Animal : Dolly],
                -THME->[Proposition = "B-a-a-a-a-a"]).

// List all branches
branch(B) :-
    graph(L, G),
    branchOfCG(B, G).

// Find the agent 
agent(A) :-
    graph(L, G),
    branchOfCG([Act]-AGNT->[Animal: A], G).

If we write the following query:

?- branch(B).

The answer is:

{B = [Act : Say]-AGNT->[Animal : Dolly]}
{B = [Act : Say]-RCPT->[Animal : Dolly]}
{B = [Act : Say]-THME->[Proposition = "B-a-a-a-a-a"]}

This is a list of all the branches in the graph.

If we now write the following query:

?- agent(A).

The answer is:

{A = Dolly}

This shows the fact that branchOfCG allows binding of variables to parts of the CG which match between the branch and the CG.

Summary

Thus branchOfCG/2 is used to find out whether a branch is part of a CG, and to retrieve parts of a branch into variables.


PrevLite: 5.1 CG goals
NextLite: 5.1.2 concOfCG

Prev: 5.1 CG goals
Up: 5.1 CG goals
Next: 5.1.2 concOfCG