#!/usr/bin/perl # Sanitize RDF from Facebook Exporter <http://apps.facebook.com/foaf_exporter/> undef $/; while (<>) { s{ <foaf:locality>Mørkøv</foaf:locality>\n\s* <foaf:region>Vestsjalland</foaf:region>\n\s* <foaf:country>Denmark</foaf:country>\n\s* <os:aboutMe></os:aboutMe>\n\s* <os:relationshipStatus>.*?</os:relationshipStatus>\n\s* <os:books></os:books>\n\s* <os:music></os:music>\n\s* <os:quotes></os:quotes> }{}gsx; s{ </foaf:Person>\n\s* <foaf:Person> }{</foaf:Person> </foaf:knows> <foaf:knows> <foaf:Person>}gsx; s{ <foaf:holdsAccount>\n\s* <foaf:OnlineAccount>\n\s* <foaf:accountServiceHomepage\srdf:resource="http://www.facebook.com/"/>\n\s* <foaf:accountProfilePage\srdf:resource="(http://www.facebook.com/.*?)"/>\n\s* <foaf:accountName>.*?</foaf:accountName>\n\s* </foaf:OnlineAccount>\n\s* </foaf:holdsAccount> }{<foaf:homepage rdf:resource="$1"/>}gsx; s,(( *)<foaf:homepage rdf:resource="http://www.facebook.com/([a-z.]+)"/>),$1\n$2<foaf:jabberID>$3\@chat.facebook.com</foaf:jabberID>,gs; print; }