C# 클래스 SbsSW.SwiPlCs.PlQuery

This class allows queries to prolog.

A query can be created by a string or by constructing compound terms see Constructors for details.

All resources an terms created by a query are reclaimed by Dispose(). It is recommended to build a query in a scope.

There are four possible opportunities to query Prolog

Query typeDescription A static callTo ask prolog for a proof. Return only true or false. A PlCallQuery(string)To get the first result of a goal Construct a PlQuery object by a string.The most convenient way. Construct a PlQuery object by compound terms.The most flexible and fast (runtime) way.

For examples see PlQuery(string) and PlQuery(string, PlTermV)

The query will be opened by NextSolution() and will be closed if NextSolution() return false.

상속: IDisposable
파일 보기 프로젝트 열기: swi-to-yap/swicli 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DiscardData bool

공개 메소드들

메소드 설명
Dispose ( ) : void
EnsureQUID ( ) : void
NextSolution ( ) : bool

Provide the next solution to the query. Prolog exceptions are mapped to C# exceptions.

If the query is closed it will be opened. If the last solution was generated the query will be closed.

If an exception is thrown while parsing (open) the query the _qid is set to zero.

PlCall ( string goal ) : bool

Call a goal once.

PlCall ( string predicate, PlTermV args ) : bool

Create a PlQuery from the arguments, generates the first solution by NextSolution() and destroys the query.

PlCall ( string module, string predicate, PlTermV args ) : bool

As PlCall(string, PlTermV) but locating the predicate in the named module.

PlCallQuery ( string goal ) : PlTerm

NOTE:will be changed in the near future.

return the solution of a query which is called once by call Throw an ArgumentException if there is no or more than one variable in the goal

PlQuery ( string goal ) : System

With this constructor a query is created from a string.

Uppercase parameters are interpreted a variables but can't be nested in sub terms. If you need a variable in a nested term use PlQuery(string, PlTermV). See the examples for details.

Muddy Waters sang:"I'am build for comfort, I ain't build for speed"

PlQuery ( string name, PlTermV termV ) : System

Create a query where name defines the name of the predicate and av the argument vector. The arity is deduced from av. The predicate is located in the Prolog module user.

PlQuery ( string module, string goal ) : System

locating the predicate in the named module.

PlQuery ( string module, string name, PlTermV termV ) : System

locating the predicate in the named module.

Query ( PlQuerySwitch queryType ) : int

Obtain status information on the Prolog system. The actual argument type depends on the information required. The parameter queryType describes what information is wanted.

Returning pointers and integers as a long is bad style. The signature of this function should be changed.

PlQuerySwitch

ToList ( ) : ReadOnlyCollection

Create a ReadOnlyCollection<T> of PlQueryVariables.

If calling ToList() all solutions of the query are generated and stored in the Collection.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Release all resources from the query

비공개 메소드들

메소드 설명
CheckForException ( ) : void
EraseRecords ( ) : void
Free ( bool discardData ) : void

Discards the query, but does not delete any of the data created by the query if discardData is false. It just invalidate qid, allowing for a new PlQuery object in this context.

see

PlQuery ( ) : System
Sread ( IntPtr handle, System buffer, long buffersize ) : long

메소드 상세

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Release all resources from the query
protected Dispose ( bool disposing ) : void
disposing bool if true all is deleted
리턴 void

EnsureQUID() 공개 메소드

public EnsureQUID ( ) : void
리턴 void

NextSolution() 공개 메소드

Provide the next solution to the query. Prolog exceptions are mapped to C# exceptions.

If the query is closed it will be opened. If the last solution was generated the query will be closed.

If an exception is thrown while parsing (open) the query the _qid is set to zero.

Is thrown if SWI-Prolog Manual PL_next_solution() returns false
public NextSolution ( ) : bool
리턴 bool

PlCall() 공개 정적인 메소드

Call a goal once.
public static PlCall ( string goal ) : bool
goal string The complete goal as a string
리턴 bool

PlCall() 공개 정적인 메소드

Create a PlQuery from the arguments, generates the first solution by NextSolution() and destroys the query.

public static PlCall ( string predicate, PlTermV args ) : bool
predicate string defines the name of the predicate
args PlTermV Is a of arguments for the predicate
리턴 bool

PlCall() 공개 정적인 메소드

As PlCall(string, PlTermV) but locating the predicate in the named module.
public static PlCall ( string module, string predicate, PlTermV args ) : bool
module string locating the predicate in the named module.
predicate string
args PlTermV
리턴 bool

PlCallQuery() 공개 정적인 메소드

NOTE:will be changed in the near future.

return the solution of a query which is called once by call Throw an ArgumentException if there is no or more than one variable in the goal
public static PlCallQuery ( string goal ) : PlTerm
goal string a goal with *one* variable
리턴 PlTerm

PlQuery() 공개 메소드

With this constructor a query is created from a string.

Uppercase parameters are interpreted a variables but can't be nested in sub terms. If you need a variable in a nested term use PlQuery(string, PlTermV). See the examples for details.

Muddy Waters sang:"I'am build for comfort, I ain't build for speed"
public PlQuery ( string goal ) : System
goal string A string for a prolog query
리턴 System

PlQuery() 공개 메소드

Create a query where name defines the name of the predicate and av the argument vector. The arity is deduced from av. The predicate is located in the Prolog module user.
public PlQuery ( string name, PlTermV termV ) : System
name string the name of the predicate
termV PlTermV the argument vector containing the parameters
리턴 System

PlQuery() 공개 메소드

locating the predicate in the named module.
public PlQuery ( string module, string goal ) : System
module string locating the predicate in the named module.
goal string
리턴 System

PlQuery() 공개 메소드

locating the predicate in the named module.
public PlQuery ( string module, string name, PlTermV termV ) : System
module string locating the predicate in the named module.
name string
termV PlTermV
리턴 System

Query() 공개 정적인 메소드

Obtain status information on the Prolog system. The actual argument type depends on the information required. The parameter queryType describes what information is wanted.

Returning pointers and integers as a long is bad style. The signature of this function should be changed.

PlQuerySwitch
public static Query ( PlQuerySwitch queryType ) : int
queryType PlQuerySwitch A PlQuerySwitch.
리턴 int

ToList() 공개 메소드

Create a ReadOnlyCollection<T> of PlQueryVariables.

If calling ToList() all solutions of the query are generated and stored in the Collection.

public ToList ( ) : ReadOnlyCollection
리턴 ReadOnlyCollection

프로퍼티 상세

DiscardData 공개적으로 프로퍼티

public bool DiscardData
리턴 bool