#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#AdditionalJar: projog-core-0.9.0
#AdditionalJar: projog-clp-0.3.0
#End Region
Sub Process_Globals
Dim projog As JavaObject
End Sub
Sub AppStart (Args() As String)
projog = (Me).As(JavaObject).RunMethodJO("newOne",Null)
Log(projog)
Dim myFile As JavaObject
myFile = (Me).As(JavaObject).RunMethod("newFile",Array("c:/temp/test.pl"))
projog.RunMethod("consultFile",Array(myFile))
' for the QueryResult
Dim result As JavaObject
result = projog.RunMethodJO("executeQuery",Array("test(X,Y)."))
Log(result)
Do While result.RunMethod("next",Null)
Log("X= " & result.RunMethod("getTerm",Array("X")) & " Y= " & result.RunMethod("getTerm",Array("Y")))
Loop
End Sub
#if java
import java.io.File;
import org.projog.api.Projog;
import org.projog.api.QueryResult;
import org.projog.api.QueryStatement;
import org.projog.core.term.Atom;
// needed to get new instance as initializNewInstance errors
public static Projog newOne(){
return new Projog();
}
// needed as consultFile needs a file object not an io stream or string
public static File newFile(String s){
return new File(s);
}
#End If