summaryrefslogtreecommitdiff
path: root/foaf/fbfixup.pl
diff options
context:
space:
mode:
Diffstat (limited to 'foaf/fbfixup.pl')
-rwxr-xr-xfoaf/fbfixup.pl41
1 files changed, 41 insertions, 0 deletions
diff --git a/foaf/fbfixup.pl b/foaf/fbfixup.pl
new file mode 100755
index 0000000..5cc5f60
--- /dev/null
+++ b/foaf/fbfixup.pl
@@ -0,0 +1,41 @@
+#!/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;
+}