docs
This commit is contained in:
parent
7063641a5b
commit
70232133cc
11
C/atomic.c
11
C/atomic.c
@ -18,11 +18,14 @@
|
|||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @addgroup Predicates_on_Atoms Predicates on Atoms and Strings
|
/**
|
||||||
@ingroup YAPChars
|
* @file atomic.c
|
||||||
@{
|
*
|
||||||
|
* @defgroup Predicates_on_Atoms Predicates on Atoms and Strings
|
||||||
|
* @ingroup builtins
|
||||||
|
* @{
|
||||||
|
|
||||||
The following predicates are used to manipulate atoms:
|
@brief The following predicates are used to manipulate atoms, strings, lists of codes and lists of chars:
|
||||||
|
|
||||||
\toc
|
\toc
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
0/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* YAP Prolog *
|
* YAP Prolog *
|
||||||
* *
|
* *
|
||||||
@ -28,11 +28,11 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#define NULL (void *)0
|
#define NULL (void *)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file attvar.c
|
@file attvar.c
|
||||||
@{
|
|
||||||
@defgroup AttributeVariables_Builtins Implementation of Attribute Declarations
|
@defgroup AttributeVariables_Builtins Implementation of Attribute Declarations
|
||||||
@ingroup AttributeVariables
|
@{
|
||||||
|
@ingroup attributes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file c_interface.c
|
* @file c_interface.c
|
||||||
|
*
|
||||||
|
* @addtogroup ChYInterface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef C_INTERFACE_C
|
#ifndef C_INTERFACE_C
|
||||||
@ -175,11 +177,6 @@ X_API void YAP_SlotsToArgs(int HowMany, YAP_handle_t slot);
|
|||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/**
|
|
||||||
@addtogroup c-interface
|
|
||||||
@{
|
|
||||||
*/
|
|
||||||
|
|
||||||
static arity_t current_arity(void) {
|
static arity_t current_arity(void) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
if (P && PREVOP(P, Osbpp)->opc == Yap_opcode(_call_usercpred)) {
|
if (P && PREVOP(P, Osbpp)->opc == Yap_opcode(_call_usercpred)) {
|
||||||
|
2
C/init.c
2
C/init.c
@ -103,7 +103,7 @@ void *YAP_save;
|
|||||||
/**
|
/**
|
||||||
|
|
||||||
@defgroup Operators Summary of YAP Predefined Operators
|
@defgroup Operators Summary of YAP Predefined Operators
|
||||||
@ingroup Syntax
|
@ingroup YAPSyntax
|
||||||
@{
|
@{
|
||||||
|
|
||||||
The Prolog syntax caters for operators of three main kinds:
|
The Prolog syntax caters for operators of three main kinds:
|
||||||
|
@ -20,17 +20,14 @@ static char SccsId[] = "%W% %G%";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@defgroup YAPSyntax YAP Syntax
|
@addtogroup YAPSyntax
|
||||||
@ingroup YAPProgramming
|
|
||||||
@{
|
|
||||||
|
|
||||||
We will describe the syntax of YAP at two levels. We first will
|
|
||||||
describe the syntax for Prolog terms. In a second level we describe
|
describe the syntax for Prolog terms. In a second level we describe
|
||||||
the \a tokens from which Prolog \a terms are
|
the \a tokens from which Prolog \a terms are
|
||||||
built.
|
built.
|
||||||
|
|
||||||
@defgroup Formal_Syntax Syntax of Terms
|
@defgroup Formal_Syntax Syntax of Terms
|
||||||
@ingroup Syntax
|
@ingroup YAPSyntax
|
||||||
@{
|
@{
|
||||||
|
|
||||||
Below, we describe the syntax of YAP terms from the different
|
Below, we describe the syntax of YAP terms from the different
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
/**
|
/**
|
||||||
|
|
||||||
@defgroup Formal_Syntax Syntax of Terms
|
@defgroup Formal_Syntax Syntax of Terms
|
||||||
@ingroup Syntax
|
@ingroup YAPSyntax
|
||||||
@{
|
@{
|
||||||
|
|
||||||
|
|
||||||
|
298
C/utilpreds.c
298
C/utilpreds.c
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/** @file YapFlags.h
|
/** @file YapFlags.h
|
||||||
|
|
||||||
@ingroup Flags
|
@addtogroup Flags
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef YAP_FLAGS_H
|
#ifndef YAP_FLAGS_H
|
||||||
|
@ -17,25 +17,24 @@
|
|||||||
|
|
||||||
/** @file YapGFlagInfo.h
|
/** @file YapGFlagInfo.h
|
||||||
|
|
||||||
@ingroup Flags
|
@addtogroup YAPFlags
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @pred yap_flag(? _Param_,? _Value_)
|
/** @pred yap_flag( ?Param, ?Value)
|
||||||
|
|
||||||
|
|
||||||
Set or read system properties for _Param_:
|
Set or read system properties for _Param_:
|
||||||
|
|
||||||
|
@enum YapGFlag Prolog
|
||||||
|
@Brief global flag:
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// `address_bits`
|
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL), /**< `address_bits`
|
||||||
///
|
Number of address bits in the machine, either 64 or 32 bits */
|
||||||
/// Number of address bits in the machine, either 64 or 32 bits.
|
|
||||||
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, NULL)
|
|
||||||
, /** `address_bits`
|
|
||||||
Number of address bits in the machine, either 64 or 32 bits */
|
|
||||||
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
|
|
||||||
agc_threshold), /**`agc_margin `
|
|
||||||
|
|
||||||
|
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
|
||||||
|
agc_threshold), /**< `agc_margin`
|
||||||
An integer: if this amount of atoms has been created since the last
|
An integer: if this amount of atoms has been created since the last
|
||||||
atom-garbage collection, perform atom garbage collection at the first
|
atom-garbage collection, perform atom garbage collection at the first
|
||||||
opportunity. Initial value is 10,000. May be changed. A value of 0
|
opportunity. Initial value is 10,000. May be changed. A value of 0
|
||||||
|
@ -17,35 +17,35 @@
|
|||||||
|
|
||||||
/** @file YapLFlagInfo.h
|
/** @file YapLFlagInfo.h
|
||||||
|
|
||||||
@ingroup Flags
|
@addtogroup Flags
|
||||||
*/
|
*/
|
||||||
|
|
||||||
YAP_FLAG( AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false" , NULL ),
|
YAP_FLAG( AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false" , NULL ),
|
||||||
YAP_FLAG( BREAK_LEVEL_FLAG, "break_level", true, nat, "0" , NULL ),
|
YAP_FLAG( BREAK_LEVEL_FLAG, "break_level", true, nat, "0" , NULL ),
|
||||||
YAP_FLAG( CALL_COUNTING_FLAG, "call_counting", true, booleanFlag, "true" , NULL ), /**< `call_counting`
|
YAP_FLAG( CALL_COUNTING_FLAG, "call_counting", true, booleanFlag, "true" , NULL ), /** + `call_counting`
|
||||||
|
|
||||||
Predicates compiled with this flag set maintain a counter on the numbers of proceduree calls and of retries. These counters are decreasing counters, and they can be used as timers. Three counters are available:
|
Predicates compiled with this flag set maintain a counter on the numbers of proceduree calls and of retries. These counters are decreasing counters, and they can be used as timers. Three counters are available:
|
||||||
|
|
||||||
calls: number of predicate calls since execution started or since system was reset;
|
calls: number of predicate calls since execution started or since system was reset;
|
||||||
retries: number of retries for predicates called since execution started or since counters were reset;
|
retries: number of retries for predicates called since execution started or since counters were reset;
|
||||||
calls_and_retries: count both on predicate calls and retries.
|
calls_and_retries: count both on predicate calls and retries.
|
||||||
These counters can be used to find out how many calls a certain goal takes to execute. They can also be force the computatiom yp
|
These counters can be used to find out how many calls a certain goal takes to execute. They can also be force the computatiom yp
|
||||||
stopping.
|
stopping.
|
||||||
|
|
||||||
If `on` `fileerrors` is `on`, if `off` (default)
|
If `on` `fileerrors` is `on`, if `off` (default)
|
||||||
`fileerrors` is disabled.
|
`fileerrors` is disabled.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( ENCODING_FLAG, "encoding", true, isatom, "utf-8" , getenc ),
|
YAP_FLAG( ENCODING_FLAG, "encoding", true, isatom, "utf-8" , getenc ),
|
||||||
YAP_FLAG( FILEERRORS_FLAG, "fileerrors", true, booleanFlag, "true" , NULL ), /**< `fileerrors`
|
YAP_FLAG( FILEERRORS_FLAG, "fileerrors", true, booleanFlag, "true" , NULL ), /** + `fileerrors`
|
||||||
|
|
||||||
If `on` `fileerrors` is `on`, if `off` (default)
|
If `on` `fileerrors` is `on`, if `off` (default)
|
||||||
`fileerrors` is disabled.
|
`fileerrors` is disabled.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap" , NULL ), /**< `language_mode`
|
YAP_FLAG( LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap" , NULL ), /** + `language_mode`
|
||||||
|
|
||||||
wweter native mode or trying to emulate a different Prolog.
|
wweter native mode or trying to emulate a different Prolog.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( REDEFINE_WARNINGS_FLAG, "redefine_warnings", true, booleanFlag, "true" , NULL ), /**< `redefine_warnings `
|
YAP_FLAG( REDEFINE_WARNINGS_FLAG, "redefine_warnings", true, booleanFlag, "true" , NULL ), /** + `redefine_warnings `
|
||||||
|
|
||||||
If _Value_ is unbound, tell whether warnings for procedures defined
|
If _Value_ is unbound, tell whether warnings for procedures defined
|
||||||
in several different files are `on` or
|
in several different files are `on` or
|
||||||
@ -53,17 +53,17 @@ in several different files are `on` or
|
|||||||
and if it is bound to `off` disable them. The default for YAP is
|
and if it is bound to `off` disable them. The default for YAP is
|
||||||
`off`, unless we are in `sicstus` or `iso` mode.
|
`off`, unless we are in `sicstus` or `iso` mode.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( SINGLE_VAR_WARNINGS_FLAG, "single_var_warnings", true, booleanFlag, "true" , NULL ), /**< `single_var_warnings`
|
YAP_FLAG( SINGLE_VAR_WARNINGS_FLAG, "single_var_warnings", true, booleanFlag, "true" , NULL ), /** + `single_var_warnings`
|
||||||
If `true` (default `true`) YAP checks for singleton variables when loading files. A singleton variable is a variable that appears ony once in a clause. The name must start with a capital letter, variables whose name starts with underscore are never considered singleton.
|
If `true` (default `true`) YAP checks for singleton variables when loading files. A singleton variable is a variable that appears ony once in a clause. The name must start with a capital letter, variables whose name starts with underscore are never considered singleton.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", true, booleanFlag, "false" , NULL ), /**< `stack_dump_on_error `
|
YAP_FLAG( STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", true, booleanFlag, "false" , NULL ), /** + `stack_dump_on_error `
|
||||||
|
|
||||||
If `true` show a stack dump when YAP finds an error. The default is
|
If `true` show a stack dump when YAP finds an error. The default is
|
||||||
`off`.
|
`off`.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( STREAM_TYPE_CHECK_FLAG, "stream_type_check", true, isatom, "loose" , NULL ),
|
YAP_FLAG( STREAM_TYPE_CHECK_FLAG, "stream_type_check", true, isatom, "loose" , NULL ),
|
||||||
YAP_FLAG( SYNTAX_ERRORS_FLAG, "syntax_errors", true, synerr, "error" , NULL ), /**< `syntax_errors`
|
YAP_FLAG( SYNTAX_ERRORS_FLAG, "syntax_errors", true, synerr, "error" , NULL ), /** + `syntax_errors`
|
||||||
|
|
||||||
Control action to be taken after syntax errors while executing read/1,
|
Control action to be taken after syntax errors while executing read/1,
|
||||||
`read/2`, or `read_term/3`:
|
`read/2`, or `read_term/3`:
|
||||||
@ -76,14 +76,14 @@ Report the syntax error and generate an error (default).
|
|||||||
+ `quiet`
|
+ `quiet`
|
||||||
Just fail
|
Just fail
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( TYPEIN_MODULE_FLAG, "typein_module", true, isatom, "user" , typein ), /**< `typein_module `
|
YAP_FLAG( TYPEIN_MODULE_FLAG, "typein_module", true, isatom, "user" , typein ), /** + `typein_module `
|
||||||
|
|
||||||
If bound, set the current working or type-in module to the argument,
|
If bound, set the current working or type-in module to the argument,
|
||||||
which must be an atom. If unbound, unify the argument with the current
|
which must be an atom. If unbound, unify the argument with the current
|
||||||
working module.
|
working module.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
YAP_FLAG( USER_ERROR_FLAG, "user_error", true, stream, "user_error" , set_error_stream ), /**< `user_error1`
|
YAP_FLAG( USER_ERROR_FLAG, "user_error", true, stream, "user_error" , set_error_stream ), /** + `user_error1`
|
||||||
|
|
||||||
If the second argument is bound to a stream, set user_error to
|
If the second argument is bound to a stream, set user_error to
|
||||||
this stream. If the second argument is unbound, unify the argument with
|
this stream. If the second argument is unbound, unify the argument with
|
||||||
@ -104,7 +104,7 @@ The next example shows how to use this flag:
|
|||||||
close(mauri_tripa).
|
close(mauri_tripa).
|
||||||
|
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~
|
~~~
|
||||||
We execute three commands. First, we open a stream in write mode and
|
We execute three commands. First, we open a stream in write mode and
|
||||||
give it an alias, in this case `mauri_tripa`. Next, we set
|
give it an alias, in this case `mauri_tripa`. Next, we set
|
||||||
|
12
H/qly.h
12
H/qly.h
@ -18,11 +18,13 @@
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @file qly.h
|
* @file qly.h
|
||||||
*
|
*
|
||||||
|
|
||||||
* @defgroup SaveRestoreSupport C-support for saved states.
|
* @defgroup SaveRestoreSupport C-support for saved states.
|
||||||
* @ingroup YAPSaving
|
* @ingroup QLY
|
||||||
|
* @{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -137,3 +139,5 @@ typedef enum {
|
|||||||
|
|
||||||
#define AllocTempSpace() (HR)
|
#define AllocTempSpace() (HR)
|
||||||
#define EnoughTempSpace(sz) ((ASP - HR) * sizeof(CELL) > sz)
|
#define EnoughTempSpace(sz) ((ASP - HR) * sizeof(CELL) > sz)
|
||||||
|
|
||||||
|
/// @} @}
|
||||||
|
@ -1356,42 +1356,42 @@
|
|||||||
|
|
||||||
|
|
||||||
answer_resolution:
|
answer_resolution:
|
||||||
dep_fr_ptr dep_fr;
|
INIT_PREFETCH()
|
||||||
ans_node_ptr ans_node;
|
dep_fr_ptr dep_fr;
|
||||||
INIT_PREFETCH();
|
ans_node_ptr ans_node;
|
||||||
|
|
||||||
OPTYAP_ERROR_CHECKING(answer_resolution, SCH_top_shared_cp(B) && B->cp_or_fr->alternative != ANSWER_RESOLUTION);
|
OPTYAP_ERROR_CHECKING(answer_resolution, SCH_top_shared_cp(B) && B->cp_or_fr->alternative != ANSWER_RESOLUTION);
|
||||||
OPTYAP_ERROR_CHECKING(answer_resolution, !SCH_top_shared_cp(B) && B->cp_ap != ANSWER_RESOLUTION);
|
OPTYAP_ERROR_CHECKING(answer_resolution, !SCH_top_shared_cp(B) && B->cp_ap != ANSWER_RESOLUTION);
|
||||||
dep_fr = CONS_CP(B)->cp_dep_fr;
|
dep_fr = CONS_CP(B)->cp_dep_fr;
|
||||||
LOCK_DEP_FR(dep_fr);
|
LOCK_DEP_FR(dep_fr);
|
||||||
ans_node = DepFr_last_answer(dep_fr);
|
ans_node = DepFr_last_answer(dep_fr);
|
||||||
if (TrNode_child(ans_node)) {
|
if (TrNode_child(ans_node)) {
|
||||||
/* unconsumed answers */
|
/* unconsumed answers */
|
||||||
#ifdef MODE_DIRECTED_TABLING
|
#ifdef MODE_DIRECTED_TABLING
|
||||||
if (IS_ANSWER_INVALID_NODE(TrNode_child(ans_node))) {
|
if (IS_ANSWER_INVALID_NODE(TrNode_child(ans_node))) {
|
||||||
ans_node_ptr old_ans_node;
|
ans_node_ptr old_ans_node;
|
||||||
old_ans_node = ans_node;
|
old_ans_node = ans_node;
|
||||||
ans_node = TrNode_child(ans_node);
|
|
||||||
do {
|
|
||||||
ans_node = TrNode_child(ans_node);
|
ans_node = TrNode_child(ans_node);
|
||||||
} while (IS_ANSWER_INVALID_NODE(ans_node));
|
do {
|
||||||
TrNode_child(old_ans_node) = ans_node;
|
ans_node = TrNode_child(ans_node);
|
||||||
} else
|
} while (IS_ANSWER_INVALID_NODE(ans_node));
|
||||||
|
TrNode_child(old_ans_node) = ans_node;
|
||||||
|
} else
|
||||||
#endif /* MODE_DIRECTED_TABLING */
|
#endif /* MODE_DIRECTED_TABLING */
|
||||||
ans_node = TrNode_child(ans_node);
|
ans_node = TrNode_child(ans_node);
|
||||||
DepFr_last_answer(dep_fr) = ans_node;
|
DepFr_last_answer(dep_fr) = ans_node;
|
||||||
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
|
consume_answer_and_procceed(dep_fr, ans_node);
|
||||||
|
}
|
||||||
UNLOCK_DEP_FR(dep_fr);
|
UNLOCK_DEP_FR(dep_fr);
|
||||||
consume_answer_and_procceed(dep_fr, ans_node);
|
|
||||||
}
|
|
||||||
UNLOCK_DEP_FR(dep_fr);
|
|
||||||
|
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
if (B == DepFr_leader_cp(LOCAL_top_dep_fr)) {
|
if (B == DepFr_leader_cp(LOCAL_top_dep_fr)) {
|
||||||
/* B is a generator-consumer node **
|
/* B is a generator-consumer node **
|
||||||
** never here if batched scheduling */
|
** never here if batched scheduling */
|
||||||
TABLING_ERROR_CHECKING(answer_resolution, IS_BATCHED_GEN_CP(B));
|
TABLING_ERROR_CHECKING(answer_resolution, IS_BATCHED_GEN_CP(B));
|
||||||
goto completion;
|
goto completion;
|
||||||
}
|
}
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
|
|
||||||
/* no unconsumed answers */
|
/* no unconsumed answers */
|
||||||
@ -1664,14 +1664,14 @@
|
|||||||
#ifdef THREADS_CONSUMER_SHARING
|
#ifdef THREADS_CONSUMER_SHARING
|
||||||
goto answer_resolution_completion;
|
goto answer_resolution_completion;
|
||||||
#endif /* THREADS_CONSUMER_SHARING */
|
#endif /* THREADS_CONSUMER_SHARING */
|
||||||
dep_fr_ptr dep_fr;
|
INIT_PREFETCH()
|
||||||
ans_node_ptr ans_node;
|
dep_fr_ptr dep_fr;
|
||||||
|
ans_node_ptr ans_node;
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
long timestamp = 0;
|
long timestamp = 0;
|
||||||
#endif /* TIMESTAMP_CHECK */
|
#endif /* TIMESTAMP_CHECK */
|
||||||
int entry_owners = 0;
|
int entry_owners = 0;
|
||||||
INIT_PREFETCH();
|
|
||||||
|
|
||||||
if (SCH_top_shared_cp(B)) {
|
if (SCH_top_shared_cp(B)) {
|
||||||
#ifdef TIMESTAMP_CHECK
|
#ifdef TIMESTAMP_CHECK
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||

|

|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
User Manual for YAP6 (#main)
|
|
||||||
====================
|
|
||||||
|
|
||||||
NOTE: this version of YAP is still experimental, documentation may be out of date.
|
NOTE: this version of YAP is still experimental, documentation may be out of date.
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
@ -39,6 +36,10 @@ Springer-Verlag.
|
|||||||
YAP 6.3.4 has been built with the gcc and clang compilers on Linux and OSX machines. We expect to recover support for WIN32 machines and
|
YAP 6.3.4 has been built with the gcc and clang compilers on Linux and OSX machines. We expect to recover support for WIN32 machines and
|
||||||
Android next.
|
Android next.
|
||||||
|
|
||||||
|
We are happy to include in YAP several excellent packages developed
|
||||||
|
under separate licenses. Our thanks to the authors for their kind
|
||||||
|
authorization to include these packages.
|
||||||
|
|
||||||
The overall copyright and permission notice for YAP4.3 can be found in
|
The overall copyright and permission notice for YAP4.3 can be found in
|
||||||
the Artistic file in this directory. YAP follows the Perl Artistic
|
the Artistic file in this directory. YAP follows the Perl Artistic
|
||||||
license, and it is thus non-copylefted freeware. Some components of YAP have been obtained from SWI Prolog and ciao, and have
|
license, and it is thus non-copylefted freeware. Some components of YAP have been obtained from SWI Prolog and ciao, and have
|
||||||
@ -54,10 +55,6 @@ On-line documentation is available for [YAP](http://www.dcc.fp.pt/~vsc/yap/)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
We are happy to include in YAP several excellent packages developed
|
|
||||||
under separate licenses. Our thanks to the authors for their kind
|
|
||||||
authorization to include these packages.
|
|
||||||
|
|
||||||
The packages are, in alphabetical order:
|
The packages are, in alphabetical order:
|
||||||
|
|
||||||
+ The CHR package developed by Tom Schrijvers,
|
+ The CHR package developed by Tom Schrijvers,
|
@ -1,4 +1,4 @@
|
|||||||
/****************************************************************************
|
l/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
|
** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com>
|
||||||
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
|
** Copyright (C) 2012 Laszlo Papp <lpapp@kde.org>
|
||||||
|
@ -522,14 +522,14 @@ CASE_SENSE_NAMES = NO
|
|||||||
# scope will be hidden.
|
# scope will be hidden.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HIDE_SCOPE_NAMES = NO
|
HIDE_SCOPE_NAMES = YES
|
||||||
|
|
||||||
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
|
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
|
||||||
# append additional text to a page's title, such as Class Reference. If set to
|
# append additional text to a page's title, such as Class Reference. If set to
|
||||||
# YES the compound reference will be hidden.
|
# YES the compound reference will be hidden.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HIDE_COMPOUND_REFERENCE= NO
|
HIDE_COMPOUND_REFERENCE= YES
|
||||||
|
|
||||||
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
||||||
# the files that are included by a file in the documentation of that file.
|
# the files that are included by a file in the documentation of that file.
|
||||||
@ -775,7 +775,8 @@ WARN_LOGFILE =
|
|||||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = @PROJECT_SOURCE_DIR@/pl \
|
INPUT = @PROJECT_SOURCE_DIR@/INSTALL.md \
|
||||||
|
@PROJECT_SOURCE_DIR@/pl \
|
||||||
@PROJECT_SOURCE_DIR@/CXX \
|
@PROJECT_SOURCE_DIR@/CXX \
|
||||||
@PROJECT_SOURCE_DIR@/OPTYap \
|
@PROJECT_SOURCE_DIR@/OPTYap \
|
||||||
@PROJECT_SOURCE_DIR@/C \
|
@PROJECT_SOURCE_DIR@/C \
|
||||||
@ -784,9 +785,8 @@ INPUT = @PROJECT_SOURCE_DIR@/pl \
|
|||||||
@PROJECT_SOURCE_DIR@/os \
|
@PROJECT_SOURCE_DIR@/os \
|
||||||
@PROJECT_SOURCE_DIR@/library \
|
@PROJECT_SOURCE_DIR@/library \
|
||||||
@PROJECT_SOURCE_DIR@/packages \
|
@PROJECT_SOURCE_DIR@/packages \
|
||||||
@PROJECT_SOURCE_DIR@/swi/library
|
@PROJECT_SOURCE_DIR@/swi/library \
|
||||||
# @PROJECT_SOURCE_DIR@/docs/md \
|
@PROJECT_SOURCE_DIR@/docs/md \
|
||||||
# @PROJECT_SOURCE_DIR@/INSTALL.md
|
|
||||||
|
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
@ -844,6 +844,7 @@ EXCLUDE = *pltotex.pl \
|
|||||||
@PROJECT_SOURCE_DIR@/packages/CLPBN/examples \
|
@PROJECT_SOURCE_DIR@/packages/CLPBN/examples \
|
||||||
@PROJECT_SOURCE_DIR@/packages/prosqlite \
|
@PROJECT_SOURCE_DIR@/packages/prosqlite \
|
||||||
@PROJECT_SOURCE_DIR@/packages/pyswip \
|
@PROJECT_SOURCE_DIR@/packages/pyswip \
|
||||||
|
@PROJECT_SOURCE_DIR@/library/dialect/swi/os
|
||||||
|
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||||
@ -860,7 +861,13 @@ EXCLUDE_SYMLINKS = NO
|
|||||||
# Note that the wildcards are matched against the file with absolute path, so to
|
# Note that the wildcards are matched against the file with absolute path, so to
|
||||||
# exclude all test directories for example use the pattern */test/*
|
# exclude all test directories for example use the pattern */test/*
|
||||||
|
|
||||||
EXCLUDE_PATTERNS = */CMakeFiles/* *~
|
EXCLUDE_PATTERNS = \
|
||||||
|
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap.cc \
|
||||||
|
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap.cc \
|
||||||
|
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3.yap \
|
||||||
|
@PROJECT_SOURCE_DIR@/packages/gecode/gecode4.yap \
|
||||||
|
@PROJECT_SOURCE_DIR@/packages/gecode/gecode3_yap_hand_written.yap \ @PROJECT_SOURCE_DIR@/packages/gecode/gecode4_yap_hand_written.yap
|
||||||
|
*/CMakeFiles/* *~ */\#* \
|
||||||
|
|
||||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||||
@ -2044,7 +2051,11 @@ SEARCH_INCLUDES = YES
|
|||||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||||
|
|
||||||
INCLUDE_PATH = @CMAKE_BINARY_DIR@ \
|
INCLUDE_PATH = @CMAKE_BINARY_DIR@ \
|
||||||
@CMAKE_BINARY_DIR@/packages/gecode
|
@PROJECT_SOURCE_DIR@/H \
|
||||||
|
@PROJECT_SOURCE_DIR@/H/generated \
|
||||||
|
@PROJECT_SOURCE_DIR@/include \
|
||||||
|
@PROJECT_SOURCE_DIR@/os \
|
||||||
|
@PROJECT_SOURCE_DIR@/OPTYap \
|
||||||
|
|
||||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||||
|
@ -5,8 +5,8 @@ Installing YAP {#install}
|
|||||||
|
|
||||||
### Downloading YAP {#download}
|
### Downloading YAP {#download}
|
||||||
|
|
||||||
The latest development version of Yap-6 is available source-only through GIT repositories. The main references
|
The latest development version of Yap-6 is available source-only
|
||||||
repository is at
|
through GIT repositories. The main reference repository is at
|
||||||
|
|
||||||
+ [github](https://github.com/vscosta/yap-6.3)
|
+ [github](https://github.com/vscosta/yap-6.3)
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ We store an older version of YAP at:
|
|||||||
|
|
||||||
Please just use `git clone` to obtain the distribution. Ie, to download YAP from the command line please type:
|
Please just use `git clone` to obtain the distribution. Ie, to download YAP from the command line please type:
|
||||||
|
|
||||||
~~~~=
|
~~~~~
|
||||||
git clone https://github.com/vscosta/yap-6.3 yap-6.3
|
git clone https://github.com/vscosta/yap-6.3 yap-6.3
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
@ -26,15 +26,15 @@ The first argument is the repository, the last argument is the (optional) target
|
|||||||
|
|
||||||
#### Download Options
|
#### Download Options
|
||||||
|
|
||||||
More detailed, maybe useful information:
|
It may be useful to know:
|
||||||
|
|
||||||
+ If you are have limited bandwith or disk room, consider using
|
+ If you are have limited bandwith or disk spaceq, consider using
|
||||||
`git clone --depth XX` to only include the last `XX` commits.
|
`git clone --depth XX` to only include the last `XX` commits.
|
||||||
|
|
||||||
+ Older versions of YAP were distributed with modules. YAP-6.3.5 is
|
+ Older versions of YAP were distributed with modules. YAP-6.3.5 is
|
||||||
a single package, and it does not need `git submodule`.
|
a single package, and it does not need `git submodule`.
|
||||||
|
|
||||||
+ The GitHub site includes a number of companion packages,
|
+ The GitHub site includes a number of companion packages for YAP,
|
||||||
including [doxygen-yap](https://github.com/vscosta/doxygen-yap), a
|
including [doxygen-yap](https://github.com/vscosta/doxygen-yap), a
|
||||||
version of doxygen adapted to Prolog that was used to generate
|
version of doxygen adapted to Prolog that was used to generate
|
||||||
these documents.
|
these documents.
|
||||||
@ -48,9 +48,9 @@ generate Makefiles, Ninja, Apple's XCode, VisualStudio and ANdroid
|
|||||||
Studio, and because it includes packaging suppport, The steps required
|
Studio, and because it includes packaging suppport, The steps required
|
||||||
to install core YAP under `cmake`:
|
to install core YAP under `cmake`:
|
||||||
|
|
||||||
##### Ensure that you have a working `C/C++` compiler in your system
|
##### `C/C++` compiler
|
||||||
|
|
||||||
1. Status as of early 17
|
*Status as of early 2017*
|
||||||
|
|
||||||
YAP should compile well under the [GNU-CC](https://gcc.gnu.org/)
|
YAP should compile well under the [GNU-CC](https://gcc.gnu.org/)
|
||||||
and the [C-LANG]https://clang.llvm.org/() families, that are
|
and the [C-LANG]https://clang.llvm.org/() families, that are
|
||||||
@ -58,23 +58,27 @@ to install core YAP under `cmake`:
|
|||||||
undder Intel `icc`.
|
undder Intel `icc`.
|
||||||
|
|
||||||
We do not recommend using Microoft's VC++. To the best of our
|
We do not recommend using Microoft's VC++. To the best of our
|
||||||
knowledge MSC does not support threaded code, which YAP recquires
|
knowledge MSC does not support threaded emulation, which YAP recquires
|
||||||
for performance, You can still use the IDE, and experiment with
|
for performance, You can still use the IDE, and experiment with
|
||||||
the c-lang plugin.
|
the c-lang plugin.
|
||||||
|
|
||||||
YAP compiles cleanly under cross-compilers, and we have used the
|
YAP compiles cleanly under cross-compilers, and we have used the
|
||||||
crosss-compirt [mxe](http://mxe.cc/) system with good results.
|
crosss-compilation system [mxe](http://mxe.cc/) system with good results.
|
||||||
|
|
||||||
##### Ensure that you have a working `cmake` in your systen,
|
##### `cmake`
|
||||||
|
|
||||||
All Linux and BSD distributions include `cmake`, so
|
All Linux and BSD distributions include `cmake`, so
|
||||||
does [Homebrew](https://brew.sh/)
|
does [Homebrew](https://brew.sh/)
|
||||||
and [MacPorts](https://www.macports.org/) for the Mac,
|
and [MacPorts](https://www.macports.org/) for the Mac,
|
||||||
and [MSYS2](http://www.msys2.org/) and [cygwin](http://www.cygwin.org/)
|
and [MSYS2](http://www.msys2.org/)
|
||||||
for WIN32. Android Studio has native support, and there are excellenr
|
and [cygwin](http://www.cygwin.org/) for WIN32. Android Studio has
|
||||||
plugins for the Visual Codes. The `cmake` site includes pre-compiled
|
native support for `cmake`since 2.1, although we advise to use
|
||||||
binaries. If you have an older Linux you may need to compile from
|
2.2. Last, there are excellent plugins for the Visual Codes. In case
|
||||||
source, available at GitHub.
|
you need a recent version, consider using pre-compiled binaries at
|
||||||
|
the [CMake site](https://www.cmake.org).
|
||||||
|
|
||||||
|
If you have an older Linux you may need to compile from source,
|
||||||
|
available at GitHub.
|
||||||
|
|
||||||
##### Ensure that you have other necessary packages installed:
|
##### Ensure that you have other necessary packages installed:
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Attributed Variables and Co-Routining {#AttributedVariables}
|
Attributed Variables and Co-Routining {#attributes}
|
||||||
=======================================
|
=======================================
|
||||||
|
@ingroup extensions
|
||||||
|
|
||||||
|
|
||||||
YAP supports attributed variables, originally developed at OFAI by
|
YAP supports attributed variables, originally developed at OFAI by
|
||||||
Christian Holzbaur. Attributes are a means of declaring that an
|
Christian Holzbaur. Attributes are a means of declaring that an
|
||||||
@ -24,12 +26,12 @@ work with. Most packages included in YAP that use attributed
|
|||||||
variables, such as CHR, CLP(FD), and CLP(QR), rely on the SWI-Prolog
|
variables, such as CHR, CLP(FD), and CLP(QR), rely on the SWI-Prolog
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
+ @ewd attributes
|
+ @ref SICS_attributes
|
||||||
+ @ref New_Style_Attribute_Declarations
|
+ @ref New_Style_Attribute_Declarations
|
||||||
+ @ref CohYroutining
|
+ @ref CohYroutining
|
||||||
+ @ref AttributeVariables_Builtins
|
+ @ref AttributeVariables_Builtins
|
||||||
|
|
||||||
@section attributes SICStus Style attribute declarations.
|
@section SICS_attributes SICStus Style attribute declarations.
|
||||||
|
|
||||||
The YAP library `atts` implements attribute variables in the style of
|
The YAP library `atts` implements attribute variables in the style of
|
||||||
SICStus Prolog. Attributed variables work as follows:
|
SICStus Prolog. Attributed variables work as follows:
|
||||||
|
@ -14,4 +14,6 @@ with cudd binaries. This works:
|
|||||||
In ubuntu, you may want to install the fedora rpm, or just download the package from the original
|
In ubuntu, you may want to install the fedora rpm, or just download the package from the original
|
||||||
and compile it.
|
and compile it.
|
||||||
|
|
||||||
.
|
|
||||||
|
+ @ref BDDsPL
|
||||||
|
+ @ref CUDD
|
||||||
|
@ -3,29 +3,13 @@ YAP Built-ins {#builtins}
|
|||||||
|
|
||||||
This chapter describes the core predicates that control the execution of
|
This chapter describes the core predicates that control the execution of
|
||||||
Prolog programs, provide fundamental functionality such as termm manipulation or arithmetic, and support interaction with external
|
Prolog programs, provide fundamental functionality such as termm manipulation or arithmetic, and support interaction with external
|
||||||
resources, Many of the predicates described here have been standardised by the ISO. The standartised subset of Proloh also known as ISO-Prolog.
|
resources, Many of the predicates described here have been standardised by the ISO. The standartised subset of Prolog also known as ISO-Prolog.
|
||||||
|
|
||||||
In the description of the arguments of functors the following notation
|
In the description of the arguments of predicates the following
|
||||||
will be used:
|
notation will be used:
|
||||||
|
|
||||||
+ a preceding plus sign will denote an argument as an "input
|
+ a preceding plus sign will denote an argument as an "input
|
||||||
argument" - it cannot be a free variable at the time of the call;
|
argument" - it cannot be a free variable at the time of the call;
|
||||||
+ a preceding minus sign will denote an "output argument";
|
+ a preceding minus sign will denote an "output argument";
|
||||||
+ an argument with no preceding symbol can be used in both ways.
|
+ an argument with no preceding symbol can be used in both ways.
|
||||||
+ @ref YAPControl
|
|
||||||
|
|
||||||
+ @ref Arithmetic
|
|
||||||
|
|
||||||
+ @ref YAPChars
|
|
||||||
|
|
||||||
+ @ref YAP_Terms
|
|
||||||
|
|
||||||
+ @ref InputOutput
|
|
||||||
|
|
||||||
+ @ref AbsoluteFileName
|
|
||||||
|
|
||||||
+ @ref YAPOS
|
|
||||||
|
|
||||||
+ @ref Internal_Database
|
|
||||||
|
|
||||||
+ @ref Sets
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
Extensions to core Prolog. {#extensions}
|
Extensions to core Prolog. {#extensions}
|
||||||
=========================
|
========================
|
||||||
|
|
||||||
YAP includes a number of extensions over the original Prolog
|
YAP includes a number of extensions over the original Prolog
|
||||||
language. Next, we discuss how to use the most important ones.
|
language.
|
||||||
|
|
||||||
+ @ref Rational_Trees
|
+ @ref Rational_Trees
|
||||||
|
|
||||||
+ @ref AttributedVariables
|
+ @subpage attributes
|
||||||
|
|
||||||
+ @ref DepthLimited
|
+ @ref DepthLimited
|
||||||
|
|
||||||
@ -19,3 +19,6 @@ language. Next, we discuss how to use the most important ones.
|
|||||||
+ @ref YAPArrays
|
+ @ref YAPArrays
|
||||||
|
|
||||||
+ @ref Parallelism
|
+ @ref Parallelism
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
Loading and Oganising YAP Programs {#consult}
|
Loading and Oganising YAP Programs {#load_files}
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
Next, we present the main predicates and directives available to load
|
Next, we present the main predicates and directives available to load
|
||||||
files and to control the Prolog environment.
|
files and to control the Prolog environment.
|
||||||
|
|
||||||
+ @subpage modules.md
|
+ @subpage YAPModules
|
||||||
|
|
||||||
+ @ref YAPConsulting
|
+ @ref YAPConsulting
|
||||||
|
|
||||||
+ @ref YAPSaving
|
+ @ref QLY
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
The YAP Module system
|
The YAP Module system {#YAPModules}
|
||||||
======================
|
=====================
|
||||||
|
|
||||||
[TOC]
|
|
||||||
|
|
||||||
The YAP module system is based on the Quintus/SISCtus module
|
The YAP module system is based on the Quintus/SISCtus module
|
||||||
system ˜\cite quintus . In this design, modules are named collections of predicates,
|
system ˜\cite quintus . In this design, modules are named collections of predicates,
|
||||||
@ -12,9 +10,9 @@ _exported_, that is, visible to other modules.
|
|||||||
|
|
||||||
The main predicates in the module system are:
|
The main predicates in the module system are:
|
||||||
|
|
||||||
* module/2 associates a source file to a module. It has two arguments: the name of the new module, and a list of predicates exported by the module.
|
* module/2 associates a source file to a module. It has two arguments: the name of the new module, and a list of predicates exported by the module.
|
||||||
|
|
||||||
* use_module/1 and use_module/2 can be used to load a module. They take as first argument the source file for the module. Whereas use_module/1 loads all exported predicates, use_module/2 only takes the ones given by the second argument.
|
* use_module/1 and use_module/2 can be used to load a module. They take as first argument the source file for the module. Whereas use_module/1 loads all exported predicates, use_module/2 only takes the ones given by the second argument.
|
||||||
|
|
||||||
YAP pre-defines a number of modules. Most system predicates belong to
|
YAP pre-defines a number of modules. Most system predicates belong to
|
||||||
the module `prolog`. Predicates from the module `prolog` are
|
the module `prolog`. Predicates from the module `prolog` are
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
YAP packages files {#packages}
|
YAP packages files {packages}
|
||||||
===================
|
==============================
|
||||||
|
|
||||||
+ @subpage real
|
+ @subpage real
|
||||||
|
|
||||||
+ @ref BDDs
|
+ @subpage bdds
|
||||||
|
|
||||||
+ @subpage gecode
|
+ @subpage gecode
|
||||||
|
|
||||||
+ @subpage myddas
|
+ @subpage myddas
|
||||||
|
|
||||||
+ @ref PFL/CLP(BN)
|
+ @ref PFL
|
||||||
|
|
||||||
+ @ref ProbLog1
|
+ @subpage ProbLog1
|
||||||
|
|
||||||
+ @ref Python
|
+ @ref Python
|
||||||
|
|
||||||
+ @subpage YAPRaptor
|
+ @subpage raptor
|
||||||
|
|
||||||
+ @ref YAP-LBFGS
|
+ @ref YAP-LBFGS
|
||||||
|
|
||||||
+ @subpage yap-udi-indexers
|
+ @subpage yap-udi-indexers
|
||||||
|
|
||||||
Leuven packages ported from SWI-Prolog:
|
Leuven packages ported from SWI-Prolog:
|
||||||
|
|
||||||
|
+ @subpage chr
|
||||||
|
|
||||||
|
+ @subpage clpqr
|
||||||
|
|
||||||
+ @subpage chr
|
|
||||||
|
|
||||||
+ @subpage clpqr
|
|
||||||
|
10
docs/md/programming.md
Normal file
10
docs/md/programming.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Programming in YAP {#YAPProgramming}
|
||||||
|
====================
|
||||||
|
|
||||||
|
+ @subpage YAPSyntax
|
||||||
|
|
||||||
|
+ @ref YAPCompilerSettings
|
||||||
|
|
||||||
|
+ @ref Indexing
|
||||||
|
|
||||||
|
+ @ref Deb_Interaction
|
@ -1,5 +1,7 @@
|
|||||||
Compatibility with other Prolog systems {#swi_iso_c}
|
Compatibility with other Prolog systems {#swi_iso_c}
|
||||||
=======================================
|
======================================
|
||||||
|
|
||||||
|
@ingroup YAPProgramming
|
||||||
|
|
||||||
YAP has been designed to be as compatible as possible with other
|
YAP has been designed to be as compatible as possible with other
|
||||||
Prolog systems, originally with C-Prolog\cite x and SICStus
|
Prolog systems, originally with C-Prolog\cite x and SICStus
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
YAP Syntax {#YAPSyntax}
|
YAP Syntax {#YAPSyntax}
|
||||||
============
|
============
|
||||||
|
|
||||||
|
@ingroup YAPProgrammming
|
||||||
|
|
||||||
We will describe the syntax of YAP at two levels. We first will
|
We will describe the syntax of YAP at two levels. We first will
|
||||||
describe the syntax for Prolog terms. In a second level we describe
|
describe the syntax for Prolog terms. In a second level we describe
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
YAP 6-3.5 Manual {#mainpage}
|
YAP 6-3.5 Manual {#mainpage}
|
||||||
====================
|
====================
|
||||||
|
|
||||||
This file documents the YAP Prolog System version 6.3.4, a high-performance Prolog compiler developed at LIACC, Universidade do Porto. YAP is based on David H. D. Warren's WAM (Warren Abstract Machine), with several optimizations for better performance. YAP follows the Edinburgh tradition, and is largely compatible with DEC-10 Prolog, Quintus Prolog, and originally with C-Prolog.
|
<center>
|
||||||
|

|
||||||
|
</center>
|
||||||
|
|
||||||
|
NOTE: this version of YAP is still experimental, documentation may be out of date.
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This document provides User information on version 6.3.4 of
|
||||||
|
YAP (<em>Yet Another Prolog</em>). The YAP Prolog System is a
|
||||||
|
high-performance Prolog compiler developed at Universidade do
|
||||||
|
Porto.
|
||||||
|
|
||||||
The manual is organised as follows:
|
The manual is organised as follows:
|
||||||
|
|
||||||
|
|
||||||
+ @subpage download
|
|
||||||
|
|
||||||
+ @subpage install
|
+ @subpage install
|
||||||
|
|
||||||
+ @subpage run
|
+ @subpage run
|
||||||
|
|
||||||
+ @subpage consult
|
+ @subpage load_files
|
||||||
|
|
||||||
+ @subpage builtins
|
+ @subpage builtins
|
||||||
|
|
||||||
@ -22,15 +31,11 @@ The manual is organised as follows:
|
|||||||
|
|
||||||
+ @subpage packages
|
+ @subpage packages
|
||||||
|
|
||||||
+ @subpage swi_iso_c
|
|
||||||
|
|
||||||
+ @subpage YAPProgramming
|
+ @subpage YAPProgramming
|
||||||
|
|
||||||
+ @subpage fli_c_cxx
|
+ @subpage fli_c_cxx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\author Vitor Santos Costa,
|
\author Vitor Santos Costa,
|
||||||
\author Luís Damas,
|
\author Luís Damas,
|
||||||
\author Rogério Reis
|
\author Rogério Reis
|
||||||
|
@ -18,17 +18,10 @@
|
|||||||
|
|
||||||
@file YapInterface.h
|
@file YapInterface.h
|
||||||
|
|
||||||
|
@addtogroup ChYInterface
|
||||||
@{
|
@{
|
||||||
|
|
||||||
@defgroup fli_c_cx Foreign Language interface to YAP
|
\
|
||||||
|
|
||||||
@toc
|
|
||||||
|
|
||||||
@defgroup ChYInterface C interface to YAP
|
|
||||||
@{
|
|
||||||
|
|
||||||
@ingroup fli_c_cx
|
|
||||||
|
|
||||||
@brief Core interface to YAP.
|
@brief Core interface to YAP.
|
||||||
|
|
||||||
@toc
|
@toc
|
||||||
|
@ -13,7 +13,11 @@
|
|||||||
* comments: c_interface header file for YAP *
|
* comments: c_interface header file for YAP *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file c_interface.h
|
||||||
|
*
|
||||||
|
* @addtogroup ChYInterface
|
||||||
|
*/
|
||||||
#if !defined(_c_interface_h) && !defined(_YAP_NOT_INSTALLED_)
|
#if !defined(_c_interface_h) && !defined(_YAP_NOT_INSTALLED_)
|
||||||
|
|
||||||
#define _c_interface_h 1
|
#define _c_interface_h 1
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
||||||
@defgroup arg Term Argument Manipulation.
|
@defgroup args Term Argument Manipulation.
|
||||||
|
|
||||||
@ingroup @library
|
@ingroup @library
|
||||||
|
|
||||||
|
@ -18,32 +18,35 @@
|
|||||||
:- module(attributes, [op(1150, fx, attribute)]).
|
:- module(attributes, [op(1150, fx, attribute)]).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@addtogroup attributes
|
*
|
||||||
|
* @defgroup sicsatts SICStus style attribute declarations
|
||||||
|
*
|
||||||
|
* @ingroup attributes
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
|
||||||
|
SICStus style attribute declarations are activated through loading the
|
||||||
|
library <tt>atts</tt>. The command
|
||||||
|
|
||||||
%% @{
|
~~~~~
|
||||||
|
| ?- use_module(library(atts)).
|
||||||
|
~~~~~
|
||||||
|
enables this form of attributed variables.
|
||||||
|
|
||||||
SICStus style attribute declarations are activated through loading the
|
The directive
|
||||||
library <tt>atts</tt>. The command
|
|
||||||
|
|
||||||
~~~~~
|
- attribute/1
|
||||||
| ?- use_module(library(atts)).
|
|
||||||
~~~~~
|
|
||||||
enables this form of attributed variables.
|
|
||||||
|
|
||||||
The directive
|
and the following user defined predicates can be used:
|
||||||
|
|
||||||
- attribute/1
|
- Module:get_atts/2
|
||||||
|
|
||||||
and the following user defined predicates can be used:
|
- Module:put_atts/2
|
||||||
|
|
||||||
- Module:get_atts/2
|
- Module:put_atts/3
|
||||||
|
|
||||||
- Module:put_atts/2
|
- Module:woken_att_do/4
|
||||||
|
|
||||||
- Module:put_atts/3
|
|
||||||
|
|
||||||
- Module:woken_att_do/4
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -2,13 +2,17 @@
|
|||||||
% SWI emulation.
|
% SWI emulation.
|
||||||
% written in an on-demand basis.
|
% written in an on-demand basis.
|
||||||
|
|
||||||
%% @defgroup swi Compatibility with SWI-Prolog and Other Prolog systems
|
%% @defgroup SWI Compatibility with SWI-Prolog and Other Prolog systems
|
||||||
|
%% @{
|
||||||
|
%% @ingroup YAPProgramming
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@defgroup System SWI Dialect Support
|
@defgroup System SWI Dialect Support
|
||||||
|
@ingroup SWI
|
||||||
|
|
||||||
|
@{
|
||||||
|
|
||||||
|
|
||||||
This library provides a number of SWI-Prolog builtins that are not by
|
This library provides a number of SWI-Prolog builtins that are not by
|
||||||
default in YAP. This support is loaded with the
|
default in YAP. This support is loaded with the
|
||||||
~~~~~
|
~~~~~
|
||||||
@ -17,20 +21,18 @@ expects_dialect(swi)
|
|||||||
|
|
||||||
command.
|
command.
|
||||||
|
|
||||||
@{
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @pred time_file(+ _File_,- _Time_)
|
/** @pred time_file(+ _File_,- _Time_)
|
||||||
|
|
||||||
|
|
||||||
Unify the last modification time of _File_ with
|
Unify the last modification time of _File_ with
|
||||||
_Time_. _Time_ is a floating point number expressing the seconds
|
_Time_. _Time_ is a floating point number expressing the seconds
|
||||||
elapsed since Jan 1, 1970.
|
elapsed since Jan 1, 1970.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred concat_atom(+ _List_,- _Atom_)
|
/** @pred concat_atom(+ _List_,- _Atom_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ if _Atom_ can be unified with the concatenated elements of _List_. If
|
|||||||
_List_ has exactly 2 elements it is equivalent to `atom_concat/3`,
|
_List_ has exactly 2 elements it is equivalent to `atom_concat/3`,
|
||||||
allowing for variables in the list.
|
allowing for variables in the list.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module(system, [concat_atom/2,
|
:- module(system, [concat_atom/2,
|
||||||
@ -143,14 +145,14 @@ concatenated are the representation for _A12_.
|
|||||||
If _A1_ and _A2_ are unbound, the built-in will find all the atoms
|
If _A1_ and _A2_ are unbound, the built-in will find all the atoms
|
||||||
that concatenated give _A12_.
|
that concatenated give _A12_.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
goal_expansion(atom_concat(A,B,C),atomic_concat(A,B,C)).
|
goal_expansion(atom_concat(A,B,C),atomic_concat(A,B,C)).
|
||||||
%goal_expansion(arg(A,_,_),_) :- nonvar(A), !, fail.
|
%goal_expansion(arg(A,_,_),_) :- nonvar(A), !, fail.
|
||||||
goal_expansion(arg(A,B,C),arg:genarg(A,B,C)).
|
goal_expansion(arg(A,B,C),arg:genarg(A,B,C)).
|
||||||
|
|
||||||
% make sure we also use
|
% make sure we also use
|
||||||
:- user:library_directory(X),
|
:- user:library_directory(X),
|
||||||
atom(X),
|
atom(X),
|
||||||
atom_concat([X,'/dialect/swi'],SwiDir),
|
atom_concat([X,'/dialect/swi'],SwiDir),
|
||||||
@ -187,7 +189,7 @@ instantiating _Separator_ and _Atom_:
|
|||||||
L = [gnu, gnat]
|
L = [gnu, gnat]
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
concat_atom([A|List], Separator, New) :- var(List), !,
|
concat_atom([A|List], Separator, New) :- var(List), !,
|
||||||
atom_codes(Separator,[C]),
|
atom_codes(Separator,[C]),
|
||||||
@ -224,7 +226,7 @@ cvt_bindings([[Name|Value]|L],[AName=Value|Bindings]) :-
|
|||||||
atom_codes(AName, Name),
|
atom_codes(AName, Name),
|
||||||
cvt_bindings(L,Bindings).
|
cvt_bindings(L,Bindings).
|
||||||
|
|
||||||
/** @pred chdir(+ _Dir_)
|
/** @pred chdir(+ _Dir_)
|
||||||
|
|
||||||
Compatibility predicate. New code should use working_directory/2.
|
Compatibility predicate. New code should use working_directory/2.
|
||||||
*/
|
*/
|
||||||
@ -317,5 +319,7 @@ required_predicate(Na/Ar, M) :-
|
|||||||
).
|
).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@}
|
||||||
|
|
||||||
@}
|
@}
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defsgroup readutil
|
* @defgroup readutil
|
||||||
* @ingroup library
|
* @ingroup library
|
||||||
*
|
*
|
||||||
* Read full lines and a full file in a single call.
|
* Read full lines and a full file in a single call.
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* @file varnumbers.yap
|
* @file varnumbers.yap
|
||||||
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
* @author VITOR SANTOS COSTA <vsc@VITORs-MBP.lan>
|
||||||
* @date 2006
|
* @date 2006
|
||||||
*
|
*
|
||||||
* @brief opposite to numbervars
|
* @brief opposite to numbervars
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module(varnumbers, [
|
:- module(varnumbers, [
|
||||||
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup varnumbers Variabilize term.
|
* @defgroup varnumbers Variabilize term.
|
||||||
* @ingroup ellllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
|
* @ingroup library
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ static char SccsId[] = "%W% %G%";
|
|||||||
|
|
||||||
///{@
|
///{@
|
||||||
|
|
||||||
/// @addtogroup CharProps
|
|
||||||
/**
|
/**
|
||||||
* @defgroup CharIO Character-Based Input/Output
|
* @defgroup CharIO Character-Based Input/Output
|
||||||
* @ingroup InputOutput
|
* @ingroup InputOutput
|
||||||
|
@ -1386,7 +1386,6 @@ digit_weight( 0x1D7D7, 9).
|
|||||||
digit_weight( 0x1D7E1, 9).
|
digit_weight( 0x1D7E1, 9).
|
||||||
digit_weight( 0x1D7EB, 9).
|
digit_weight( 0x1D7EB, 9).
|
||||||
digit_weight( 0x1D7F5, 9).
|
digit_weight( 0x1D7F5, 9).
|
||||||
x
|
|
||||||
digit_weight( 0x1D7FF, 9).
|
digit_weight( 0x1D7FF, 9).
|
||||||
digit_weight( 0x1E8CF, 9).
|
digit_weight( 0x1E8CF, 9).
|
||||||
digit_weight( 0x1F10A, 9).
|
digit_weight( 0x1F10A, 9).
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file fmemopen.c
|
* @file fmemopen.c
|
||||||
* @defgroup Memory Streams.
|
* @defgroup MemoryStreams Memory Streams
|
||||||
* @in.
|
* @ingroup InputOutput
|
||||||
* @return Description of returned value.
|
* @return Description of returned value.
|
||||||
*/
|
*/
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -41,13 +41,13 @@ typedef struct fmem fmem_t;
|
|||||||
static int readfn(void *handler, char *buf, int size) {
|
static int readfn(void *handler, char *buf, int size) {
|
||||||
fmem_t *mem = handler;
|
fmem_t *mem = handler;
|
||||||
size_t available = mem->size - mem->pos;
|
size_t available = mem->size - mem->pos;
|
||||||
|
|
||||||
if (size > available) {
|
if (size > available) {
|
||||||
size = available;
|
size = available;
|
||||||
}
|
}
|
||||||
memcpy(buf, mem->buffer + mem->pos, sizeof(char) * size);
|
memcpy(buf, mem->buffer + mem->pos, sizeof(char) * size);
|
||||||
mem->pos += size;
|
mem->pos += size;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
]).
|
]).
|
||||||
|
|
||||||
/** @defgroup PFL The PrologFactor Language
|
/** @defgroup PFL The PrologFactor Language
|
||||||
@ingroup YAPPackagaes
|
@ingroup packages
|
||||||
|
|
||||||
section{Introduction}
|
section{Introduction}
|
||||||
The Prolog Factor Language (PFL) is a language that extends Prolog for providing a syntax to describe first-order probabilistic graphical models. These models can be either directed (bayesian networks) or undirected (markov networks). This language replaces the old one known as CLP(BN).
|
The Prolog Factor Language (PFL) is a language that extends Prolog for providing a syntax to describe first-order probabilistic graphical models. These models can be either directed (bayesian networks) or undirected (markov networks). This language replaces the old one known as CLP(BN).
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/** @defgroup BDDs Binary Decision Diagrams and Friends
|
@defgroup BDDsPL Binary Decision Diagrams and Friends
|
||||||
@ingroup packages
|
@ingroup BDDs
|
||||||
@{
|
@{
|
||||||
|
|
||||||
|
|
||||||
This library provides an interface to the BDD package CUDD. It requires
|
This library provides an interface to the BDD package CUDD. It requires
|
||||||
CUDD compiled as a dynamic library. In Linux this is available out of
|
CUDD compiled as a dynamic library. In Linux this is available out of
|
||||||
box in Fedora, but can easily be ported to other Linux
|
box in Fedora, but can easily be ported to other Linux
|
||||||
|
@ -28,7 +28,8 @@
|
|||||||
invalidate any other reasons why the executable file might be covered by
|
invalidate any other reasons why the executable file might be covered by
|
||||||
the GNU General Public License.
|
the GNU General Public License.
|
||||||
*/
|
*/
|
||||||
%% @addtogroup CHR_in_YAP_Programs
|
%% @addtogroup CHR_in_YAP_Programs CHR Programs
|
||||||
|
%% @ingroup CHR
|
||||||
%
|
%
|
||||||
% CHR controlling the compiler
|
% CHR controlling the compiler
|
||||||
%
|
%
|
||||||
@ -38,7 +39,7 @@
|
|||||||
, init_chr_pp_flags/0
|
, init_chr_pp_flags/0
|
||||||
, chr_pp_flag/2
|
, chr_pp_flag/2
|
||||||
]).
|
]).
|
||||||
|
|
||||||
%% SICStus begin
|
%% SICStus begin
|
||||||
%% :- use_module(hprolog, [nb_setval/2,nb_getval/2]).
|
%% :- use_module(hprolog, [nb_setval/2,nb_getval/2]).
|
||||||
%% local_current_prolog_flag(_,_) :- fail.
|
%% local_current_prolog_flag(_,_) :- fail.
|
||||||
@ -55,11 +56,11 @@ local_current_prolog_flag(X,Y) :- current_prolog_flag(X,Y).
|
|||||||
% Global Options
|
% Global Options
|
||||||
%
|
%
|
||||||
|
|
||||||
handle_option(Name,Value) :-
|
handle_option(Name,Value) :-
|
||||||
var(Name), !,
|
var(Name), !,
|
||||||
chr_error(syntax((:- chr_option(Name,Value))),'First argument should be an atom, not a variable.\n',[]).
|
chr_error(syntax((:- chr_option(Name,Value))),'First argument should be an atom, not a variable.\n',[]).
|
||||||
|
|
||||||
handle_option(Name,Value) :-
|
handle_option(Name,Value) :-
|
||||||
var(Value), !,
|
var(Value), !,
|
||||||
chr_error(syntax((:- chr_option(Name,Value))),'Second argument cannot be a variable.\n',[]).
|
chr_error(syntax((:- chr_option(Name,Value))),'Second argument cannot be a variable.\n',[]).
|
||||||
|
|
||||||
@ -68,11 +69,11 @@ handle_option(Name,Value) :-
|
|||||||
!,
|
!,
|
||||||
set_chr_pp_flags(Flags).
|
set_chr_pp_flags(Flags).
|
||||||
|
|
||||||
handle_option(Name,Value) :-
|
handle_option(Name,Value) :-
|
||||||
\+ option_definition(Name,_,_), !,
|
\+ option_definition(Name,_,_), !,
|
||||||
chr_error(syntax((:- chr_option(Name,Value))),'Invalid option name ~w: consult the manual for valid options.\n',[Name]).
|
chr_error(syntax((:- chr_option(Name,Value))),'Invalid option name ~w: consult the manual for valid options.\n',[Name]).
|
||||||
|
|
||||||
handle_option(Name,Value) :-
|
handle_option(Name,Value) :-
|
||||||
chr_error(syntax((:- chr_option(Name,Value))),'Invalid option value ~w: consult the manual for valid option values.\n',[Value]).
|
chr_error(syntax((:- chr_option(Name,Value))),'Invalid option value ~w: consult the manual for valid option values.\n',[Value]).
|
||||||
|
|
||||||
option_definition(optimize,experimental,Flags) :-
|
option_definition(optimize,experimental,Flags) :-
|
||||||
@ -198,7 +199,7 @@ option_definition(type_declaration,TypeDecl,[]) :-
|
|||||||
TypeDecl =.. [_|ArgTypes],
|
TypeDecl =.. [_|ArgTypes],
|
||||||
chr_translate:constraint_type(F/A,ArgTypes)
|
chr_translate:constraint_type(F/A,ArgTypes)
|
||||||
; true).
|
; true).
|
||||||
|
|
||||||
option_definition(mode,ModeDecl,[]) :-
|
option_definition(mode,ModeDecl,[]) :-
|
||||||
( nonvar(ModeDecl) ->
|
( nonvar(ModeDecl) ->
|
||||||
functor(ModeDecl,F,A),
|
functor(ModeDecl,F,A),
|
||||||
@ -290,7 +291,7 @@ option_definition(ht_removal,off,Flags) :-
|
|||||||
option_definition(mixed_stores,on,Flags) :-
|
option_definition(mixed_stores,on,Flags) :-
|
||||||
Flags = [mixed_stores - on].
|
Flags = [mixed_stores - on].
|
||||||
option_definition(mixed_stores,off,Flags) :-
|
option_definition(mixed_stores,off,Flags) :-
|
||||||
Flags = [mixed_stores - off].
|
Flags = [mixed_stores - off].
|
||||||
|
|
||||||
option_definition(line_numbers,on,Flags) :-
|
option_definition(line_numbers,on,Flags) :-
|
||||||
Flags = [line_numbers - on].
|
Flags = [line_numbers - on].
|
||||||
@ -312,7 +313,7 @@ init_chr_pp_flags :-
|
|||||||
chr_pp_flag_definition(Name,[DefaultValue|_]),
|
chr_pp_flag_definition(Name,[DefaultValue|_]),
|
||||||
set_chr_pp_flag(Name,DefaultValue),
|
set_chr_pp_flag(Name,DefaultValue),
|
||||||
fail.
|
fail.
|
||||||
init_chr_pp_flags.
|
init_chr_pp_flags.
|
||||||
|
|
||||||
set_chr_pp_flags([]).
|
set_chr_pp_flags([]).
|
||||||
set_chr_pp_flags([Name-Value|Flags]) :-
|
set_chr_pp_flags([Name-Value|Flags]) :-
|
||||||
@ -368,7 +369,7 @@ chr_pp_flag(Name,Value) :-
|
|||||||
;
|
;
|
||||||
V = Value
|
V = Value
|
||||||
).
|
).
|
||||||
|
|
||||||
|
|
||||||
% TODO: add whatever goes wrong with (debug,on), (optimize,full) combo here!
|
% TODO: add whatever goes wrong with (debug,on), (optimize,full) combo here!
|
||||||
% trivial example of what does go wrong:
|
% trivial example of what does go wrong:
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
the GNU General Public License.
|
the GNU General Public License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
%% @addtogroup CHR_Debugging
|
%% @addtogroup CHR_Debugging Debugging
|
||||||
|
%% @ingroup CHR
|
||||||
%
|
%
|
||||||
% CHR debugger
|
% CHR debugger
|
||||||
%
|
%
|
||||||
@ -43,7 +44,7 @@
|
|||||||
|
|
||||||
|
|
||||||
%% chr_show_store(+Module)
|
%% chr_show_store(+Module)
|
||||||
%
|
%
|
||||||
% Prints all suspended constraints of module Mod to the standard
|
% Prints all suspended constraints of module Mod to the standard
|
||||||
% output.
|
% output.
|
||||||
|
|
||||||
|
@ -68,7 +68,8 @@
|
|||||||
%% * Added initialization directives for saved-states
|
%% * Added initialization directives for saved-states
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
%% @addtogroup CHR_Rule_Types
|
%% @addtogroup CHR_Rule_Types Rule Types
|
||||||
|
%% @ingroup CHR
|
||||||
%
|
%
|
||||||
% CHR controlling the compiler
|
% CHR controlling the compiler
|
||||||
%
|
%
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
%% SWI begin
|
%% SWI begin
|
||||||
%% @addtogroup CHR
|
%% @addtogroup CHR chr
|
||||||
|
%% @ingroup packages
|
||||||
%
|
%
|
||||||
% SWI interface.
|
% SWI interface.
|
||||||
%
|
%
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Constraint Logic Programming over Rationals and Reals {#clpqr}
|
Constraint Logic Programming over Rationals and Reals {#clpqr}
|
||||||
=====================================================
|
=====================================================
|
||||||
|
|
||||||
YAP now uses the CLP(R) package developed by <em>Leslie De Koninck</em>,
|
YAP now uses the CLP(R) package developed by <em>Leslie De Koninck</em>,
|
@ -1,7 +1,7 @@
|
|||||||
/* $Id$
|
/* $Id$
|
||||||
|
|
||||||
Part of CLP(R) (Constraint Logic Programming over Reals)
|
Part of CLP(R) (Constraint Logic Programming over Reals)
|
||||||
|
|
||||||
Author: Leslie De Koninck
|
Author: Leslie De Koninck
|
||||||
E-mail: Leslie.DeKoninck@cs.kuleuven.be
|
E-mail: Leslie.DeKoninck@cs.kuleuven.be
|
||||||
WWW: http://www.swi-prolog.org
|
WWW: http://www.swi-prolog.org
|
||||||
@ -38,16 +38,21 @@
|
|||||||
the GNU General Public License.
|
the GNU General Public License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup clpr_implementation CLP(QR) Predicates
|
/** @addtogroup clpqr CLP(QR)
|
||||||
|
@ingroup packages
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup clpr_implementation CLP(QR) Predicates
|
||||||
@ingroup clpqr
|
@ingroup clpqr
|
||||||
|
@{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @pred bb_inf(+ _Ints_,+ _Expression_,- _Inf_)
|
/** @pred bb_inf(+ _Ints_,+ _Expression_,- _Inf_)
|
||||||
The same as bb_inf/5 but without returning the values of the integers
|
The same as bb_inf/5 but without returning the values of the integers
|
||||||
and with an eps of 0.001.
|
and with an eps of 0.001.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred bb_inf(+ _Ints_,+ _Expression_,- _Inf_,- _Vertext_,+ _Eps_)
|
/** @pred bb_inf(+ _Ints_,+ _Expression_,- _Inf_,- _Vertext_,+ _Eps_)
|
||||||
Computes the infimum of _Expression_ within the current constraint
|
Computes the infimum of _Expression_ within the current constraint
|
||||||
@ -58,7 +63,7 @@ value may differ from an integer to be considered an integer. E.g. when
|
|||||||
_Eps_ = 0.001, then X = 4.999 will be considered as an integer (5 in
|
_Eps_ = 0.001, then X = 4.999 will be considered as an integer (5 in
|
||||||
this case). _Eps_ should be between 0 and 0.5.
|
this case). _Eps_ should be between 0 and 0.5.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred dump(+ _Target_,+ _Newvars_,- _CodedAnswer_)
|
/** @pred dump(+ _Target_,+ _Newvars_,- _CodedAnswer_)
|
||||||
Returns the constraints on _Target_ in the list _CodedAnswer_
|
Returns the constraints on _Target_ in the list _CodedAnswer_
|
||||||
@ -81,28 +86,28 @@ Succeeds if _Constraint_ is necessarily true within the current
|
|||||||
constraint store. This means that adding the negation of the constraint
|
constraint store. This means that adding the negation of the constraint
|
||||||
to the store results in failure.
|
to the store results in failure.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred inf(+ _Expression_,- _Inf_)
|
/** @pred inf(+ _Expression_,- _Inf_)
|
||||||
Computes the infimum of _Expression_ within the current state of the
|
Computes the infimum of _Expression_ within the current state of the
|
||||||
constraint store and returns that infimum in _Inf_. This predicate
|
constraint store and returns that infimum in _Inf_. This predicate
|
||||||
does not change the constraint store.
|
does not change the constraint store.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred inf(+ _Expression_,- _Sup_)
|
/** @pred inf(+ _Expression_,- _Sup_)
|
||||||
Computes the supremum of _Expression_ within the current state of
|
Computes the supremum of _Expression_ within the current state of
|
||||||
the constraint store and returns that supremum in _Sup_. This
|
the constraint store and returns that supremum in _Sup_. This
|
||||||
predicate does not change the constraint store.
|
predicate does not change the constraint store.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred maximize( _V_)
|
/** @pred maximize( _V_)
|
||||||
maximise variable _V_
|
maximise variable _V_
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
/** @pred minimize(<tt>V</tt>)
|
/** @pred minimize(<tt>V</tt>)
|
||||||
minimise variable _V_
|
minimise variable _V_
|
||||||
|
|
||||||
|
|
||||||
@ -205,3 +210,7 @@ memberchk_eq(X,[Y|Ys]) :-
|
|||||||
-> true
|
-> true
|
||||||
; memberchk_eq(X,Ys)
|
; memberchk_eq(X,Ys)
|
||||||
).
|
).
|
||||||
|
|
||||||
|
%% @}
|
||||||
|
|
||||||
|
%% @}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
%% -*- prolog -*-
|
pgec%% -*- prolog -*-
|
||||||
%%=============================================================================
|
%%=============================================================================
|
||||||
%% Copyright (C) 2011 by Denys Duchier
|
%% Copyright (C) 2011 by Denys Duchier
|
||||||
%%
|
%%
|
||||||
@ -6,12 +6,12 @@
|
|||||||
%% under the terms of the GNU Lesser General Public License as published by the
|
%% under the terms of the GNU Lesser General Public License as published by the
|
||||||
%% Free Software Foundation, either version 3 of the License, or (at your
|
%% Free Software Foundation, either version 3 of the License, or (at your
|
||||||
%% option) any later version.
|
%% option) any later version.
|
||||||
%%
|
%%
|
||||||
%% This program is distributed in the hope that it will be useful, but WITHOUT
|
%% This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
%% more details.
|
%% more details.
|
||||||
%%
|
%%
|
||||||
%% You should have received a copy of the GNU Lesser General Public License
|
%% You should have received a copy of the GNU Lesser General Public License
|
||||||
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
%% along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
%%=============================================================================
|
%%=============================================================================
|
||||||
@ -31,7 +31,7 @@ Duchier, with recent work by Vítor Santos Costa to port it to version 4
|
|||||||
of gecode and to have an higher level interface,
|
of gecode and to have an higher level interface,
|
||||||
|
|
||||||
|
|
||||||
@defgroup The_Gecode_Interface The Gecode Interface
|
@addtogroup The_Gecode_Interface The Gecode Interface
|
||||||
@ingroup Gecode
|
@ingroup Gecode
|
||||||
@{
|
@{
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ and lookup values of variables in each solution:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- use_module(library(debug)).
|
:- use_module(library(debug)).
|
||||||
@ -797,11 +797,11 @@ new_setvar(SVar,Space,X1,X2) :-
|
|||||||
new_tupleset( TupleSet, List ) :-
|
new_tupleset( TupleSet, List ) :-
|
||||||
gecode_new_tupleset(List, TupleSet_),
|
gecode_new_tupleset(List, TupleSet_),
|
||||||
TupleSet = 'TupleSet'(TupleSet_).
|
TupleSet = 'TupleSet'(TupleSet_).
|
||||||
|
|
||||||
new_dfa( DFA, S0, List, Finals ) :-
|
new_dfa( DFA, S0, List, Finals ) :-
|
||||||
gecode_new_dfa(DFA_, S0, List, Finals),
|
gecode_new_dfa(DFA_, S0, List, Finals),
|
||||||
DFA = 'DFA'(DFA_).
|
DFA = 'DFA'(DFA_).
|
||||||
|
|
||||||
|
|
||||||
minimize(Space,IVar) :-
|
minimize(Space,IVar) :-
|
||||||
assert_is_Space(Space,Space_),
|
assert_is_Space(Space,Space_),
|
||||||
|
15
packages/md
Normal file
15
packages/md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
This is an experimental interface to BDD libraries. It is not as
|
||||||
|
sophisticated as simplecudd, but it should be fun to play around with bdds.
|
||||||
|
|
||||||
|
It currently works with cudd only, although it should be possible to
|
||||||
|
port to other libraries. It requires the ability to dynamically link
|
||||||
|
with cudd binaries. This works:
|
||||||
|
|
||||||
|
- in fedora with standard package
|
||||||
|
- in osx with hand-compiled and ports package
|
||||||
|
|
||||||
|
In ubuntu, you may want to install the fedora rpm, or just download the package from the original
|
||||||
|
and compile it.
|
||||||
|
|
||||||
|
.
|
@ -1,14 +1,20 @@
|
|||||||
The MYDDAS Data-base interface {#myddas}
|
The MYDDAS Data-base interface {#myddas}
|
||||||
==============================
|
===============================
|
||||||
|
|
||||||
|
@ingroup Packages
|
||||||
|
|
||||||
|
@{
|
||||||
|
|
||||||
|
@file myddas.md
|
||||||
|
|
||||||
The MYDDAS database project was developed within a FCT project aiming at
|
The MYDDAS database project was developed within a FCT project aiming at
|
||||||
the development of a highly efficient deductive database system, based
|
the development of a highly efficient deductive database system, based
|
||||||
on the coupling of the MySQL relational database system with the YAP
|
on the coupling of the MySQL relational database system with the YAP
|
||||||
Prolog system. MYDDAS was later expanded to support the ODBC interface.
|
Prolog system. MYDDAS was later expanded to support the ODBC interface.
|
||||||
|
|
||||||
|
@defgroup Requirements_and_Installation_Guide Requirements and Installation Guide
|
||||||
|
@ingroup #myddas
|
||||||
|
|
||||||
@defgroup Requirements_and_Installation_Guide Requirements and Installation Guide
|
|
||||||
ee
|
|
||||||
Next, we describe how to usen of the YAP with the MYDDAS System. The
|
Next, we describe how to usen of the YAP with the MYDDAS System. The
|
||||||
use of this system is entirely depend of the MySQL development libraries
|
use of this system is entirely depend of the MySQL development libraries
|
||||||
or the ODBC development libraries. At least one of the this development
|
or the ODBC development libraries. At least one of the this development
|
||||||
@ -39,7 +45,8 @@
|
|||||||
two different ways. As if we were on the MySQL Client Shell, and as if
|
two different ways. As if we were on the MySQL Client Shell, and as if
|
||||||
we were using Datalog.
|
we were using Datalog.
|
||||||
|
|
||||||
@defgroup MYDDAS_Architecture MYDDAS Architecture
|
@defgroup MYDDAS_Architecture MYDDAS Architecture
|
||||||
|
@ingroup myddas
|
||||||
|
|
||||||
The system includes four main blocks that are put together through the
|
The system includes four main blocks that are put together through the
|
||||||
MYDDAS interface: the Yap Prolog compiler, the MySQL database system, an
|
MYDDAS interface: the Yap Prolog compiler, the MySQL database system, an
|
||||||
@ -64,33 +71,32 @@
|
|||||||
Prolog cut operator, which has exactly the same behaviour from
|
Prolog cut operator, which has exactly the same behaviour from
|
||||||
predicates defined in the Prolog program source code, or from predicates
|
predicates defined in the Prolog program source code, or from predicates
|
||||||
defined in database as relations.
|
defined in database as relations.
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Name = 'John Doe',
|
Name = 'John Doe',
|
||||||
Number = 123456789 ?
|
Number = 123456789 ?
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Backtracking can then be used to retrieve the next row
|
Backtracking can then be used to retrieve the next row
|
||||||
of the relation phonebook. Records with particular field values may be
|
of the relation phonebook. Records with particular field values may be
|
||||||
selected in the same way as in Prolog. (In particular, no mode
|
selected in the same way as in Prolog. (In particular, no mode
|
||||||
specification for database predicates is required). For instance:
|
specification for database predicates is required). For instance:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- phonebook(Letter,'John Doe',Letter).
|
?- phonebook(Letter,'John Doe',Letter).
|
||||||
Letter = 'D',
|
Letter = 'D',
|
||||||
Number = 123456789 ?
|
Number = 123456789 ?
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
generates the query
|
generates the query
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
SELECT A.Letter , 'John Doe' , A.Number
|
SELECT A.Letter , 'John Doe' , A.Number
|
||||||
FROM 'phonebook' A
|
FROM 'phonebook' A
|
||||||
WHERE A.Name = 'John Doe';
|
WHERE A.Name = 'John Doe';
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@defgroup View_Level_Interface View Level Interface
|
||||||
|
@ingroup myddas
|
||||||
@defgroup View_Level_Interface View Level Interface
|
|
||||||
|
|
||||||
@pred db view(+,+,+).
|
@pred db view(+,+,+).
|
||||||
|
|
||||||
@ -101,18 +107,18 @@
|
|||||||
|
|
||||||
If we import a database relation, such as an edge relation representing the edges of a directed graph, through
|
If we import a database relation, such as an edge relation representing the edges of a directed graph, through
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_import('Edge',edge).
|
?- db_import('Edge',edge).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
sqliand we then write a query to retrieve all the direct cycles in the
|
sqliand we then write a query to retrieve all the direct cycles in the
|
||||||
graph, such as
|
graph, such as
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- edge(A,B), edge(B,A).
|
?- edge(A,B), edge(B,A).
|
||||||
A = 10,
|
A = 10,
|
||||||
B = 20 ?
|
B = 20 ?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
this is clearly inefficient [3], because of relation-level
|
this is clearly inefficient [3], because of relation-level
|
||||||
access. Relation-level access means that a separate SQL query will be
|
access. Relation-level access means that a separate SQL query will be
|
||||||
generated for every goal in the body of the clause. For the second
|
generated for every goal in the body of the clause. For the second
|
||||||
@ -129,10 +135,10 @@
|
|||||||
predicates. One can use the view level interface through the predicates
|
predicates. One can use the view level interface through the predicates
|
||||||
db_view/3 and `db_view/2`:
|
db_view/3 and `db_view/2`:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_view(Conn,PredName(Arg_1,...,Arg_n),DbGoal).
|
?- db_view(Conn,PredName(Arg_1,...,Arg_n),DbGoal).
|
||||||
?- db_view(PredName(Arg_1,...,Arg_n),DbGoal).
|
?- db_view(PredName(Arg_1,...,Arg_n),DbGoal).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
All arguments are standard Prolog terms. _Arg1_ through _Argn_
|
All arguments are standard Prolog terms. _Arg1_ through _Argn_
|
||||||
define the attributes to be retrieved from the database, while
|
define the attributes to be retrieved from the database, while
|
||||||
_DbGoal_ defines the selection restrictions and join
|
_DbGoal_ defines the selection restrictions and join
|
||||||
@ -142,48 +148,48 @@
|
|||||||
an example of a view definition for the direct cycles discussed
|
an example of a view definition for the direct cycles discussed
|
||||||
above. Assuming the declaration:
|
above. Assuming the declaration:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_import('Edge',edge).
|
?- db_import('Edge',edge).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
we
|
we
|
||||||
write:
|
write:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_view(direct_cycle(A,B),(edge(A,B), edge(B,A))).
|
?- db_view(direct_cycle(A,B),(edge(A,B), edge(B,A))).
|
||||||
yes
|
yes
|
||||||
?- direct_cycle(A,B)).
|
?- direct_cycle(A,B)).
|
||||||
A = 10,
|
A = 10,
|
||||||
B = 20 ?
|
B = 20 ?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
This call generates the SQL
|
This call generates the SQL
|
||||||
statement:
|
statement:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
SELECT A.attr1 , A.attr2
|
SELECT A.attr1 , A.attr2
|
||||||
FROM Edge A , Edge B
|
FROM Edge A , Edge B
|
||||||
WHERE B.attr1 = A.attr2 AND B.attr2 = A.attr1;
|
WHERE B.attr1 = A.attr2 AND B.attr2 = A.attr1;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Backtracking, as in relational level interface, can be used to retrieve the next row of the view.
|
Backtracking, as in relational level interface, can be used to retrieve the next row of the view.
|
||||||
The view interface also supports aggregate function predicates such as
|
The view interface also supports aggregate function predicates such as
|
||||||
`sum`, `avg`, `count`, `min` and `max`. For
|
`sum`, `avg`, `count`, `min` and `max`. For
|
||||||
instance:
|
instance:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_view(count(X),(X is count(B, B^edge(10,B)))).
|
?- db_view(count(X),(X is count(B, B^edge(10,B)))).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
generates the query :
|
generates the query :
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
SELECT COUNT(A.attr2)
|
SELECT COUNT(A.attr2)
|
||||||
FROM Edge A WHERE A.attr1 = 10;
|
FROM Edge A WHERE A.attr1 = 10;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
To know how to use db `view/3`, please refer to Draxler's Prolog to
|
To know how to use db `view/3`, please refer to Draxler's Prolog to
|
||||||
SQL Compiler Manual.
|
SQL Compiler Manual.
|
||||||
|
@defgroup Accessing_Tables_in_Data_Sources_Using_SQL Accessing Tables in Data Sources Using SQL
|
||||||
@defgroup Accessing_Tables_in_Data_Sources_Using_SQL Accessing Tables in Data Sources Using SQL
|
@ingroup myddas
|
||||||
|
|
||||||
|
|
||||||
@pred db_sql(+,+,?).
|
@pred db_sql(+,+,?).
|
||||||
@ -196,22 +202,22 @@
|
|||||||
|
|
||||||
It is also possible to explicitly send a SQL query to the database server using
|
It is also possible to explicitly send a SQL query to the database server using
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_sql(Conn,SQL,List).
|
?- db_sql(Conn,SQL,List).
|
||||||
?- db_sql(SQL,List).
|
?- db_sql(SQL,List).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
where _SQL_ is an arbitrary SQL expression, and _List_ is a list
|
where _SQL_ is an arbitrary SQL expression, and _List_ is a list
|
||||||
holding the first tuple of result set returned by the server. The result
|
holding the first tuple of result set returned by the server. The result
|
||||||
set can also be navigated through backtracking.
|
set can also be navigated through backtracking.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_sql('SELECT * FROM phonebook',LA).
|
?- db_sql('SELECT * FROM phonebook',LA).
|
||||||
LA = ['D','John Doe',123456789] ?
|
LA = ['D','John Doe',123456789] ?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@defgroup Insertion_of_Rows Insertion of Rows
|
||||||
@defgroup Insertion_of_Rows Insertion of Rows
|
@ingroup myddas
|
||||||
@ingroup MYDDAS
|
@ingroup MYDDAS
|
||||||
|
|
||||||
@pred db_assert(+,+).
|
@pred db_assert(+,+).
|
||||||
@ -224,36 +230,36 @@
|
|||||||
`db_import/2` or db_import/3, you can insert to that table
|
`db_import/2` or db_import/3, you can insert to that table
|
||||||
by using db_assert/2 predicate any given fact.
|
by using db_assert/2 predicate any given fact.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_assert(Conn,Fact).
|
?- db_assert(Conn,Fact).
|
||||||
?- db_assert(Fact).
|
?- db_assert(Fact).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
The second argument must be declared with all of its arguments bound to
|
The second argument must be declared with all of its arguments bound to
|
||||||
constants. For example assuming `helloWorld` is imported through
|
constants. For example assuming `helloWorld` is imported through
|
||||||
`db_import/2`:
|
`db_import/2`:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_import('Hello World',helloWorld).
|
?- db_import('Hello World',helloWorld).
|
||||||
yes
|
yes
|
||||||
?- db_assert(helloWorld('A' ,'Ana',31)).
|
?- db_assert(helloWorld('A' ,'Ana',31)).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
This, would generate the following query
|
This, would generate the following query
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
INSERT INTO helloWorld
|
INSERT INTO helloWorld
|
||||||
VALUES ('A','Ana',3)
|
VALUES ('A','Ana',3)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
which would insert into the helloWorld, the following row:
|
which would insert into the helloWorld, the following row:
|
||||||
`A,Ana,31`. If we want to insert `NULL` values into the
|
`A,Ana,31`. If we want to insert `NULL` values into the
|
||||||
relation, we call db_assert/2 with a uninstantiated variable in
|
relation, we call db_assert/2 with a uninstantiated variable in
|
||||||
the data base imported predicate. For example, the following query on
|
the data base imported predicate. For example, the following query on
|
||||||
the YAP-prolog system:
|
the YAP-prolog system:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_assert(helloWorld('A',NULL,31)).
|
?- db_assert(helloWorld('A',NULL,31)).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Would insert the row: `A,null value,31` into the relation
|
Would insert the row: `A,null value,31` into the relation
|
||||||
`Hello World`, assuming that the second row allows null values.
|
`Hello World`, assuming that the second row allows null values.
|
||||||
@ -268,22 +274,23 @@
|
|||||||
This predicate would create a new database predicate, which will insert
|
This predicate would create a new database predicate, which will insert
|
||||||
any given tuple into the database.
|
any given tuple into the database.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_insert(Conn,RelationName,PredName).
|
?- db_insert(Conn,RelationName,PredName).
|
||||||
?- db_insert(RelationName,PredName).
|
?- db_insert(RelationName,PredName).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
This would create a new predicate with name _PredName_, that will
|
This would create a new predicate with name _PredName_, that will
|
||||||
insert tuples into the relation _RelationName_. is the connection
|
insert tuples into the relation _RelationName_. is the connection
|
||||||
identifier. For example, if we wanted to insert the new tuple
|
identifier. For example, if we wanted to insert the new tuple
|
||||||
`('A',null,31)` into the relation `Hello World`, we do:
|
`('A',null,31)` into the relation `Hello World`, we do:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_insert('Hello World',helloWorldInsert).
|
?- db_insert('Hello World',helloWorldInsert).
|
||||||
yes
|
yes
|
||||||
?- helloWorldInsert('A',NULL,31).
|
?- helloWorldInsert('A',NULL,31).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@defgroup Types_of_Attributes Types of AttributesL
|
@defgroup Types_of_Attributes Types of AttributesL
|
||||||
|
@ingroup myddas
|
||||||
|
|
||||||
|
|
||||||
@pred db_get_attributes_types(+,+,?).
|
@pred db_get_attributes_types(+,+,?).
|
||||||
@ -297,25 +304,25 @@
|
|||||||
|
|
||||||
The prototype for this predicate is the following:
|
The prototype for this predicate is the following:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_get_attributes_types(Conn,RelationName,ListOfFields).
|
?- db_get_attributes_types(Conn,RelationName,ListOfFields).
|
||||||
?- db_get_attributes_types(RelationName,ListOfFields).
|
?- db_get_attributes_types(RelationName,ListOfFields).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
You can use the
|
You can use the
|
||||||
predicate `db_get_attributes types/2` or db_get_attributes_types/3, to
|
predicate `db_get_attributes types/2` or db_get_attributes_types/3, to
|
||||||
know what are the names and attributes types of the fields of a given
|
know what are the names and attributes types of the fields of a given
|
||||||
relation. For example:
|
relation. For example:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_get_attributes_types(myddas,'Hello World',LA).
|
?- db_get_attributes_types(myddas,'Hello World',LA).
|
||||||
LA = ['Number',integer,'Name',string,'Letter',string] ?
|
LA = ['Number',integer,'Name',string,'Letter',string] ?
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
where <tt>Hello World</tt> is the name of the relation and <tt>myddas</tt> is the
|
where <tt>Hello World</tt> is the name of the relation and <tt>myddas</tt> is the
|
||||||
connection identifier.
|
connection identifier.
|
||||||
|
@defgroup Number_of_Fields Number of Fields
|
||||||
@defgroup Number_of_Fields Number of Fields
|
@ingroup myddas
|
||||||
|
|
||||||
|
|
||||||
@pred db_number_of_fields(+,?).
|
@pred db_number_of_fields(+,?).
|
||||||
@ -326,23 +333,24 @@
|
|||||||
The prototype for this
|
The prototype for this
|
||||||
predicate is the following:
|
predicate is the following:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_number_of_fields(Conn,RelationName,Arity).
|
?- db_number_of_fields(Conn,RelationName,Arity).
|
||||||
?- db_number_of_fields(RelationName,Arity).
|
?- db_number_of_fields(RelationName,Arity).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
You can use the predicate db_number_of_fields/2 or
|
You can use the predicate db_number_of_fields/2 or
|
||||||
`db_number_of_fields/3` to know what is the arity of a given
|
`db_number_of_fields/3` to know what is the arity of a given
|
||||||
relation. Example:
|
relation. Example:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_number_of_fields(myddas,'Hello World',Arity).
|
?- db_number_of_fields(myddas,'Hello World',Arity).
|
||||||
Arity = 3 ?
|
Arity = 3 ?
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
where `Hello World` is the name of the
|
where `Hello World` is the name of the
|
||||||
relation and `myddas` is the connection identifier.
|
relation and `myddas` is the connection identifier.
|
||||||
|
|
||||||
@defgroup Describing_a_Relation Describing a Relation
|
@defgroup Describing_a_Relation Describing a Relation
|
||||||
|
@ingroup #myddas
|
||||||
|
|
||||||
@pred db_datalog_describe(+,+).
|
@pred db_datalog_describe(+,+).
|
||||||
@pred db_datalog_describe(+).
|
@pred db_datalog_describe(+).
|
||||||
@ -353,7 +361,7 @@
|
|||||||
value. It simply prints to the screen the result of the MySQL describe
|
value. It simply prints to the screen the result of the MySQL describe
|
||||||
command, the same way as `DESCRIBE` in the MySQL prompt would.
|
command, the same way as `DESCRIBE` in the MySQL prompt would.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_datalog_describe(myddas,'Hello World').
|
?- db_datalog_describe(myddas,'Hello World').
|
||||||
+----------+----------+------+-----+---------+-------+
|
+----------+----------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
@ -363,7 +371,7 @@
|
|||||||
+ Letter | char(1) | YES | | NULL | |
|
+ Letter | char(1) | YES | | NULL | |
|
||||||
+----------+----------+------+-----+---------+-------+
|
+----------+----------+------+-----+---------+-------+
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@pred db_describe(+,+).
|
@pred db_describe(+,+).
|
||||||
|
|
||||||
@ -376,15 +384,15 @@
|
|||||||
difference. The results are returned by backtracking. For example, the
|
difference. The results are returned by backtracking. For example, the
|
||||||
last query:
|
last query:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_describe(myddas,'Hello World',Term).
|
?- db_describe(myddas,'Hello World',Term).
|
||||||
Term = tableInfo('Number',int(11),'YES','',null(0),'') ? ;
|
Term = tableInfo('Number',int(11),'YES','',null(0),'') ? ;
|
||||||
Term = tableInfo('Name',char(10),'YES','',null(1),'' ? ;
|
Term = tableInfo('Name',char(10),'YES','',null(1),'' ? ;
|
||||||
Term = tableInfo('Letter',char(1),'YES','',null(2),'') ? ;
|
Term = tableInfo('Letter',char(1),'YES','',null(2),'') ? ;
|
||||||
no
|
no
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@defgroup Enumerating_Relations Enumeration Relations Describing_a_Relation Describing a Relation
|
||||||
@defgroup Enumerating_Relations Enumeration Relations Describing_a_Relation Describing a Relation
|
@ingroup #myddas
|
||||||
|
|
||||||
|
|
||||||
/@pred db_datalog_show_tables(+).
|
/@pred db_datalog_show_tables(+).
|
||||||
@ -396,7 +404,7 @@
|
|||||||
it does not returns any value, but instead prints to the screen the result of the
|
it does not returns any value, but instead prints to the screen the result of the
|
||||||
`SHOW TABLES` command, the same way as it would be in the MySQL prompt.
|
`SHOW TABLES` command, the same way as it would be in the MySQL prompt.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_datalog_show_tables(myddas).
|
?- db_datalog_show_tables(myddas).
|
||||||
+-----------------+
|
+-----------------+
|
||||||
| Tables_in_guest |
|
| Tables_in_guest |
|
||||||
@ -404,7 +412,7 @@
|
|||||||
| Hello World |
|
| Hello World |
|
||||||
+-----------------+
|
+-----------------+
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@pred db_show_tables(+, ?).
|
@pred db_show_tables(+, ?).
|
||||||
|
|
||||||
|
|
||||||
@ -418,12 +426,15 @@
|
|||||||
`db_show_tables/1` predicate but with one major difference. The
|
`db_show_tables/1` predicate but with one major difference. The
|
||||||
results are returned by backtracking. For example, given the last query:
|
results are returned by backtracking. For example, given the last query:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_show_tables(myddas,Table).
|
?- db_show_tables(myddas,Table).
|
||||||
Table = table('Hello World') ? ;
|
Table = table('Hello World') ? ;
|
||||||
no
|
no
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@defgroup The_MYDDAS_MySQL_Top_Level The MYDDAS MySQL Top Level
|
|
||||||
|
|
||||||
|
@defgroup The_MYDDAS_MySQL_Top_Level The MYDDAS MySQL Top Level
|
||||||
|
@ingroup #myddas
|
||||||
|
|
||||||
@pred db_top_level(+,+,+,+,+).
|
@pred db_top_level(+,+,+,+,+).
|
||||||
@pred db_top_level(+,+,+,+).
|
@pred db_top_level(+,+,+,+).
|
||||||
@ -437,27 +448,27 @@
|
|||||||
different from the standard mysql client. We can use this
|
different from the standard mysql client. We can use this
|
||||||
mode, by invoking the db top level/5. as one of the following:
|
mode, by invoking the db top level/5. as one of the following:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_top_level(mysql,Connection,Host/Database,User,Password).
|
?- db_top_level(mysql,Connection,Host/Database,User,Password).
|
||||||
?- db_top_level(mysql,Connection,Host/Database/Port,User,Password).
|
?- db_top_level(mysql,Connection,Host/Database/Port,User,Password).
|
||||||
?- db_top_level(mysql,Connection,Host/Database/UnixSocket,User,Password).
|
?- db_top_level(mysql,Connection,Host/Database/UnixSocket,User,Password).
|
||||||
?- db_top_level(mysql,Connection,Host/Database/Port/UnixSocket,User,Password).
|
?- db_top_level(mysql,Connection,Host/Database/Port/UnixSocket,User,Password).
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Usage is similar as the one described for the db_open/5 predicate
|
Usage is similar as the one described for the db_open/5 predicate
|
||||||
discussed above. If the login is successful, automatically the prompt of
|
discussed above. If the login is successful, automatically the prompt of
|
||||||
the mysql client will be used. For example:
|
the mysql client will be used. For example:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_top_level(mysql,con1,localhost/guest_db,guest,'').
|
?- db_top_level(mysql,con1,localhost/guest_db,guest,'').
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
opens a
|
opens a
|
||||||
connection identified by the `con1` atom, to an instance of a MySQL server
|
connection identified by the `con1` atom, to an instance of a MySQL server
|
||||||
running on host `localhost`, using database guest `db` and user `guest` with
|
running on host `localhost`, using database guest `db` and user `guest` with
|
||||||
empty password. After this is possible to use MYDDAS as the mysql
|
empty password. After this is possible to use MYDDAS as the mysql
|
||||||
client.
|
client.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_top_level(mysql,con1,localhost/guest_db,guest,'').
|
?- db_top_level(mysql,con1,localhost/guest_db,guest,'').
|
||||||
Reading table information for completion of table and column names
|
Reading table information for completion of table and column names
|
||||||
You can turn off this feature to get a quicker startup with -A
|
You can turn off this feature to get a quicker startup with -A
|
||||||
@ -472,8 +483,10 @@
|
|||||||
Bye
|
Bye
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@defgroup Other_MYDDAS_Properties Other MYDDAS Properties
|
|
||||||
|
@defgroup Other_MYDDAS_Properties Other MYDDAS Properties
|
||||||
|
@ingroup #myddas
|
||||||
|
|
||||||
@pred db_verbose(+).
|
@pred db_verbose(+).
|
||||||
|
|
||||||
@ -483,11 +496,11 @@
|
|||||||
`QUERY`. If we want to see that query, we must to this at a given
|
`QUERY`. If we want to see that query, we must to this at a given
|
||||||
point in our session on YAP.
|
point in our session on YAP.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_verbose(1).
|
?- db_verbose(1).
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
If we want to
|
If we want to
|
||||||
disable this feature, we must call the `db_verbose/1` predicate with the value 0.
|
disable this feature, we must call the `db_verbose/1` predicate with the value 0.
|
||||||
|
|
||||||
@ -504,51 +517,51 @@
|
|||||||
by default on the `user` module. If we want to change this value, we can
|
by default on the `user` module. If we want to change this value, we can
|
||||||
use the db_module/1 predicate to do so.
|
use the db_module/1 predicate to do so.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_module(lists).
|
?- db_module(lists).
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
By executing this predicate, all of the predicates asserted by the
|
By executing this predicate, all of the predicates asserted by the
|
||||||
predicates enumerated earlier will created in the lists module.
|
predicates enumerated earlier will created in the lists module.
|
||||||
If we want to put back the value on default, we can manually put the
|
If we want to put back the value on default, we can manually put the
|
||||||
value user. Example:
|
value user. Example:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_module(user).
|
?- db_module(user).
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
We can also see in what module the predicates are being asserted by doing:
|
We can also see in what module the predicates are being asserted by doing:
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_module(X).
|
?- db_module(X).
|
||||||
X=user
|
X=user
|
||||||
yes
|
yes
|
||||||
?-
|
?-
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@pred db_my_result_set(?).
|
@pred db_my_result_set(?).
|
||||||
|
|
||||||
The MySQL C API permits two modes for transferring the data generated by
|
The MySQL C API permits two modes for transferring the data generated by
|
||||||
a query to the client, in our case YAP. The first mode, and the default
|
a query to the client, in our case YAP. The first mode, and the default
|
||||||
mode used by the MYDDAS-MySQL, is to store the result. This mode copies all the
|
mod-MySQL, is to store the result. This mode copies all the
|
||||||
information generated to the client side.
|
information generated to the client side.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_my_result_set(X).
|
?- db_my_result_set(X).
|
||||||
X=store_result
|
X=store_result
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
The other mode that we can use is use result. This one uses the result
|
The other mode that we can use is use result. This one uses the result
|
||||||
set created directly from the server. If we want to use this mode, he
|
set created directly from the server. If we want to use this mode, he
|
||||||
simply do
|
simply do
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?- db_my_result_set(use_result).
|
?- db_my_result_set(use_result).
|
||||||
yes
|
yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
After this command, all
|
After this command, all
|
||||||
of the database predicates will use use result by default. We can change
|
of the database predicates will use use result by default. We can change
|
||||||
this by doing again `db_my_result_set(store_result)`.
|
this by doing again `db_my_result_set(store_result)`.
|
||||||
@ -567,8 +580,10 @@
|
|||||||
not to ignore the INSERT statement warnings and instead of taking
|
not to ignore the INSERT statement warnings and instead of taking
|
||||||
action, report an error, we could use the following SQL mode.
|
action, report an error, we could use the following SQL mode.
|
||||||
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
?-db_my_sql_mode(traditional). yes
|
?-db_my_sql_mode(traditional). yes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
You can see the available SQL Modes at the MySQL homepage at
|
You can see the available SQL Modes at the MySQL homepage at
|
||||||
<http://www.mysql.org>.
|
<http://www.mysql.org>.
|
||||||
|
|
||||||
|
@}
|
@ -1,4 +1,4 @@
|
|||||||
WWW Reader/Writers for YAP. {#YAPRaptor}
|
WWW Reader/Writers for YAP. {#raptor}
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
This provides YAP a rdf reader using
|
This provides YAP a rdf reader using
|
@ -6,7 +6,7 @@ The R Prolog Progrmming Interface {#real}
|
|||||||
@author Vitor Santos Costa
|
@author Vitor Santos Costa
|
||||||
@version 1:0:4, 2013/12/25, sinter_class
|
@version 1:0:4, 2013/12/25, sinter_class
|
||||||
@license Perl Artistic License
|
@license Perl Artistic License
|
||||||
@defgroup libReal An interface to the R statistical software.
|
|
||||||
@ingroup packages
|
@ingroup packages
|
||||||
|
|
||||||
|
|
11
packages/yap-lbfgs/liblbfgs-1.10/include/lbfgs.h
vendored
11
packages/yap-lbfgs/liblbfgs-1.10/include/lbfgs.h
vendored
@ -59,8 +59,9 @@ typedef double lbfgsfloatval_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \addtogroup liblbfgs_api libLBFGS API
|
* \addtogroup liblbfgs_api libLBFGS API
|
||||||
|
* @ingroup YAP-LBFGS
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
* The libLBFGS API.
|
* The libLBFGS API.
|
||||||
@ -68,7 +69,7 @@ typedef double lbfgsfloatval_t;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return values of lbfgs().
|
* Return values of lbfgs().
|
||||||
*
|
*
|
||||||
* Roughly speaking, a negative value indicates an error.
|
* Roughly speaking, a negative value indicates an error.
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
@ -365,7 +366,7 @@ typedef struct {
|
|||||||
* function and its gradients when needed. A client program must implement
|
* function and its gradients when needed. A client program must implement
|
||||||
* this function to evaluate the values of the objective function and its
|
* this function to evaluate the values of the objective function and its
|
||||||
* gradients, given current values of variables.
|
* gradients, given current values of variables.
|
||||||
*
|
*
|
||||||
* @param instance The user data sent for lbfgs() function by the client.
|
* @param instance The user data sent for lbfgs() function by the client.
|
||||||
* @param x The current values of variables.
|
* @param x The current values of variables.
|
||||||
* @param g The gradient vector. The callback function must compute
|
* @param g The gradient vector. The callback function must compute
|
||||||
@ -502,14 +503,14 @@ void lbfgs_parameter_init(lbfgs_parameter_t *param);
|
|||||||
* when libLBFGS is built with SSE/SSE2 optimization routines. A user does
|
* when libLBFGS is built with SSE/SSE2 optimization routines. A user does
|
||||||
* not have to use this function for libLBFGS built without SSE/SSE2
|
* not have to use this function for libLBFGS built without SSE/SSE2
|
||||||
* optimization.
|
* optimization.
|
||||||
*
|
*
|
||||||
* @param n The number of variables.
|
* @param n The number of variables.
|
||||||
*/
|
*/
|
||||||
lbfgsfloatval_t* lbfgs_malloc(int n);
|
lbfgsfloatval_t* lbfgs_malloc(int n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free an array of variables.
|
* Free an array of variables.
|
||||||
*
|
*
|
||||||
* @param x The array of variables allocated by ::lbfgs_malloc
|
* @param x The array of variables allocated by ::lbfgs_malloc
|
||||||
* function.
|
* function.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <string.h>
|
o#include <string.h>
|
||||||
#include "YapInterface.h"
|
#include "YapInterface.h"
|
||||||
#include <lbfgs.h>
|
#include <lbfgs.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -60,9 +60,9 @@ static lbfgsfloatval_t evaluate(
|
|||||||
t[2] = YAP_MkFloatTerm(step);
|
t[2] = YAP_MkFloatTerm(step);
|
||||||
|
|
||||||
call = YAP_MkApplTerm(fcall3, 3, t);
|
call = YAP_MkApplTerm(fcall3, 3, t);
|
||||||
g=g_tmp;
|
g=g_tmp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
s1 = YAP_InitSlot(call);
|
s1 = YAP_InitSlot(call);
|
||||||
optimizer_status=OPTIMIZER_STATUS_CB_EVAL;
|
optimizer_status=OPTIMIZER_STATUS_CB_EVAL;
|
||||||
result=YAP_CallProlog(call);
|
result=YAP_CallProlog(call);
|
||||||
@ -151,7 +151,7 @@ static YAP_Bool set_x_value(void) {
|
|||||||
printf("ERROR: set_x_value/2 can be called only when the optimizer is initialized and not running.\n");
|
printf("ERROR: set_x_value/2 can be called only when the optimizer is initialized and not running.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (YAP_IsIntTerm(t1)) {
|
if (YAP_IsIntTerm(t1)) {
|
||||||
i=YAP_IntOfTerm(t1);
|
i=YAP_IntOfTerm(t1);
|
||||||
} else {
|
} else {
|
||||||
@ -183,12 +183,12 @@ static YAP_Bool get_x_value(void) {
|
|||||||
YAP_Term t1=YAP_ARG1;
|
YAP_Term t1=YAP_ARG1;
|
||||||
YAP_Term t2=YAP_ARG2;
|
YAP_Term t2=YAP_ARG2;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
if (optimizer_status==OPTIMIZER_STATUS_NONE) {
|
if (optimizer_status==OPTIMIZER_STATUS_NONE) {
|
||||||
printf("ERROR: set_x_value/2 can be called only when the optimizer is initialized.\n");
|
printf("ERROR: set_x_value/2 can be called only when the optimizer is initialized.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (YAP_IsIntTerm(t1)) {
|
if (YAP_IsIntTerm(t1)) {
|
||||||
i=YAP_IntOfTerm(t1);
|
i=YAP_IntOfTerm(t1);
|
||||||
} else {
|
} else {
|
||||||
@ -219,7 +219,7 @@ static YAP_Bool set_g_value(void) {
|
|||||||
printf("ERROR: optimizer_set_g/2 can only be called by the evaluation call back function.\n");
|
printf("ERROR: optimizer_set_g/2 can only be called by the evaluation call back function.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (YAP_IsIntTerm(t1)) {
|
if (YAP_IsIntTerm(t1)) {
|
||||||
i=YAP_IntOfTerm(t1);
|
i=YAP_IntOfTerm(t1);
|
||||||
} else {
|
} else {
|
||||||
@ -256,7 +256,7 @@ static YAP_Bool get_g_value(void) {
|
|||||||
printf("ERROR: optimizer_get_g/2 can only be called while the optimizer is running.\n");
|
printf("ERROR: optimizer_get_g/2 can only be called while the optimizer is running.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (YAP_IsIntTerm(t1)) {
|
if (YAP_IsIntTerm(t1)) {
|
||||||
i=YAP_IntOfTerm(t1);
|
i=YAP_IntOfTerm(t1);
|
||||||
} else {
|
} else {
|
||||||
@ -272,18 +272,18 @@ static YAP_Bool get_g_value(void) {
|
|||||||
|
|
||||||
/** @pred optimizer_initialize(+N,+Module,+Evaluate,+Progress)
|
/** @pred optimizer_initialize(+N,+Module,+Evaluate,+Progress)
|
||||||
Create space to optimize a function with _N_ variables (_N_ has to be
|
Create space to optimize a function with _N_ variables (_N_ has to be
|
||||||
integer).
|
integer).
|
||||||
|
|
||||||
+ _Module</span>_ is the name of the module where the call back
|
+ _Module</span>_ is the name of the module where the call back
|
||||||
predicates can be found,
|
predicates can be found,
|
||||||
|
|
||||||
+ _Evaluate_ is the call back predicate (arity 3)
|
+ _Evaluate_ is the call back predicate (arity 3)
|
||||||
to evaluate the function math <span class="math">_F</span>_,
|
to evaluate the function math <span class="math">_F</span>_,
|
||||||
|
|
||||||
+ _Progress_ is the call back predicate invoked
|
+ _Progress_ is the call back predicate invoked
|
||||||
(arity 8) after every iteration
|
(arity 8) after every iteration
|
||||||
|
|
||||||
Example
|
Example
|
||||||
~~~~
|
~~~~
|
||||||
optimizer_initialize(1,user,evaluate,progress)</span>
|
optimizer_initialize(1,user,evaluate,progress)</span>
|
||||||
~~~~
|
~~~~
|
||||||
@ -314,7 +314,7 @@ value will terminate the optimization process.
|
|||||||
static YAP_Bool optimizer_initialize(void) {
|
static YAP_Bool optimizer_initialize(void) {
|
||||||
YAP_Term t1 = YAP_ARG1;
|
YAP_Term t1 = YAP_ARG1;
|
||||||
int temp_n=0;
|
int temp_n=0;
|
||||||
|
|
||||||
if (optimizer_status!=OPTIMIZER_STATUS_NONE) {
|
if (optimizer_status!=OPTIMIZER_STATUS_NONE) {
|
||||||
printf("ERROR: Optimizer has already been initialized. Please call optimizer_finalize/0 first.\n");
|
printf("ERROR: Optimizer has already been initialized. Please call optimizer_finalize/0 first.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -365,13 +365,13 @@ static YAP_Bool optimizer_run(void) {
|
|||||||
printf("ERROR: Memory for parameter vector not initialized, please call optimizer_initialize/1 first.\n");
|
printf("ERROR: Memory for parameter vector not initialized, please call optimizer_initialize/1 first.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optimizer_status != OPTIMIZER_STATUS_INITIALIZED) {
|
if (optimizer_status != OPTIMIZER_STATUS_INITIALIZED) {
|
||||||
printf("ERROR: Optimizer is running right now. Please wait till it is finished.\n");
|
printf("ERROR: Optimizer is running right now. Please wait till it is finished.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// both arguments have to be variables
|
// both arguments have to be variables
|
||||||
if (! YAP_IsVarTerm(t1) || ! YAP_IsVarTerm(t2)) {
|
if (! YAP_IsVarTerm(t1) || ! YAP_IsVarTerm(t2)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -439,7 +439,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.m = YAP_IntOfTerm(t2);
|
param.m = YAP_IntOfTerm(t2);
|
||||||
} else if ((strcmp(name, "epsilon") == 0)) {
|
} else if ((strcmp(name, "epsilon") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -456,7 +456,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.past = YAP_IntOfTerm(t2);
|
param.past = YAP_IntOfTerm(t2);
|
||||||
} else if ((strcmp(name, "delta") == 0)) {
|
} else if ((strcmp(name, "delta") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -483,7 +483,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.max_linesearch = YAP_IntOfTerm(t2);
|
param.max_linesearch = YAP_IntOfTerm(t2);
|
||||||
} else if ((strcmp(name, "min_step") == 0)) {
|
} else if ((strcmp(name, "min_step") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -495,7 +495,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.min_step=v;
|
param.min_step=v;
|
||||||
} else if ((strcmp(name, "max_step") == 0)) {
|
} else if ((strcmp(name, "max_step") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -507,7 +507,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.max_step=v;
|
param.max_step=v;
|
||||||
} else if ((strcmp(name, "ftol") == 0)) {
|
} else if ((strcmp(name, "ftol") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -519,7 +519,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.ftol=v;
|
param.ftol=v;
|
||||||
} else if ((strcmp(name, "gtol") == 0)) {
|
} else if ((strcmp(name, "gtol") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -531,7 +531,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.gtol=v;
|
param.gtol=v;
|
||||||
} else if ((strcmp(name, "xtol") == 0)) {
|
} else if ((strcmp(name, "xtol") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -543,7 +543,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
param.xtol=v;
|
param.xtol=v;
|
||||||
} else if ((strcmp(name, "orthantwise_c") == 0)) {
|
} else if ((strcmp(name, "orthantwise_c") == 0)) {
|
||||||
lbfgsfloatval_t v;
|
lbfgsfloatval_t v;
|
||||||
|
|
||||||
if (YAP_IsFloatTerm(t2)) {
|
if (YAP_IsFloatTerm(t2)) {
|
||||||
v=YAP_FloatOfTerm(t2);
|
v=YAP_FloatOfTerm(t2);
|
||||||
} else if (YAP_IsIntTerm(t2)) {
|
} else if (YAP_IsIntTerm(t2)) {
|
||||||
@ -567,7 +567,7 @@ static YAP_Bool optimizer_set_parameter( void ) {
|
|||||||
printf("ERROR: The parameter %s is unknown.\n",name);
|
printf("ERROR: The parameter %s is unknown.\n",name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,8 +626,8 @@ static YAP_Bool optimizer_get_parameter( void ) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void init_lbfgs_predicates( void )
|
void init_lbfgs_predicates( void )
|
||||||
{
|
{
|
||||||
fcall3 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_evaluate"), 3);
|
fcall3 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_evaluate"), 3);
|
||||||
fprogress8 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_progress"), 8);
|
fprogress8 = YAP_MkFunctor(YAP_LookupAtom("$lbfgs_callback_progress"), 8);
|
||||||
|
|
||||||
@ -646,4 +646,4 @@ void init_lbfgs_predicates( void )
|
|||||||
|
|
||||||
YAP_UserCPredicate("optimizer_set_parameter",optimizer_set_parameter,2);
|
YAP_UserCPredicate("optimizer_set_parameter",optimizer_set_parameter,2);
|
||||||
YAP_UserCPredicate("optimizer_get_parameter",optimizer_get_parameter,2);
|
YAP_UserCPredicate("optimizer_get_parameter",optimizer_get_parameter,2);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@file atoms.yap
|
* @file atoms.yap
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -23,8 +23,8 @@
|
|||||||
:- use_system_module( '$_errors', ['$do_error'/2]).
|
:- use_system_module( '$_errors', ['$do_error'/2]).
|
||||||
|
|
||||||
|
|
||||||
/?**
|
/**
|
||||||
* @addtogroup Predicates_on_Atoms
|
* @addtogroup Predicates_on_Atoms
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* *
|
* *
|
||||||
* File: atts.yap *
|
* File: atts.yap *
|
||||||
* Last rev: 8/2/88 *
|
* Last rev: 8/2/88 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: attribute support for Prolog *
|
* comments: attribute support for Prolog *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
@ -18,9 +18,11 @@
|
|||||||
/**
|
/**
|
||||||
@file attributes.yap
|
@file attributes.yap
|
||||||
|
|
||||||
@{
|
|
||||||
|
|
||||||
@addtogroup New_Style_Attribute_Declarations
|
@defgroup New_Style_Attribute_Declarations SWI Compatible attributes
|
||||||
|
@{
|
||||||
|
@ingroup attributes
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- module('$attributes', [
|
:- module('$attributes', [
|
||||||
@ -489,7 +491,6 @@ typically this will involve expressing all constraints in terms of
|
|||||||
_QueryVars_ and considering all remaining variables as existentially
|
_QueryVars_ and considering all remaining variables as existentially
|
||||||
quantified.
|
quantified.
|
||||||
|
|
||||||
|
|
||||||
Projection interacts with attribute_goal/2 at the Prolog top
|
Projection interacts with attribute_goal/2 at the Prolog top
|
||||||
level. When the query succeeds, the system first calls
|
level. When the query succeeds, the system first calls
|
||||||
project_attributes/2. The system then calls
|
project_attributes/2. The system then calls
|
||||||
@ -498,8 +499,6 @@ constraints. Typically, attribute_goal/2 will convert from the
|
|||||||
original constraints into a set of new constraints on the projection,
|
original constraints into a set of new constraints on the projection,
|
||||||
and these constraints are the ones that will have an
|
and these constraints are the ones that will have an
|
||||||
attribute_goal/2 handler.
|
attribute_goal/2 handler.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
project_attributes(AllVs, G) :-
|
project_attributes(AllVs, G) :-
|
||||||
attributes:modules_with_attributes(LMods),
|
attributes:modules_with_attributes(LMods),
|
||||||
@ -523,6 +522,6 @@ project_module([Mod|LMods], LIV, LAV) :-
|
|||||||
project_module([_|LMods], LIV, LAV) :-
|
project_module([_|LMods], LIV, LAV) :-
|
||||||
project_module(LMods,LIV,LAV).
|
project_module(LMods,LIV,LAV).
|
||||||
|
|
||||||
/**
|
%% @}
|
||||||
@}
|
|
||||||
*/
|
|
||||||
|
@ -74,12 +74,13 @@
|
|||||||
|
|
||||||
:- use_system_module( '$_preds', ['$current_predicate'/4]).
|
:- use_system_module( '$_preds', ['$current_predicate'/4]).
|
||||||
|
|
||||||
%% @{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@defgroup YAPConsulting Loading files into YAP
|
@defgroup YAPConsulting Loading files into YAP
|
||||||
@ingroup consult
|
@ingroup consult
|
||||||
|
|
||||||
|
@{
|
||||||
|
|
||||||
We present the main predicates and directives available to load
|
We present the main predicates and directives available to load
|
||||||
files and to set-up the Prolog environment. We discuss
|
files and to set-up the Prolog environment. We discuss
|
||||||
|
|
||||||
@ -87,12 +88,10 @@ files and to set-up the Prolog environment. We discuss
|
|||||||
|
|
||||||
+ @ref YAPCompilerSettings
|
+ @ref YAPCompilerSettings
|
||||||
|
|
||||||
@{
|
|
||||||
|
|
||||||
@defgroup YAPReadFiles The Predicates that Read Source Files
|
@defgroup YAPReadFiles The Predicates that Read Source Files
|
||||||
@ingroup YAPConsulting
|
@ingroup YAPConsulting
|
||||||
|
|
||||||
|
@{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
* @addtogroup extensions Extensions to Core Prolog
|
* @addtogroup extensions Extensions to Core Prolog
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
* @ addtogroup AttributeVariables Attributed Variables and Co-Routining
|
* @ addtogroup attributes Attributed Variables and Co-Routining
|
||||||
* @{
|
* @{
|
||||||
* @brief Support for co-routining
|
* @brief Support for co-routining
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -43,8 +43,7 @@
|
|||||||
|
|
||||||
:- use_system_module( '$_boot', ['$$compile'/4]).
|
:- use_system_module( '$_boot', ['$$compile'/4]).
|
||||||
|
|
||||||
:- use_system_module( '$_errors', ['$do_error'/2]).
|
|
||||||
|
|
||||||
:- use_system_module( attributes, [get_module_atts/2,
|
:- use_system_module( attributes, [get_module_atts/2,
|
||||||
put_module_atts/2]).
|
put_module_atts/2]).
|
||||||
|
|
||||||
@ -52,9 +51,9 @@
|
|||||||
%%@{
|
%%@{
|
||||||
|
|
||||||
%% @aaddtogroup CohYroutining
|
%% @aaddtogroup CohYroutining
|
||||||
%% @ingroup AttributedVariables
|
%% @ingroup attributes
|
||||||
|
|
||||||
/** @pred attr_unify_hook(+ _AttValue_,+ _VarValue_)
|
/** @pred attr_unify_hook(+ _AttValue_,+ _VarValue_)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -69,11 +68,11 @@ Normally this predicate fails to veto binding the variable to
|
|||||||
the two attribute and associates the combined attribute with
|
the two attribute and associates the combined attribute with
|
||||||
_VarValue_ using put_attr/3.
|
_VarValue_ using put_attr/3.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
attr_unify_hook(DelayList, _) :-
|
attr_unify_hook(DelayList, _) :-
|
||||||
wake_delays(DelayList).
|
wake_delays(DelayList).
|
||||||
|
|
||||||
wake_delays([]).
|
wake_delays([]).
|
||||||
wake_delays([Delay|List]) :-
|
wake_delays([Delay|List]) :-
|
||||||
wake_delay(Delay),
|
wake_delay(Delay),
|
||||||
@ -95,12 +94,12 @@ wake_delay(redo_ground(Done, X, Goal)) :-
|
|||||||
attribute_goals(Var) -->
|
attribute_goals(Var) -->
|
||||||
{ get_attr(Var, '$coroutining', Delays) },
|
{ get_attr(Var, '$coroutining', Delays) },
|
||||||
attgoal_for_delays(Delays, Var).
|
attgoal_for_delays(Delays, Var).
|
||||||
|
|
||||||
attgoal_for_delays([], _V) --> [].
|
attgoal_for_delays([], _V) --> [].
|
||||||
attgoal_for_delays([G|AllAtts], V) -->
|
attgoal_for_delays([G|AllAtts], V) -->
|
||||||
attgoal_for_delay(G, V),
|
attgoal_for_delay(G, V),
|
||||||
attgoal_for_delays(AllAtts, V).
|
attgoal_for_delays(AllAtts, V).
|
||||||
|
|
||||||
attgoal_for_delay(redo_dif(Done, X, Y), V) -->
|
attgoal_for_delay(redo_dif(Done, X, Y), V) -->
|
||||||
{ var(Done), first_att(dif(X,Y), V) }, !,
|
{ var(Done), first_att(dif(X,Y), V) }, !,
|
||||||
[prolog:dif(X,Y)].
|
[prolog:dif(X,Y)].
|
||||||
@ -126,10 +125,10 @@ remove_when_declarations(Goal, Goal).
|
|||||||
%
|
%
|
||||||
/**
|
/**
|
||||||
@pred freeze(? _X_,: _G_)
|
@pred freeze(? _X_,: _G_)
|
||||||
|
|
||||||
Delay execution of goal _G_ until the variable _X_ is bound.
|
Delay execution of goal _G_ until the variable _X_ is bound.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
prolog:freeze(V, G) :-
|
prolog:freeze(V, G) :-
|
||||||
var(V), !,
|
var(V), !,
|
||||||
@ -183,18 +182,18 @@ freeze_goal(V,G) :-
|
|||||||
% several times. dif calls a special version of freeze that checks
|
% several times. dif calls a special version of freeze that checks
|
||||||
% whether that is in fact the case.
|
% whether that is in fact the case.
|
||||||
%
|
%
|
||||||
/** @pred dif( _X_, _Y_)
|
/** @pred dif( _X_, _Y_)
|
||||||
|
|
||||||
|
|
||||||
Succeed if the two arguments do not unify. A call to dif/2 will
|
Succeed if the two arguments do not unify. A call to dif/2 will
|
||||||
suspend if unification may still succeed or fail, and will fail if they
|
suspend if unification may still succeed or fail, and will fail if they
|
||||||
always unify.
|
always unify.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
prolog:dif(X, Y) :-
|
prolog:dif(X, Y) :-
|
||||||
'$can_unify'(X, Y, LVars), !,
|
'$can_unify'(X, Y, LVars), !,
|
||||||
LVars = [_|_],
|
LVars = [_|_],
|
||||||
dif_suspend_on_lvars(LVars, redo_dif(_Done, X, Y)).
|
dif_suspend_on_lvars(LVars, redo_dif(_Done, X, Y)).
|
||||||
prolog:dif(_, _).
|
prolog:dif(_, _).
|
||||||
|
|
||||||
@ -269,7 +268,7 @@ redo_ground('$done', _, Goal) :-
|
|||||||
%
|
%
|
||||||
% support for when/2 built-in
|
% support for when/2 built-in
|
||||||
%
|
%
|
||||||
/** @pred when(+ _C_,: _G_)
|
/** @pred when(+ _C_,: _G_)
|
||||||
|
|
||||||
|
|
||||||
Delay execution of goal _G_ until the conditions _C_ are
|
Delay execution of goal _G_ until the conditions _C_ are
|
||||||
@ -289,7 +288,7 @@ Delay until variable _V_ is ground.
|
|||||||
|
|
||||||
Note that when/2 will fail if the conditions fail.
|
Note that when/2 will fail if the conditions fail.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
prolog:when(Conds,Goal) :-
|
prolog:when(Conds,Goal) :-
|
||||||
'$current_module'(Mod),
|
'$current_module'(Mod),
|
||||||
@ -330,7 +329,7 @@ generate_code_for_when(Conds, G,
|
|||||||
prepare_goal_for_when(G, Mod, Mod:call(G)) :- var(G), !.
|
prepare_goal_for_when(G, Mod, Mod:call(G)) :- var(G), !.
|
||||||
prepare_goal_for_when(M:G, _, M:G) :- !.
|
prepare_goal_for_when(M:G, _, M:G) :- !.
|
||||||
prepare_goal_for_when(G, Mod, Mod:G).
|
prepare_goal_for_when(G, Mod, Mod:G).
|
||||||
|
|
||||||
|
|
||||||
%
|
%
|
||||||
% now for the important bit
|
% now for the important bit
|
||||||
@ -398,7 +397,7 @@ try_freeze(V, G, Done, LG0, LGF) :-
|
|||||||
var(V),
|
var(V),
|
||||||
LGF = ['$coroutining':internal_freeze(V, redo_freeze(Done, V, G))|LG0].
|
LGF = ['$coroutining':internal_freeze(V, redo_freeze(Done, V, G))|LG0].
|
||||||
|
|
||||||
try_eq(X, Y, G, Done, LG0, LGF) :-
|
try_eq(X, Y, G, Done, LG0, LGF) :-
|
||||||
'$can_unify'(X, Y, LVars), LVars = [_|_],
|
'$can_unify'(X, Y, LVars), LVars = [_|_],
|
||||||
LGF = ['$coroutining':dif_suspend_on_lvars(LVars, redo_eq(Done, X, Y, G))|LG0].
|
LGF = ['$coroutining':dif_suspend_on_lvars(LVars, redo_eq(Done, X, Y, G))|LG0].
|
||||||
|
|
||||||
@ -450,7 +449,7 @@ generate_blocking_code(Conds, G, Code) :-
|
|||||||
functor(G, Na, Ar),
|
functor(G, Na, Ar),
|
||||||
'$current_module'(M),
|
'$current_module'(M),
|
||||||
abolish(M:Na, Ar),
|
abolish(M:Na, Ar),
|
||||||
generate_blocking_code((Conds,OldConds), G, Code).
|
generate_blocking_code((Conds,OldConds), G, Code).
|
||||||
generate_blocking_code(Conds, G, (G :- (If, !, when(When, G)))) :-
|
generate_blocking_code(Conds, G, (G :- (If, !, when(When, G)))) :-
|
||||||
extract_head_for_block(Conds, G),
|
extract_head_for_block(Conds, G),
|
||||||
recorda('$blocking_code','$code'(G,Conds),_),
|
recorda('$blocking_code','$code'(G,Conds),_),
|
||||||
@ -476,7 +475,7 @@ extract_head_for_block(C, G) :-
|
|||||||
%
|
%
|
||||||
% We generate code as follows:
|
% We generate code as follows:
|
||||||
%
|
%
|
||||||
% block a(-,-,?)
|
% block a(-,-,?)
|
||||||
%
|
%
|
||||||
% (var(A1), var(A2) -> true ; fail), !, when((nonvar(A1);nonvar(A2)),G).
|
% (var(A1), var(A2) -> true ; fail), !, when((nonvar(A1);nonvar(A2)),G).
|
||||||
%
|
%
|
||||||
@ -524,13 +523,13 @@ prolog:'$wait'(Na/Ar) :-
|
|||||||
'$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail.
|
'$$compile'((S :- var(A), !, freeze(A, S)), (S :- var(A), !, freeze(A, S)), 5, M), fail.
|
||||||
prolog:'$wait'(_).
|
prolog:'$wait'(_).
|
||||||
|
|
||||||
/** @pred frozen( _X_, _G_)
|
/** @pred frozen( _X_, _G_)
|
||||||
|
|
||||||
|
|
||||||
Unify _G_ with a conjunction of goals suspended on variable _X_,
|
Unify _G_ with a conjunction of goals suspended on variable _X_,
|
||||||
or `true` if no goal has suspended.
|
or `true` if no goal has suspended.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
prolog:frozen(V, LG) :-
|
prolog:frozen(V, LG) :-
|
||||||
var(V), !,
|
var(V), !,
|
||||||
@ -564,7 +563,7 @@ update_att(V, G) :-
|
|||||||
attributes:put_module_atts(V, '$coroutining'(_,[G|Gs])).
|
attributes:put_module_atts(V, '$coroutining'(_,[G|Gs])).
|
||||||
update_att(V, G) :-
|
update_att(V, G) :-
|
||||||
attributes:put_module_atts(V, '$coroutining'(_,[G])).
|
attributes:put_module_atts(V, '$coroutining'(_,[G])).
|
||||||
|
|
||||||
|
|
||||||
not_vmember(_, []).
|
not_vmember(_, []).
|
||||||
not_vmember(V, [V1|DonesSoFar]) :-
|
not_vmember(V, [V1|DonesSoFar]) :-
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//!@{
|
%%% @{
|
||||||
|
|
||||||
//!@ingroup YAPModules
|
%%% @addtogroup YAPModules
|
||||||
}/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* YAP Prolog *
|
* YAP Prolog *
|
||||||
* *
|
* *
|
||||||
@ -176,4 +176,4 @@ clean_up :-
|
|||||||
|
|
||||||
clean_up.
|
clean_up.
|
||||||
|
|
||||||
//!@}
|
%% @}
|
||||||
|
12
pl/flags.yap
12
pl/flags.yap
@ -14,6 +14,16 @@
|
|||||||
* comments: controlling YAP *
|
* comments: controlling YAP *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
/**
|
||||||
|
* @file flagd.ysp
|
||||||
|
*
|
||||||
|
* @defgroup Flags Yap Flags
|
||||||
|
*n@{}
|
||||||
|
* @ingroup builtins
|
||||||
|
* @}@[ ]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:- system_module( '$_flags', [create_prolog_flag/3,
|
:- system_module( '$_flags', [create_prolog_flag/3,
|
||||||
current_prolog_flag/2,
|
current_prolog_flag/2,
|
||||||
@ -69,7 +79,7 @@
|
|||||||
unknown(_,error).
|
unknown(_,error).
|
||||||
|
|
||||||
|
|
||||||
/** @pred create_prolog_flag(+ _Flag_,+ _Value_,+ _Options_)
|
/** @pred create_prolog_flag(+ _Flag_,+ _Value_,+ _Options_)
|
||||||
|
|
||||||
Create a new YAP Prolog flag. _Options_ include
|
Create a new YAP Prolog flag. _Options_ include
|
||||||
|
|
||||||
|
@ -385,4 +385,9 @@ clause_to_indicator(T, M:Name/Arity) :- ,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
@defgroup packages YAP Packages
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
29
pl/qly.yap
29
pl/qly.yap
@ -18,21 +18,8 @@
|
|||||||
%% @file qly.yap
|
%% @file qly.yap
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@defgroup QLY Creating and Using a saved state
|
||||||
@defgroup YAPSaving Saving and Loading Prolog States
|
@ingroup YAPConsulting
|
||||||
@ingroup consult
|
|
||||||
|
|
||||||
YAP can save and read images of its current state to files, known as
|
|
||||||
saved states. It is possible to save the entire state or just a module
|
|
||||||
or a file. Notice that saved states in YAP depend on the architecture
|
|
||||||
where they were made, and may also depend on the version of YAP being
|
|
||||||
saved.
|
|
||||||
|
|
||||||
YAP always tries to find saved states from the current directory
|
|
||||||
first. If it cannot it will use the environment variable [YAPLIBDIR](@ref YAPLIBDIR), if
|
|
||||||
defined, or search the default library directory.
|
|
||||||
|
|
||||||
@{
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:- system_module( '$_qly', [qload_module/1,
|
:- system_module( '$_qly', [qload_module/1,
|
||||||
@ -63,6 +50,18 @@ defined, or search the default library directory.
|
|||||||
:- use_system_module( '$_yio', ['$extend_file_search_path'/1]).
|
:- use_system_module( '$_yio', ['$extend_file_search_path'/1]).
|
||||||
|
|
||||||
|
|
||||||
|
YAP can save and read images of its current state to files, known as
|
||||||
|
saved states. It is possible to save the entire state or just a module
|
||||||
|
or a file. Notice that saved states in YAP depend on the architecture
|
||||||
|
where they were made, and may also depend on the version of YAP being
|
||||||
|
saved.
|
||||||
|
|
||||||
|
YAP always tries to find saved states from the current directory
|
||||||
|
first. If it cannot it will use the environment variable [YAPLIBDIR](@ref YAPLIBDIR), if
|
||||||
|
defined, or search the default library directory.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/** @pred save_program(+ _F_)
|
/** @pred save_program(+ _F_)
|
||||||
Saves the current state of the data-base in file _F_ .
|
Saves the current state of the data-base in file _F_ .
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
@defgroup clib swi
|
|
||||||
@ingroup swi
|
|
||||||
|
|
||||||
The clib package is a series of libraries developed by Jan Wielmaker
|
|
||||||
and the SWI-Prolog community for extended Operating System support.
|
|
||||||
Please consult clib.doc for the complete documentation.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
@defgroup http The SWI http packages
|
|
||||||
@ingroup swi
|
|
||||||
|
|
||||||
The HTTP package is a series of libraries developed by Jan Wielmaker
|
|
||||||
and the SWI-Prolog community for accessing and serving data on the
|
|
||||||
web. It supports lower-level transport protocols, but also
|
|
||||||
data-representation primitives, and more.
|
|
||||||
|
|
||||||
The port to YAP focused on the client-side support. The server
|
|
||||||
package has not been as widely tested.
|
|
||||||
|
|
||||||
*/
|
|
Reference in New Issue
Block a user