[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Built-In Relations

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: * ((?x NUMBER) (?y NUMBER)) :-> (?z NUMBER)

Function that multiplies two numbers.

Function: + ((?x NUMBER) (?y NUMBER)) :-> (?z NUMBER)

Function that adds two numbers.

Function: - ((?x NUMBER) (?y NUMBER)) :-> (?z NUMBER)

Function that subtracts two numbers.

Function: / ((?x NUMBER) (?y NUMBER)) :-> (?z NUMBER)

Function that divides two numbers.

Relation: < ((?x THING) (?y THING))

True if ?x < ?y.

Relation: =< ((?x THING) (?y THING))

True if ?x <= ?y.

Relation: > ((?x THING) (?y THING))

True if ?x > ?y.

Relation: >= ((?x THING) (?y THING))

True if ?x >= ?y.

Relation: ABSTRACT ((?r RELATION))

True if there are no direct assertions made to the relation ?r.

Concept: AGGREGATE ((?a AGGREGATE))

?a is an aggregate

Relation: ANTISYMMETRIC ((?r RELATION))

A binary relation ?r is antisymmetric if whenever (?r ?x ?y) is true (?r ?y ?x) is false unless ?x equals ?y.

Function: ARITY ((?r RELATION)) :-> (?arity INTEGER)

The number of arguments/domains of the relation ?r.

Relation: ASSERTION-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :assertion. Equivalent to (query ?prop :inference-level :assertion) but more efficient.

Relation: BACKTRACKING-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :backtracking. Equivalent to (query ?prop :inference-level :backtracking) but more efficient.

Concept: BINARY-RELATION ((?r RELATION))

The class of binary relations.

Relation: BOUND-VARIABLES ((?arguments THING))

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: CARDINALITY ((?c SET)) :-> (?card INTEGER)

Function that returns the cardinality of a set.

Relation: CLOSED ((?c COLLECTION))

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.

Function: COLLECT-INTO-ASCENDING-SET ((?c COLLECTION) (?sortby RELATION)) :-> (?orderedset LIST)

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.

Function: COLLECT-INTO-DESCENDING-SET ((?c COLLECTION) (?sortby RELATION)) :-> (?orderedset LIST)

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.

Function: COLLECT-INTO-LIST ((?c COLLECTION)) :-> (?l LIST)

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.

Function: COLLECT-INTO-ORDERED-SET ((?c COLLECTION)) :-> (?l LIST)

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.

Function: COLLECT-INTO-SET ((?c COLLECTION)) :-> (?l SET)

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.

Class: COLLECTION : ABSTRACT-COLLECTION

Not documented.

Class Parameter: any-value : OBJECT

Not documented.

Function: COLLECTIONOF ((?m THING)) :-> (?c COLLECTION)

Abstract function existing to subsume SETOF and LISTOF.

Relation: COMMENT ((?x THING) (?s STRING))

?s is a comment attached to ?x. Comments are a generalization of other annotations such as documentation and issue strings.

Relation: COMMUTATIVE ((?r RELATION))

A relation ?r is commutative if its truth value is invariant with any permutation of its arguments.

Concept: CONCEPT ((?x RELATION))

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: CONCEPT-PROTOTYPE ((?c CONCEPT)) :-> (?i THING)

Function that, given a concept, returns a prototypical instance that inherits all constraints that apply to any concept member, and has no additional constraints.

Class: CONTEXT : THING

Not documented.

Slot: child-contexts : (LIST OF CONTEXT)

Not documented.

Slot: base-module : MODULE

Not documented.

Slot: all-super-contexts : (CONS OF CONTEXT)

Not documented.

Slot: context-number : INTEGER

Not documented.

Function: OBJECT-CONTEXT ((?x THING)) :-> (?c CONTEXT)

Retrieve the home context of ?x where it was first referenced or defined.

Relation: COVERING ((?c COLLECTION) (?cover SET))

True if ?c is a subset of the union of all collections in the set ?cover (see disjoint-covering).

Relation: CUT ((?arguments THING))

Prolog-like CUT. Succeeds the first time and then fails. Side-effect: Locally disables query optimization.

Relation: DIRECT-SUBRELATION ((?r RELATION) (?sub RELATION))

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.

Relation: DIRECT-SUPERRELATION ((?r RELATION) (?super RELATION))

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.

Relation: DISJOINT ((?c1 COLLECTION) (?c2 COLLECTION))

True if the intersection of ?c1 and ?c2 is empty.

Relation: DISJOINT-COVERING ((?c COLLECTION) (?disjointcover SET))

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.

Relation: DOCUMENTATION ((?x THING) (?s STRING))

?s is a documentation string attached to ?x. Some of the PowerLoom text processing tools look for documentation strings and import them into documents.

Relation: DOMAIN ((?r RELATION) (?d COLLECTION))

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).

