Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
PlCall Method (module, predicate, args)
SwiPlCs interfaceSbsSW.SwiPlCsPlQueryPlCall(String, String, PlTermV)
As PlCall(String, PlTermV) but locating the predicate in the named module.
Declaration Syntax
C#Visual BasicVisual C++F#
public static bool PlCall(
	string module,
	string predicate,
	PlTermV args
)
Public Shared Function PlCall ( 
	module As String,
	predicate As String,
	args As PlTermV
) As Boolean
public:
static bool PlCall(
	String^ module, 
	String^ predicate, 
	PlTermV args
)
static member PlCall : 
        module : string * 
        predicate : string * 
        args : PlTermV -> bool 
Parameters
module (String)
locating the predicate in the named module.
predicate (String)
defines the name of the predicate
args (PlTermV)
Is a PlTermV of arguments for the predicate
Return Value
Boolean
Return true or false as the result of NextSolution() or throw an exception.
Remarks

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

Examples

This sample shows a query with a compound term as an argument.

 Copy imageCopy
public void PlCallQueryCompound_termv()
{
    string[] mm = { "aa1", "aa2", "aa3" };
    build_pred();   // create: test(comp(X,Y)) :- member(Z,[1,2,3]), atomic_list_concat([X,Z],Y).
    PlTerm var1 = PlTerm.PlVar();
    PlTerm comp = PlTerm.PlCompound("comp", new PlTerm("aa"), var1);
    using (PlQuery q = new PlQuery("test", new PlTermV(comp)))
    {
        int i = 0;
        foreach (PlTermV s in q.Solutions)
        {
            Assert.AreEqual(mm[i++].ToString(), var1.ToString());
            Assert.AreEqual(comp.ToString(), s[0].ToString());
        }
    }
}

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