Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
PlQuery Class
SwiPlCs interfaceSbsSW.SwiPlCsPlQuery

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 using scope.

There are four possible opportunities to query Prolog

Query typeDescription
A static call
To 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)

Declaration Syntax
C#Visual BasicVisual C++F#
public class PlQuery : IDisposable
Public Class PlQuery
	Implements IDisposable
public ref class PlQuery : IDisposable
type PlQuery =  
    class
        interface IDisposable
    end
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
PlQuery(String)

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.


PlQuery(String, String)
locating the predicate in the named module.

PlQuery(String, PlTermV)
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, String, PlTermV)
locating the predicate in the named module.

Args
Provide access to the Argument vector for the query

Dispose()()()()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose(Boolean)
Release all resources from the query

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Overrides Object.Finalize()()()().)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
NextSolution()()()()
Provide the next solution to the query. Prolog exceptions are mapped to C# exceptions.

PlCall(String, PlTermV)
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.

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

PlCall(String)
Call a goal once.

PlCallQuery(String)

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

PlCallQuery(String, String)
As PlCallQuery(String) but executed in the named module.

PlQuery_Old_Kill_unused(String, String)
this was the old constructor only left here for demonstration how redirection of streams can be used NOTE this one did not word if goal contains unicode chars like ş or ąę

Query(PlQuerySwitch)

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

Solutions

Enumerate the solutions.

For examples see PlQuery(String)


SolutionVariables

Enumerate the PlQueryVariables of one solution.


ToList()()()()

Create a ReadOnlyCollection<(Of <(<'T>)>)> of PlQueryVariables.

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


ToString()()()()
Returns a string that represents the current object.
(Inherited from Object.)
VariableNames
Gets a Collection<(Of <(<'T>)>)> of the variable names if the query was built by a string.

Variables
The List of PlQueryVariables of this PlQuery.

Remarks

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

Inheritance Hierarchy
Object
PlQuery

Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)