Jump to content

Java Mixed with Prolog


Recommended Posts

Posted

Alguem daqui sabe por prolog a funcionar dentro de java?

Se sim podiam explicar todos os passos que tenho que fazer, se pudessem explicar para o eclipse tb era fixe!

Eu por agora só queria por este código de exemplo a funcionar!!!

import se.sics.jasper.SICStus;
import se.sics.jasper.Query;
import java.util.HashMap;

public class Teste {

public static void main(String argv[]) {
System.out.println("Ola");
SICStus sp;
Query query;
HashMap WayMap = new HashMap();
try {		
	sp = new SICStus(argv,null);
	sp.restore("train.sav");
	query = sp.openPrologQuery("connected(’Osrebro’, ’Stockholm’,Way, Way).",WayMap);
	try {
		while (query.nextSolution()) {
			System.out.println(WayMap);
		}
	} finally {
	query.close();
	}
}
catch ( Exception e ) {
	System.out.println("Erro classe não encontrada!");
}

System.out.println("Adeus");
}  
}
Posted

Isso usa o biblioteca comercial o SicStus fazes download da evaluation (se der) e incluis o jar no teu projecto, depoi o exemplo ja deve funcionar.

Posted

Bem já consegui!!! K grande dor de cabeça.... Agora é só fazer o projecto!!! Fazer o teamBots numa mistura de prolog e java!!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.