4 # A plugin to XMLWriter to output FOAF (friend of a friend).
6 # I have a quick look through some sample FOAF, it seems it
7 # can get quite intricate in things it can tell you, however
8 # other Planets only offer this basic feed. Given this is almost
9 # all the information we know, that can't be too bad.
15 def __init__(self, planet):
18 def __write_item__(self, blog):
20 output += '<foaf:member>\n'
21 output += ' <foaf:Agent>\n'
22 output += ' <foaf:name>%s</foaf:name>\n' % blog.blogName
23 output += ' <foaf:weblog>\n'
24 output += ' <foaf:Document rdf:about="%s">\n' % blog.blogURL
25 output += ' <dc:title>%s</dc:title>\n' % blog.blogTitle
26 output += ' <rdfs:seeAlso>\n'
27 output += ' <rss:channel rdf:about="%s" />\n' % blog.feedURL
28 output += ' </rdfs:seeAlso>\n'
29 output += ' </foaf:Document>\n'
30 output += ' </foaf:weblog>\n'
31 output += ' </foaf:Agent>\n'
32 output += '</foaf:member>\n'
38 output += '<rdf:RDF>\n'
39 output += ' xmlns="http://purl.org/rss/1.0/"\n'
40 output += ' xmlns:dc="http://purl.org/dc/elements/1.1/"\n'
41 output += ' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n'
42 # XXX: probably need other doctypes here
43 # infact, need to check XML structures
44 output += ' <foaf:Group>\n'
45 output += ' <foaf:name>Planet UCC</foaf:name>\n'
46 output += ' <foaf:homepage>http://planet.ucc.asn.au/</foaf:homepage>\n'
47 output += ' <rdfs:seeAlso rdf:resource="http://planet.ucc.asn.au/foaf.xml" />\n'
48 for blog in self.parent.blogs:
49 output += self.__write_item__(blog)
50 output += ' </foaf:Group>\n'
51 output += '</rdf:RDF>'