[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter lists all of the relations that come predefined in PowerLoom. They
are defined in the module PL-KERNEL
; users can access them by
including or using the PL-KERNEL
module within the declarations of their
own modules.
bound-variables
predicate is used as a performance enhancer, to prevent other predicates
from backchaining excessively while searching for bindings of certain of
their arguments. Purists will shun the use of this predicate, but some rules
are inherently inefficient without the addition of some kind of control logic.
Because evaluation of the bound-variables
predicate evaluation of
predicates being guarded
, using this predicate has the side-effect
of locally disabling query optimization. (See collect-into-set
for
an example that uses bound-variables
.
happy
is closed,
implying that all things that are happy will be asserted as such.
To prove (not (happy Fred))
, PowerLoom can use a negation-as-failure
proof strategy which returns TRUE if Fred
cannot be proved to be happy.
Also, if the relation children
is closed, then a value for the expression
(range-max-cardinality children Fred)
can be inferred merely by
counting the number of fillers of the children
role on Fred
.
fillers
predicate:
(<= (fillers ?r ?i ?v) (and (bound-variables ?r ?i) (collect-into-set (setofall ?v (holds ?r ?i ?v)) ?members))) |
When ?r
and ?i
are bound, the term (setofall ?v (holds ?r ?i ?v))
evaluates to a unary relation satisfied for each filler of the relation
in ?r
applied to the instance in ?i
. collect-into-set
causes
the extension of this (dynamically-defined) unary relation to be
computed. Note the use of bound-variables
to screen out unbound
variables before they are passed to the setofall
predicate.
SETOF
and LISTOF
.
documentation
and
issue
strings.
concept
corresponds to the object-oriented notion of class
.
From a logic standpoint, the notion of a concept is hard to distinguish
from the notion of unary relation
. The conceptual distinction is
best illustrated in the domain of linguistics, where concepts are
identified with collective nouns while unary relations are identified
with adjectives. For example, Rock
is a concept, while rocky
is a
unary relation.
disjoint-covering
).
Igneous-Rock
, Metamorphic-Rock
, and
Sedimentary-Rock
together form a disjoint covering of the concept Rock
.
T
that satifies ?r, the first
argument of T
necessarily belongs to the concept ?d. domain
exists
for convenience only and is defined in terms of nth-domain
. domain
assertions should be avoided, since they create redundant nth-domain
propositions (use nth-domain
directly).
range-cardinality
, range-type
, and numeric-minimum
. Frame predicates
are typically used to capture the kinds of relations manipulated
by description logic systems such as USC/ISI's Loom system.
+
is a function we can write (= (+ 2 2) 4)
. The same sentence written
in relational syntax would look like (+ 2 2 4)
. If a relation is
introduced using the defrelation
syntax and also declared to be
single-valued, the functional syntax does not apply; only the explicit
use of deffunction
sanctions the use of that syntax.
computation
(a function) that is attached (logically)
to ?r Each time a proposition with predicate ?r becomes
false, the function is applied to that proposition.
computation
(a function) that is attached (logically)
to ?r Each time a proposition with predicate ?r becomes
true, the function is applied to that proposition.
computation
(a function) that is attached (logically)
to ?r Each time a proposition with predicate ?r becomes
unknown, the function is applied to that proposition.
holds
is a variable arity predicate that takes
a relation as its first argument, and zero or more additional arguments.
It returns values equivalent to a subgoal that has the first argument
as a predicate and the remaining arguments shifted one place to the left.
For holds
to succeed, the (first) relation argument must be bound --
PowerLoom will NOT cycle through all relations searching for ones that
permit the proof to succeed. However, users can obtain the same effect
if they choose by using other second-order predicates to generate
relation bindings. For example, the query
(retrieve all ?x (and (Relation ?r) (holds ?r Fred ?x))) |
retrieves all constants for which there is some binary relation that
relates Fred
to that relation.
image-url
values attached to
objects it is presenting, and displays them prominently, thereby spiffing
up its displays.
(inverse R I)
assertion per relation pair R
and I
. In that case R
is viewed as the
canonical relation and I
simply provides a different access mechanism to
the canonical relation. In a logic-based KR paradigm inverse relations are
redundant and do not add anything that couldn't be represented or queried
without them, however, sometimes they can provide some extra convenience for
users. Asserting (inverse I R)
also will not cause an error but can degrade
backward inference performance due to the extra redundant rule that gets
generated. If domain rules will be written in terms of both R
and I
(as
opposed to only R
), (inverse I R)
should be asserted also to get full
inferential connectivity between the two relations.
IST
(is true) relation allows one to evaluate a query or rule in more
than one context. A common use of IST
is in defining lifting axioms
that import knowledge from one context to another. For example, below is
a rule that accesses a patient-record
relation in a module called
Medical-Kb
, lifts-out
the age
column, and imports it into a
has-age
relation in the current context.
(<= (has-age ?person ?age) (and (has-ssn ?person ?ssn) (exists (?1 ?2 ?3 ?4) (ist Medical-Kb (patient-record ?ssn ?1 ?2 ?age ?3 ?4))))) |
listof
consists of elements of type List
.
listof
is most commonly used in conjunction with the member-of
predicate. For example the query
(retrieve ?x (member-of ?x (listof a b c))) |
returns the constants a
, b
, and c
on successive iterations.
member-of
is for binding a variable to successive members in a list
or set (see listof
and setof
).
(mutually-disjoint-collection (setof MAN WOMAN)) |
states that the concepts MAN and WOMAN are disjoint.
T
that satifies ?r, the last
argument of T
necessarily belongs to the concept ?rng. range
exists
for convenience only and is defined in terms of nth-domain
. range
assertions should be avoided, since they create redundant nth-domain
propositions (use nth-domain
directly).
range-min-cardinality
and
range-max-cardinality
compute identical values, i.e., when the
best lower and upper bounds on the cardinality are equal. Each of
these bounding functions employs a variety of rules to try and
compute a tight bound.
range-cardinality-lower-bound
and range-min-cardinality
is
subtle but significant. Suppose we state that nine is a lower bound
on the number of planets in the solar system, and then ask if eight is
(also) a lower bound:
(assert (range-cardinality-lower-bound hasPlanets SolarSystem 9)) (ask (range-cardinality-lower-bound hasPlanets SolarSystem 8)) ==> TRUE |
PowerLoom will return TRUE. However if we ask if the minimum cardinality of the solar system's planets is eight, we get back UNKNOWN
(ask (range-min-cardinality hasPlanets SolarSystem 8)) ==> UNKNOWN |
because eight is not the tightest lower bound.
range-cardinality-lower-bound
).
range-cardinality-lower-bound
).
range-cardinality-lower-bound
).
computation
(a function) that evaluates an (atomic) relation
proposition during query processing. The function is passed a proposition
for evaluation for which all arguments are bound. The function
returns a BOOLEAN if it represents a predicate, or some sort of value
if it is a function.
computation
(a function) that evaluates an (atomic) relation
proposition during query processing. The function is passed a proposition
for evaluation for which at most one argument is unbound. The function
returns a BOOLEAN if it represents a predicate, or some sort of value
if it is a function. If all arguments are bound the function computes whether
the constraint holds. If all but one argument is bound and the unbound
argument is a pattern variable then the missing value is computed.
evaluator
(a function) that evaluates an (atomic) relation
proposition during constraint propagation. This defines an extensible
means for computing using auxiliary data structures. The function is passed
a proposition for evaluation. All side-effects are made by updates to
the proposition, or by generating other assertions.
specialist
(a function) that evaluates an (atomic) relation
proposition during query processing. This defines an extensible
means for computing with the control stack. The function is passed
a CONTROL-FRAME that contains the proposition, and returns a keyword
:FINAL-SUCCESS, :CONTINUING-SUCCESS, :FAILURE, or :TERMINAL-FAILURE
that controls the result of the computation.
set
;
a collection that has no duplicates.
setof
is like listof
except
that it removes duplicate values.
function
).
subset-of
predicate refuses to search for bindings if
both of its variables are unbound. Implementation note: subset-of
is treated specially internally to PowerLoom, and hence Powerloom does not
permit the augmentation of subset-of
with additional inference rules.
In otherwords, subset-of
behaves semantically like an operator instead
of a relation.
subsequence
. In
addition, this function can be used to locate substrings in strings by
supplying values for ?s and ?sub and allowing ?start and ?end to be
bound by the function specialist. In other words,
(retrieve all (?start ?end) (substring "foo" ?start ?end "o"))
==> ?start = 1, ?end = 2,
?start = 2, ?end = 3.
does
make such an assumption.
For example, if we define a two-argument function foo
and then retrieve
its value applied to some random instances a
and b
, we get nothing
back:
(deffunction foo (?x ?y) :-> ?z) (retrieve ?x (= ?x (foo a b))) |
However, if we assert that foo
is total, then we get a skolem back
when we execute the same retrieve:
(assert (total foo)) (retrieve ?x (= ?x (foo a b))) |
?value
. The value
predicate is the analog
of holds
, except that it applies to functions instead of relations.
11. Miscellaneous
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |