public static String convertToProlog(EntityManager em) {
    PrologEngineBuilder engine = new PrologEngineBuilder();

    TripleService tripleService = new Triple.TripleService(em);
    List<Relationship> relationships = PersistenceUtil.getAllList(em, Relationship.class);
    for (Relationship rel : relationships) {
      List<Triple> triples = tripleService.findByPredicates(rel);
      engine.define(rel, triples);
    }

    return engine.getPrologCode();
  }
  public static PrologEngine compile(EntityManager em) throws Exception {
    PrologEngineBuilder engine = new PrologEngineBuilder();

    TripleService tripleService = new Triple.TripleService(em);
    List<Relationship> relationships = PersistenceUtil.getAllList(em, Relationship.class);
    for (Relationship rel : relationships) {
      List<Triple> triples = tripleService.findByPredicates(rel);
      engine.define(rel, triples);
    }

    System.out.println(engine.getPrologCode());

    return engine.compile();
  }