The character variety of some classes of rational knots