Pig scripts for analyzing and rewriting RDF graphs