00001 import java.io.File; 00002 00003 import edu.tum.cs.srl.bayesnets.ABL; 00004 import edu.tum.cs.srl.bayesnets.RelationalBeliefNetwork; 00005 import edu.tum.cs.srl.bayesnets.bln.BayesianLogicNetwork; 00006 import edu.tum.cs.srl.mln.MarkovLogicNetwork; 00007 00008 00009 public class BLN2MLN { 00010 00014 public static void main(String[] args) { 00015 try { 00016 if(args.length < 4) { 00017 System.out.println("\n usage: BLN2MLN <declarations file> <network file> <logic file> <output file> [options] \n\n" + 00018 " -cf write compact formulas\n" 00019 ); 00020 return; 00021 } 00022 boolean compact = false; 00023 for(int i = 4; i < args.length; i++) { 00024 if(args[i].equals("-cf")) 00025 compact = true; 00026 else { 00027 System.err.println("unknown option " + args[i]); 00028 return; 00029 } 00030 } 00031 RelationalBeliefNetwork rbn = new ABL(args[0], args[1]); 00032 BayesianLogicNetwork bln = new BayesianLogicNetwork(rbn, args[2]); 00033 String outfile = args[3]; 00034 System.out.println("converting..."); 00035 MarkovLogicNetwork mln = bln.toMLN(); 00036 System.out.printf("saving MLN to %s...\n", outfile); 00037 mln.write(new File(outfile)); 00038 } 00039 catch(Exception e) { 00040 e.printStackTrace(); 00041 } 00042 } 00043 }