Check out Jars original King David link and you will find your answer. It was a mock trial.
Right, but why a mock trial for somebody so transparently guilty, who wrote a psalm on the very event in question (see Psalm 51)?
The trial would seem to insinuate that the preponderance thinks David was in the right, or if he wasn't, that he refused to admit guilt. But that isn't the case. We all know the story of David, Uriah, and Bathsheba. David committed a series of egregious sins. There's no doubt about that.
To me, having a mock trial seems like overkill. The fact that he was guilty was never an issue. I don't anyone who contests that fact.
"A man can no more diminish God's glory by refusing to worship Him than a lunatic can put out the sun by scribbling the word, 'darkness' on the walls of his cell." -C.S. Lewis