I've been using the following code with a patched xml.el to extract
people from my BBDB into a FOAF fragment.  The code will be placed on
the Emacs Wiki, so check there for future versions.


(require 'xml)

(defun bbdb-foaf (&optional all)
  "Print a list of people you know for inclusion in a FOAF file.
The optional argument ALL indicates that you want to export everybody
in your BBDB file.  The default is to export only the people that have
the 'foaf' field defined.  The 'foaf' field should contain the URL of
a FOAF file describing them.

Fields used:

'www'   foaf:homepage
'mbox'  foaf:mbox_sha1sum
'net'   foaf:mbox if no 'mbox' field exists
'name'  foaf:name
'foaf'  rdfs:seeAlso"
  (interactive "P")
  (pop-to-buffer (get-buffer-create "*FOAF*"))
  (erase-buffer)
  (insert "    <!-- Beginning of BBDB block -->\n")
  (dolist (record (bbdb-records))
    (when (or all (bbdb-record-getprop record 'foaf))
      (xml-debug-print-internal
       (list 'foaf:knows nil
             (list 'foaf:Person nil
                   (list 'foaf:name nil (bbdb-record-name record))
                   (when (bbdb-record-getprop record 'www)
                     (list 'foaf:homape nil (bbdb-record-getprop record 'www)))
                   (if (bbdb-record-getprop record 'mbox)
                       (list 'foaf:mbox_sha1sum nil (bbdb-record-getprop record 'mbox))
                     (when (bbdb-record-net record)
                       (list 'foaf:mbox nil (car (bbdb-record-net record)))))
                   (when (bbdb-record-getprop record 'foaf)
                     (list 'rdfs:seeAlso
                           (list (cons 'rdf:resource
                                       (bbdb-record-getprop record 'foaf)))))))
       "    ")
      (newline)))
  (insert "    <!-- End of BBDB block -->\n"))



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to