I am convinced porting code from Java to Perl is generally easier than the other way around. I pity the Java programmer who is forced to go from Perl's richness of expression to a carefully constructed language that smacks your hand if you even look at it funny.
And I should add that I finally got the Java code to compile. I feel like an idiot at my silly brain cramp. My utility script was doing javac XProlog.java instead of javac *java. Talk about a newbie error. However, this now means that I'll be able to modify the Java to my heart's content and trace its execution. This should put me back on track. In fact, it might even allow me to do a proper port without the compiler compiler. Hmm ...
I'm also better appreciating the XProlog internals. WProlog doesn't quite follow the WAM standard (as I understand it) of using $functor/$arity for keys identifying predicates. Instead, it uses $functor/$arity-$clausenum. This is wasteful of memory in the database hash because we now have separate entries foreach clause:
owns(merlyn,gold). % owns/2-1 owns(ovid,rubies). % owns/2-2
If the functor owns is reused many times, that's a lot of hash entries. In XProlog, those each get entered as a clause in the database under the owns/2 key. Unfortunately, making that conversion in the code caused a deep recursion error on even simple predicates. I'll figure it out, but tomorrow work calls. I probably won't be able to touch it again until next weekend.