Debugging WP-PostRatings plugin for rich snippets

I recently got stuck in a small task. It was to add rich snippet AggregateRating. The rating plugin I am using was WP-PostRatings. This plugin did add the following snippet to the page. 

I tested the code in Google Rich Snippets Tool but the stars didn’t appear. It took me some time to figure out what the problem is. The code does not tell what thing you are rating. AggregateRating is not a top level Type. See here.

The Solution

Just enclose the above code with appropriate Top level Type. In my case I used Product. The final code is