All predicatesShow sourcecall_graph.pl -- Build the call graph used for NMR check construction and indexing.

Given the input program, build a call graph and assert the components.

author
- Kyle Marple
version
- 20170127
license
- BSD-3
Source a(?Head:int, ?Goal:int, ?Negation:int, ?ID:int) is det
Arc in the call graph from Head to Goal. Both head and goal will always be positive with Negation indicating whether or not Goal was originally negated. ID is the arc ID used to get associated rule IDs from ar/2.
Arguments:
Head- Rule head.
Goal- Absolute value of rule goal.
Negation- 1 or 0 indicating if Goal was originally negated.
ID- Arc ID. See ar/2.
Source ar(?ArcID:int, ?RuleIDs:list) is det
Associate an arc ID with a list of rule IDs. Each rule contains the associated arc in the call graph; this avoids duplicate arcs.
Arguments:
ArcID- An integer ID indicating an arc. See a/4.
RuleIDs- A list of rule IDs with matching arcs in the call graph.
 e(Literal:int) is det[private]
A literal to skip when building the call graph.
Arguments:
Literal- The literal to skip.
Source build_call_graph(+Rules:list, -Nodes:list)
Build and assert the call graph. Return a list of nodes. Don't includes rules with heads present in the list of exclude.
Arguments:
Rules- Rules to use in building call graph.
Nodes- Nodes in call graph.
Source get_nodes(+Arcs:list, -Nodes:list)[private]
Get a list of nodes in the graph. These are the positive literals that occur as rule heads.
Arguments:
Arcs- List of arcs in call graph, of the form a(Head, Goal, Neg, ID).
Nodes- Nodes in call graph.
Source get_arcs(+Rules:list, +ArcsIn:list, -ArcsOut:list)[private]
Get call graph edges w/ negation parity from rules. If rule/4 fails (rules have no ID), use rule/3 and an ID of -1.
Arguments:
Rules- The list of rules in the program.
ArcsIn- List of arcs of the form a(Head, Goal, Neg, ID).
ArcsOut- List of arcs of the form a(Head, Goal, Neg, ID).
Source get_arcs2(+Head:ground, +ID:int, +Goals:list, +ArcsIn:list, -ArcsOut:list)[private]
Get call graph arcs for a single rule. Format is: a(head, goal, negation, id).
Arguments:
Head- Head of a rule.
ID- Rule ID.
Goals- Body of rule.
ArcsIn- List of arcs of the form a(Head, Goal, Neg, ID).
ArcsOut- List of arcs of the form a(Head, Goal, Neg, ID).
Source merge_arcs(+ArcsIn:list, -ArcsOut:list, -IDgroups:list) is det[private]
Ensure that at most one arc for each negation exists between two nodes. Create a list of IDs for an arc to later associate with rules. Use the first rule ID as the ID for the list of rules.
Arguments:
ArcsIn- List of arcs of the form a(Head, Goal, Neg, ID).
ArcsOut- List of arcs of the form a(Head, Goal, Neg, ID).
IDgroups- List of ID groups of the form ar(ID, IDlist).
Source merge_arcs2(+Head:int, +Goal:int, +Neg:int, +ArcsIn:list, -ArcsOut:list, -IDs:list) is det[private]
Get rules associate with a single arc in the final graph
Arguments:
Head- Head of rule.
Goal- Rule goal. Always positive, with Neg indicating negation.
Neg- 1 or 0 indicating if goal is negated.
ArcsIn- List of arcs of the form a(Head, Goal, Neg, ID).
ArcsOut- List of arcs of the form a(Head, Goal, Neg, ID).
IDs- IDs associated with the current arc.
Source assert_all(+List:list)[private]
Assert each element in a list.
Arguments:
List- List of facts to assert.
Source destroy_call_graph
Retract the assertions for the call graph.