Relation: DUPLICATE-FREE ((?c COLLECTION))

?c is duplicate-free if no two members denote the same object.

Concept: DUPLICATE-FREE-COLLECTION ((?c COLLECTION))

?c is free of duplicates

Relation: EMPTY ((?c COLLECTION))

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.

Relation: EQUIVALENT-RELATION ((?r RELATION) (?equiv RELATION))

True if ?r is equivalent to ?equiv; written in set notation, ?r = ?equiv. This relation will generate bindings for at most one unbound argument.

Relation: EXAMPLE ((?r RELATION) (?e THING))

?e is an example of (the use of) ?r.

Function: FIFTH-ELEMENT ((?l COLLECTION)) :-> (?e THING)

Return the fifth element ?e of ?l.

Function: FILLERS ((?r RELATION) (?i THING)) :-> (?members SET)

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.

Function: FIRST-ELEMENT ((?l COLLECTION)) :-> (?e THING)

Return the first element ?e of ?l.

Relation: FORK ((?test PROPOSITION) (?then PROPOSITION) (?else PROPOSITION))

Fail-based conditional. If ?test succeeds, evaluates ?then; otherwise evaluates ?else.

Function: FOURTH-ELEMENT ((?l COLLECTION)) :-> (?e THING)

Return the fourth element ?e of ?l.

Concept: FRAME-PREDICATE ((?c RELATION))

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.

Class: METHOD-SLOT : SLOT

Not documented.

Slot: method-setter? : BOOLEAN

Not documented.

Slot: method-parameter-names : (LIST OF SYMBOL)

Not documented.

Slot: method-parameter-type-specifiers : (LIST OF TYPE-SPEC)

Not documented.

Slot: method-return-type-specifiers : (LIST OF TYPE-SPEC)

Not documented.

Slot: method-stringified-source : STRING

Not documented.

Slot: method-code : CODE-WRAPPER

Not documented.

Slot: function-code : FUNCTION-CODE

Not documented.

Slot: method-function? : BOOLEAN

Not documented.

Relation: GOES-FALSE-DEMON ((?r RELATION) (?computation COMPUTED-PROCEDURE))

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.

Relation: GOES-TRUE-DEMON ((?r RELATION) (?computation COMPUTED-PROCEDURE))

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.

Relation: GOES-UNKNOWN-DEMON ((?r RELATION) (?computation COMPUTED-PROCEDURE))

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.

Relation: HOLDS ((?relation RELATION) (?arguments THING))

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.

Relation: IMAGE-URL ((?x THING) (?url STRING))

?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.

Relation: INEQUALITY ((?x THING) (?y THING))

Abstract superrelation of inequality relations.

Function: INSERT-ELEMENT ((?l LIST) (?n INTEGER) (?e THING)) :-> (?r LIST)

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.

Relation: INSTANCE-OF ((?x THING) (?c COLLECTION))

True if ?x is an instance of ?c. Can be used to generate concept values of ?c, given an instance ?x.

Function: INVERSE ((?r BINARY-RELATION)) :-> (?inverserelation THING)

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.

Relation: IRREFLEXIVE ((?r RELATION))

A binary relation ?r is irreflexive if it is false when both of its arguments are identical.

Relation: ISSUE ((?x THING) (?s STRING))

?s is an issue attached to ?x. An issue string normally comments on a topic that has not been resolved to everyone’s satisfaction.

Relation: IST ((?context CONTEXT) (?p PROPOSITION))

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: LENGTH ((?x THING)) :-> (?z INTEGER)

Function that returns the length of a string or a logical list.

Function: LENGTH ((?x THING)) :-> (?z INTEGER)

Function that returns the length of a string or a logical list.

Relation: LEXEME ((?r THING) (?s STRING))

?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.

Class: LIST : SEQUENCE

Not documented.

Class Parameter: any-value : OBJECT

Not documented.

Slot: the-cons-list : (CONS OF (LIKE (ANY-VALUE SELF)))

Not documented.

Function: LIST-CONCATENATE ((?x COLLECTION) (?y COLLECTION)) :-> (?r LIST)

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.

Function: LISTOF ((?m THING)) :-> (?c LIST)

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.

Relation: MAXIMUM-ELEMENT ((?c COLLECTION) (?sortby RELATION) (?element THING))

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).

