[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter lists 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.
Function that multiplies two numbers.
Function that adds two numbers.
Function that subtracts two numbers.
Function that divides two numbers.
True if ?x < ?y.
True if ?x <= ?y.
True if ?x > ?y.
True if ?x >= ?y.
True if there are no direct assertions made to the relation ?r.
?a is an aggregate
A binary relation ?r is antisymmetric if whenever (?r ?x ?y) is true (?r ?y ?x) is false unless ?x equals ?y.
The number of arguments/domains of the relation ?r.
Query ?prop with :inference-level set to :assertion.
Equivalent to (query ?prop :inference-level :assertion)
but more efficient.
Query ?prop with :inference-level set to :backtracking.
Equivalent to (query ?prop :inference-level :backtracking)
but more efficient.
The class of binary relations.
True if all arguments are bound. The 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
.
Function that returns the cardinality of a set.
The collection ?c is closed if all of its members are known.
Asserting that a relation is closed makes certain computations easier.
For example, suppose that the relation 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
.
Collect elements of ?c into an ascending ?orderedSet where the position of each
element is determined by the value computed for it by the ?sortBy relation. Ordering is done via
sorting (as opposed to using a comparison relation) similar to the :sort-by option to the retrieve
command. If ?sortBy is not single-valued, the position of an element is determined by its largest
?sortBy value. Note that, similar to other collect-into-...
functions, ?c can be a named concept,
a setofall
or an enumerated collection, and ?sortBy can be a named relation or a kappa
.
Collect elements of ?c into a descending ?orderedSet where the position of each
element is determined by the value computed for it by the ?sortBy relation. Ordering is done via
sorting (as opposed to using a comparison relation) similar to the :sort-by option to the retrieve
command. If ?sortBy is not single-valued, the position of an element is determined by its largest
?sortBy value. Note that, similar to other collect-into-...
functions, ?c can be a named concept,
a setofall
or an enumerated collection, and ?sortBy can be a named relation or a kappa
.
Infer as many members of ?c as possible and
collect them into a list ?l. This is similar to collect-into-set
but collects members in the order they are encountered. If a member
is derived multiple times, all occurrences are kept. This is
useful, for example, to collect and then sum up number-valued
attributes of objects.
This is similar to collect-into-list
, but if a
member is derived multiple times, only the first occurrence is kept
- hence, the name, even though ordered sets are represented as lists.
Infer as many members of ?c as possible and
collect them into a set ?l. For example, here is a rule
used to compute bindings for the fillers
predicate:
(<= (fillers ?r ?i ?members) (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
term.
Not documented.
Not documented.
Abstract function existing to subsume SETOF
and LISTOF
.
?s is a comment attached to ?x. Comments are
a generalization of other annotations such as documentation
and
issue
strings.
A relation ?r is commutative if its truth value is invariant with any permutation of its arguments.
The class of reified unary relations. The Powerloom
notion of 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.
Function that, given a concept, returns a prototypical instance that inherits all constraints that apply to any concept member, and has no additional constraints.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Retrieve the home context of ?x where it was first referenced or defined.
True if ?c is a subset of the union of all
collections in the set ?cover (see disjoint-covering
).
Prolog-like CUT. Succeeds the first time and then fails. Side-effect: Locally disables query optimization.
True iff ?sub is a direct subrelation of ?r; written in set notation, ?sub < ?r, and there is no ?s such that ?sub < ?s < ?r. This relation will generate bindings for at most one unbound argument.
True iff ?super is a direct superrelation of ?r; in set notation, ?super > ?r, and there is no ?s such that ?super > ?s > ?r. This relation will generate bindings for at most one unbound argument.
True if the intersection of ?c1 and ?c2 is empty.
True if ?c is covered by the collections in ?disjointCover
and if the member sets in ?disjointCover are mutually-disjoint. For
example the concepts Igneous-Rock
, Metamorphic-Rock
, and
Sedimentary-Rock
together form a disjoint covering of the concept Rock
.
?s is a documentation string attached to ?x. Some of the PowerLoom text processing tools look for documentation strings and import them into documents.
True if for any tuple 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).
?c is duplicate-free if no two members denote the same object.
?c is free of duplicates
The collection ?c is empty if it has no members. Note that for collections possessing open-world semantics, (e.g., most concepts) the fact that the collection has no known members does not necessarily imply that it is empty.
True if ?r is equivalent to ?equiv; written in set notation, ?r = ?equiv. This relation will generate bindings for at most one unbound argument.
?e is an example of (the use of) ?r.
Return the fifth element ?e of ?l.
Given a relation ?r and instance ?i, returns a set of known fillers of ?r applied to ?i. IMPORTANT: this also collects intensional fillers such as skolems that might be identical extensionally.
Return the first element ?e of ?l.
Fail-based conditional. If ?test succeeds, evaluates ?then; otherwise evaluates ?else.
Return the fourth element ?e of ?l.
A frame predicate is a second-order relation that
is used to describe constraints on the set of fillers for a binary
relation applied to an instance. Examples of frame predicates are
range-cardinality
, range-type
, and numeric-inclusive-minimum
.
Frame predicates are typically used to capture the kinds of relations
manipulated by description logics such as USC/ISI’s Loom and W3C’s OWL.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Names a 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.
Names a 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.
Names a 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.
True if the tuple ?arguments is a member of the
relation ?relation. 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.
?url is a URL pointing to an image illustrating ?x.
The Ontosaurus browser looks for image-url
values attached to
objects it is presenting, and displays them prominently, thereby spiffing
up its displays.
Abstract superrelation of inequality relations.
Add ?e at position ?n (zero-based) to ?l to construct ?r (shifts the remaining elements right). Count from end of the list and shift left if ?n is negative such that -1 inserts at the end of the list, -2 second to last, etc.
True if ?x is an instance of ?c. Can be used to generate concept values of ?c, given an instance ?x.
Function that returns the inverse relation for ?r.
PERFORMANCE NOTE: for best results there should be only one (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.
A binary relation ?r is irreflexive if it is false when both of its arguments are identical.
?s is an issue attached to ?x. An issue string normally comments on a topic that has not been resolved to everyone’s satisfaction.
True if proposition ?p is true in context ?context.
The 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))))) |
Function that returns the length of a string or a logical list.
Function that returns the length of a string or a logical list.
?s is a lexeme for the relation or individual ?r. A relation or individual ?r can have zero or more lexemes, words that are natural langage equivalents of a logical constant. The same lexeme may be attached to more than one constant.
Not documented.
Not documented.
Not documented.
Concatenate lists ?x and ?y into ?r. If ?x and/or ?y are not lists but sets or more general collections, the order of the elements in the result list ?r will be arbitrary.
Term-forming function that defines an ordered list
consisting of all function arguments. Within logical expressions
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.
Find those ?element(s) of ?c with the maximum ?sortBy value, for example,
(retrieve (maximum-element relation arity ?x))
(see also collect-into-descending-set
).
Binds ?max to the maximum of the numbers in the list ?l.
Binds ?mean to the mean of the numbers in ?l.
Binds ?median to the median of the numbers in ?l.
TRUE if ?x is a member of collection ?c. A common use
of member-of
is for binding a variable to successive members in a list
or set (see listof
and setof
).
Find those ?element(s) of ?c with the minimum ?sortBy value, for example,
(retrieve (minimum-element relation arity ?x))
(see also collect-into-ascending-set
).
Binds ?min to the minimum of the numbers in the list ?l.
True if the members of ?s are pair-wise disjoint. Used most often to expresse disjointness constraints between concepts. For example
(mutually-disjoint-collection (setof MAN WOMAN)) |
states that the concepts MAN and WOMAN are disjoint.
Find or create the PowerLoom logic object ?o named by
the name ?n in the current module. We are interpreting the name ?n literally
here, i.e., it is not a print name as assumed by PLI functions and an object
with exactly that name will be looked up or created. If ?n is not a string,
this will coerce it to a string first. We are intentionally
using a separate function here (instead of folding this into object-name
),
since we might want to be able to look for an object with a certain name
but not create one if it doesn’t exist.
Query ?prop with :inference-level set to :normal.
Equivalent to (query ?prop :inference-level :normal)
but more efficient.
True if the nth value for a tuple T satisfying ?r must belong to the concept ?d. Argument counting starts at zero.
Return the ?n-th element ?e of ?l (zero-based). Count from end of the list if ?n is negative. If ?n is unbound and ?e is bound, this computes all positions of ?e. If both are unbound, collection elements and their respective positions will be enumerated.
Return the ?n head elements ?h of ?l. Count from end of the list if ?n is negative.
Return the ?n-th rest ?r of ?l (zero-based). Count from end of the list if ?n is negative.
Relation that specifies an upper bound ?n on any numeric value that can belong to the set of fillers of the relation ?r applied to ?i.
Relation that specifies a lower bound ?n on any numeric value that can belong to the set of fillers of the relation ?r applied to ?i.
?s is a set of numbers
The name of the object ?X as a string. This is just the name, with module prefixes NOT included.
?c is ordered if the ordering of its members is significant. Lists are ordered, while sets are not.
A phrase is a variablized sentence, a template, that is used to express individual axiomatic facts as natural language sentences. By convention, a phrase contains one or more occurrences of each variable in a relation or concept definition, it does not begin with a capital letter, and it has no concluding period. Systematic attachment of phrases to relations can be leveraged by tools that generate natural language paraphrases of logic sentences.
Project elements in column ?i (zero-based) of the tuples of ?c and collect them into a list ?l.
True iff ?sub is a proper subrelation of ?r; written in set notation, ?sub < ?r. This relation will generate bindings for at most one unbound argument.
True iff ?super is a proper superrelation of ?r; written in set notation, ?super > ?r. This relation will generate bindings for at most one unbound argument.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Not documented.
Return the ?i-th ?arg of ?p (zero-based). Negative ?i’s count from the end, for example, -1 accesses the last argument of ?p.
Return all arguments of ?p as a list ?args.
Return the number of arguments in ?p.
Return the predicate operator ?op of ?p.
Search-control relation that allows one to prove or
retrieve bindings for ?prop with modified search control ?options. The list
of accepted ?options is currently the same as are legal for a top-level ask
or retrieve
query. The special option value :INHERIT inherits the option
value from the parent or top-level query. The option pair :INHERIT :ALL
inherits all parent options which can then be further modified by additional
individual option specifications. At most how many solutions will be generated
is controlled by the :HOW-MANY option (just like in the top level retrieve
).
The default is 1 which is again the same as for retrieve
but different from
how normal subgoals behave (those behave in a lazy all solutions mode).
The reason for this is that for partial match subqueries, solutions need to be
generated eagerly, therefore, a default of generating all solutions is not
desirable.
True if for any tuple 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).
Function that returns the cardinality of the set
of fillers of the relation ?r applied to ?i. The cardinality function
returns a value only when the relations 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.
Relation that specifies a lower bound on the cardinality
of the set of fillers of the relation ?r applied to ?i. The difference
between 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.
Relation that specifies an upper bound on the cardinality
of the set of fillers of the relation ?r applied to ?i. (see the discussion
for range-cardinality-lower-bound
).
Returns the strictest computable upper bound on the
cardinality of the set of fillers of the relation ?r applied to ?i.
(see the discussion for range-cardinality-lower-bound
).
Returns the strictest computable lower bound on the
cardinality of the set of fillers of the relation ?r applied to ?i.
(see the discussion for range-cardinality-lower-bound
).
Relation that specifies a type/range of the relation ?r applied to ?i. Multiple range types may be asserted for a single pair <?r,?i>. Technically, a retrieval of types for a given pair should include all supertypes (superconcepts) of any type that is produced, but for utility’s sake, only asserted or directly inferrable types are returned.
A binary relation ?r is reflexive if it is always true when both of its arguments are identical.
Query ?prop with :inference-level set to :refutation.
Equivalent to (query ?prop :inference-level :refutation)
but more efficient.
Not documented.
Not documented.
Names a 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.
Names a 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.
Names an 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 which might update the proposition, generate
additional assertions or trigger further evaluations. Evaluators have to
check the truth-value of the passed-in proposition and perform their actions
accordingly. An evaluated proposition might be true, false or even unknown
in case the propositon was just newly constructed.
Names a 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.
The class of scalar quantities.
An interval of scalar quantities.
Return the second element ?e of ?l.
Not documented.
Not documented.
Term-forming function that defines an enumerated set
consisting of all function arguments. setof
is like listof
except
that it removes duplicate values.
Query ?prop with :inference-level set to :shallow.
Equivalent to (query ?prop :inference-level :shallow)
but more efficient.
The relation ?c is single-valued if the value of its
last argument is a function of all other arguments. All functions
are single-valued (see function
).
Relation that returns the positive and negative square roots: ?y = sqrt(?x). For positive roots only see function SQRT.
Binds ?sd to the standard deviation of the numbers in ?l.
Concatenate ?x and zero or more strings ?y (variable arity) and bind ?z to the result. Coerces any type argument to a string if necessary.
Match ?pattern against ?object between ?start and ?end (zero-based),
and return the position of the first match or fail if no match exists. Supplying negative
numbers for ?start or ?end counts from the end of the string (see substring
). ?object can
be a named logic object or a string. ?pattern will eventually support regular expressions,
currently it only handles string literals. Apart from doing to-string coercion on ?object
this is somewhat redundant, since substring
can generate ?start/?end pairs if its string
and substring arguments are bound.
Case-insensitive version of string-match
(which see).
True iff ?sub is a subrelation of ?r; written in set notation, ?sub =< ?r. This relation will generate bindings for at most one unbound argument.
True if ?sub is a subset of ?super. For performance
reasons, the 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.
Generate the substring ?sub of ?s starting at position ?start (zero-based)
and ending just before position ?end. This is the PowerLoom equivalent to the STELLA method
subsequence
. Supplying negative numbers for ?start or ?end counts from the end of the
string where -1 indicates the end of ?s, -2 is one character from the end, etc.
If ?s and/or ?sub are not strings, they will be coerced first if possible. This function
supports any binding pattern where at most one input is unbound (except for ?s), or
where both ?start and ?end are unbound in which case it can locate all occurrences of the
?sub string in ?s. For example:
(retrieve all (?start ?end) (substring "foo" ?start ?end "o")) ==> ?start = 1, ?end = 2, ?start = 2, ?end = 3 |
Additional examples can be found in the test suite.
Query ?prop with :inference-level set to :subsumption.
Equivalent to (query ?prop :inference-level :subsumption)
but more efficient.
Binds ?sum to the sum of the numbers in the list ?l.
True iff ?super is a superrelation of ?r; written in set notation, ?super >= ?r. This relation will generate bindings for at most one unbound argument.
A binary relation ?r is symmetric if it is commutative.
Assert that ?synonym is a synonym of ?term. This causes all references to ?synonym to be interpreted as references to ?term. Retraction eliminates a synonym relation.
Defines a class that must be inherited by any class that participates in the PowerLoom side of things.
Not documented.
Return the third element ?e of ?l.
True if the function ?r is defined for all
combinations of inputs. By default, functions are not assumed to
be total (unlike Prolog, which 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))) |
A binary relation ?r is transitive if (?r ?x ?y) and (?r ?y ?z) implies that (?r ?x ?z). Note that functions cannot be transitive, since their single-valuedness would not allow multiple different values such as (?r ?x ?y) and (?r ?x ?z) due to the Unique Names Assumption made by PowerLoom.
True if ?x is a member of the concept ?c.
True if applying ?function to ?arguments
yields the value ?value
. The value
predicate is the analog
of holds
, except that it applies to functions instead of relations.
Asserts that the relation ?r can take a variable number of arguments.
Binds ?variance to the variance of the numbers in ?l.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Hans Chalupsky on January 6, 2023 using texi2html 1.82.