00001 package edu.tum.cs.srl.bayesnets.bln; 00002 00003 import java.io.IOException; 00004 00005 import edu.tum.cs.logic.Formula; 00006 import edu.tum.cs.logic.KnowledgeBase; 00007 import edu.tum.cs.logic.parser.ParseException; 00008 import edu.tum.cs.srl.Database; 00009 import edu.tum.cs.srl.bayesnets.MLNConverter; 00010 import edu.tum.cs.srl.bayesnets.RelationalBeliefNetwork; 00011 import edu.tum.cs.srl.mln.MarkovLogicNetwork; 00012 00013 public class BayesianLogicNetwork extends AbstractBayesianLogicNetwork { 00014 00015 public KnowledgeBase kb; 00016 00017 public BayesianLogicNetwork(RelationalBeliefNetwork rbn, String logicFile) throws IOException, ParseException { 00018 super(rbn, logicFile); 00019 kb = new KnowledgeBase(logicFile); 00020 } 00021 00022 public MarkovLogicNetwork toMLN() throws Exception { 00023 MLNConverter.MLNObjectWriter converter = new MLNConverter.MLNObjectWriter(); 00024 this.rbn.toMLN(converter, false, false); 00025 for(Formula f : kb) { 00026 converter.addHardFormula(f); 00027 } 00028 return converter.getMLN(); 00029 } 00030 00031 @Override 00032 public GroundBLN ground(Database db) throws Exception { 00033 return new GroundBLN(this, db); 00034 } 00035 }