Relation: MAXIMUM-VALUE ((?l COLLECTION) (?max NUMBER))

Binds ?max to the maximum of the numbers in the list ?l.

Relation: MEAN-VALUE ((?l COLLECTION) (?mean NUMBER))

Binds ?mean to the mean of the numbers in ?l.

Relation: MEDIAN-VALUE ((?l COLLECTION) (?median NUMBER))

Binds ?median to the median of the numbers in ?l.

Relation: MEMBER-OF ((?x THING) (?c COLLECTION))

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).

Relation: MINIMUM-ELEMENT ((?c COLLECTION) (?sortby RELATION) (?element THING))

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).

Relation: MINIMUM-VALUE ((?l COLLECTION) (?min NUMBER))

Binds ?min to the minimum of the numbers in the list ?l.

Relation: MUTUALLY-DISJOINT-COLLECTION ((?s SET))

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.

Function: NAME-TO-OBJECT ((?n THING)) :-> (?o THING)

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.

Relation: NORMAL-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :normal. Equivalent to (query ?prop :inference-level :normal) but more efficient.

Relation: NTH-DOMAIN ((?r RELATION) (?i INTEGER) (?d COLLECTION))

True if the nth value for a tuple T satisfying ?r must belong to the concept ?d. Argument counting starts at zero.

Function: NTH-ELEMENT ((?l COLLECTION) (?n INTEGER)) :-> (?e THING)

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.

Function: NTH-HEAD ((?l LIST) (?n INTEGER)) :-> (?h LIST)

Return the ?n head elements ?h of ?l. Count from end of the list if ?n is negative.

Function: NTH-REST ((?l LIST) (?n INTEGER)) :-> (?r LIST)

Return the ?n-th rest ?r of ?l (zero-based). Count from end of the list if ?n is negative.

Relation: NUMERIC-MAXIMUM ((?r RELATION) (?i THING) (?n NUMBER))

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: NUMERIC-MINIMUM ((?r RELATION) (?i THING) (?n NUMBER))

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.

Concept: NUMERIC-SET ((?s COLLECTION))

?s is a set of numbers

Function: OBJECT-NAME ((?x THING)) :-> (?c STRING)

The name of the object ?X as a string. This is just the name, with module prefixes NOT included.

Relation: ORDERED ((?c COLLECTION))

?c is ordered if the ordering of its members is significant. Lists are ordered, while sets are not.

Relation: PHRASE ((?r THING) (?s STRING))

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.

Function: PROJECT-COLUMN ((?i INTEGER) (?c COLLECTION)) :-> (?l LIST)

Project elements in column ?i (zero-based) of the tuples of ?c and collect them into a list ?l.

Relation: PROPER-SUBRELATION ((?r RELATION) (?sub RELATION))

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.

Relation: PROPER-SUPERRELATION ((?r RELATION) (?super RELATION))

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.

Class: PROPOSITION : CONTEXT-SENSITIVE-OBJECT, DYNAMIC-SLOTS-MIXIN, BACKLINKS-MIXIN
Slot: home-context : CONTEXT

Not documented.

Slot: kind : KEYWORD

Not documented.

Slot: truth-value : TRUTH-VALUE

Not documented.

Slot: arguments : VECTOR

Not documented.

Slot: operator : GENERALIZED-SYMBOL

Not documented.

Slot: dependent-propositions : (NON-PAGING-INDEX OF PROPOSITION)

Not documented.

Function: PROPOSITION-ARGUMENT ((?p PROPOSITION) (?i INTEGER)) :-> (?arg THING)

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.

Function: PROPOSITION-ARGUMENTS ((?p PROPOSITION)) :-> (?args LIST)

Return all arguments of ?p as a list ?args.

Function: PROPOSITION-ARITY ((?p PROPOSITION)) :-> (?arity INTEGER)

Return the number of arguments in ?p.

Function: PROPOSITION-RELATION ((?p PROPOSITION)) :-> (?op RELATION)

Return the predicate operator ?op of ?p.

Relation: QUERY ((?prop PROPOSITION) (?options THING))

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.

Relation: RANGE ((?r RELATION) (?rng COLLECTION))

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: RANGE-CARDINALITY ((?r RELATION) (?i THING)) :-> (?card INTEGER)

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: RANGE-CARDINALITY-LOWER-BOUND ((?r RELATION) (?i THING) (?lb INTEGER))

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: RANGE-CARDINALITY-UPPER-BOUND ((?r RELATION) (?i THING) (?ub INTEGER))

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).

Function: RANGE-MAX-CARDINALITY ((?r RELATION) (?i THING)) :-> (?maxcard INTEGER)

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).

