summaryrefslogtreecommitdiff
path: root/foaf/fbfixup.pl
blob: 5cc5f60c0300583490764735befa94164be2ec67 (plain)
  1. #!/usr/bin/perl
  2. # Sanitize RDF from Facebook Exporter <http://apps.facebook.com/foaf_exporter/>
  3. undef $/;
  4. while (<>) {
  5. s{
  6. <foaf:locality>Mørkøv</foaf:locality>\n\s*
  7. <foaf:region>Vestsjalland</foaf:region>\n\s*
  8. <foaf:country>Denmark</foaf:country>\n\s*
  9. <os:aboutMe></os:aboutMe>\n\s*
  10. <os:relationshipStatus>.*?</os:relationshipStatus>\n\s*
  11. <os:books></os:books>\n\s*
  12. <os:music></os:music>\n\s*
  13. <os:quotes></os:quotes>
  14. }{}gsx;
  15. s{
  16. </foaf:Person>\n\s*
  17. <foaf:Person>
  18. }{</foaf:Person>
  19. </foaf:knows>
  20. <foaf:knows>
  21. <foaf:Person>}gsx;
  22. s{
  23. <foaf:holdsAccount>\n\s*
  24. <foaf:OnlineAccount>\n\s*
  25. <foaf:accountServiceHomepage\srdf:resource="http://www.facebook.com/"/>\n\s*
  26. <foaf:accountProfilePage\srdf:resource="(http://www.facebook.com/.*?)"/>\n\s*
  27. <foaf:accountName>.*?</foaf:accountName>\n\s*
  28. </foaf:OnlineAccount>\n\s*
  29. </foaf:holdsAccount>
  30. }{<foaf:homepage rdf:resource="$1"/>}gsx;
  31. s,(( *)<foaf:homepage rdf:resource="http://www.facebook.com/([a-z.]+)"/>),$1\n$2<foaf:jabberID>$3\@chat.facebook.com</foaf:jabberID>,gs;
  32. print;
  33. }