Function: RANGE-MIN-CARDINALITY ((?r RELATION) (?i THING)) :-> (?mincard INTEGER)

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: RANGE-TYPE ((?r RELATION) (?i THING) (?type COLLECTION))

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.

Relation: REFLEXIVE ((?r RELATION))

A binary relation ?r is reflexive if it is always true when both of its arguments are identical.

Relation: REFUTATION-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :refutation. Equivalent to (query ?prop :inference-level :refutation) but more efficient.

Class: RELATION : MAPPABLE-OBJECT

Not documented.

Slot: abstract? : BOOLEAN

Not documented.

Relation: RELATION-COMPUTATION ((?r RELATION) (?computation COMPUTED-PROCEDURE))

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.

Relation: RELATION-CONSTRAINT ((?r RELATION) (?computation COMPUTED-PROCEDURE))

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.

Relation: RELATION-EVALUATOR ((?r RELATION) (?ev COMPUTED-PROCEDURE))

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.

Relation: RELATION-SPECIALIST ((?r RELATION) (?sp COMPUTED-PROCEDURE))

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.

Concept: SCALAR ((?x SCALAR))

The class of scalar quantities.

Concept: SCALAR-INTERVAL ((?x SCALAR))

An interval of scalar quantities.

Function: SECOND-ELEMENT ((?l COLLECTION)) :-> (?e THING)

Return the second element ?e of ?l.

Class: SET : LIST, SET-MIXIN

Not documented.

Class Parameter: any-value : OBJECT

Not documented.

Function: SETOF ((?m THING)) :-> (?c SET)

Term-forming function that defines an enumerated set consisting of all function arguments. setof is like listof except that it removes duplicate values.

Relation: SHALLOW-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :shallow. Equivalent to (query ?prop :inference-level :shallow) but more efficient.

Relation: SINGLE-VALUED ((?c RELATION))

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: SQUARE-ROOT ((?x NUMBER) (?y NUMBER))

Relation that returns the positive and negative square roots: ?y = sqrt(?x). For positive roots only see function SQRT.

Relation: STANDARD-DEVIATION ((?l COLLECTION) (?sd NUMBER))

Binds ?sd to the standard deviation of the numbers in ?l.

Function: STRING-CONCATENATE ((?x THING) (?y THING)) :-> (?z STRING)

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.

Function: STRING-MATCH ((?pattern STRING) (?object THING) (?start INTEGER) (?end INTEGER)) :-> (?match-position INTEGER)

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.

Function: STRING-MATCH-IGNORE-CASE ((?pattern STRING) (?object THING) (?start INTEGER) (?end INTEGER)) :-> (?match-position INTEGER)

Case-insensitive version of string-match (which see).

Relation: SUBRELATION ((?r RELATION) (?sub RELATION))

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.

Relation: SUBSET-OF ((?sub COLLECTION) (?super COLLECTION))

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.

Function: SUBSTRING ((?s THING) (?start INTEGER) (?end INTEGER)) :-> (?sub THING)

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.

Relation: SUBSUMPTION-QUERY ((?prop PROPOSITION))

Query ?prop with :inference-level set to :subsumption. Equivalent to (query ?prop :inference-level :subsumption) but more efficient.

Relation: SUM ((?l COLLECTION) (?sum NUMBER))

Binds ?sum to the sum of the numbers in the list ?l.

Relation: SUPERRELATION ((?r RELATION) (?super RELATION))

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.

Relation: SYMMETRIC ((?r RELATION))

A binary relation ?r is symmetric if it is commutative.

Relation: SYNONYM ((?term THING) (?synonym THING))

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.

Class: THING : STANDARD-OBJECT, DYNAMIC-SLOTS-MIXIN

Defines a class that must be inherited by any class that participates in the PowerLoom side of things.

Slot: surrogate-value-inverse : SURROGATE

Not documented.

Function: THIRD-ELEMENT ((?l COLLECTION)) :-> (?e THING)

Return the third element ?e of ?l.

Relation: TOTAL ((?r FUNCTION))

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)))
Relation: TRANSITIVE ((?r RELATION))

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.

Relation: TYPE-OF ((?c COLLECTION) (?x THING))

True if ?x is a member of the concept ?c.

Function: VALUE ((?function FUNCTION) (?arguments THING)) :-> (?value THING)

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.

Relation: VARIABLE-ARITY ((?r RELATION))

Asserts that the relation ?r can take a variable number of arguments.

Relation: VARIANCE ((?l COLLECTION) (?variance NUMBER))

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.