Changes between Version 4 and Version 5 of AppleAddressBookDatasource


Ignore:
Timestamp:
12/12/05 20:16:28 (18 years ago)
Author:
steve@…
Comment:

Updated script

Legend:

Unmodified
Added
Removed
Modified
  • AppleAddressBookDatasource

    v4 v5  
    3434 
    3535It should copy/paste from the RDF-File datasource:  source:trunk/gnowsis/src/org/gnowsis/adapters/rdffile/RDFFileDataSource.java 
     36 
     37I uploaded a script I made a couple of years ago, but it's appeared as 0 bytes. So here's the script. 
     38 
     39property foaf : "FOAF" 
     40 
     41tell application "Address Book" 
     42         
     43        set m to properties of my card 
     44        set the_file to (((path to desktop) as string) & first name of m & last name of m & ".rdf") as file specification 
     45        set rdf to "<rdf:RDF" & return 
     46        set rdf to rdf & "xmlns:rdf=" & quote & "http://www.w3.org/1999/02/22-rdf-syntax-ns#" & quote & return 
     47        set rdf to rdf & "xmlns:rdfs=" & quote & "http://www.w3.org/2000/01/rdf-schema#" & quote & return 
     48        set rdf to rdf & "xmlns:foaf=" & quote & "http://xmlns.com/foaf/0.1/" & quote & return 
     49        set rdf to rdf & "xmlns:admin=" & quote & "http://webns.net/mvcb/" & quote & ">" & return 
     50        set rdf to rdf & "<foaf:Person rdf:nodeID=" & quote & "me" & quote & ">" & return 
     51        set rdf to rdf & "<foaf:name>" & first name of m & " " & last name of m & "</foaf:name>" & return 
     52        if nickname of m ≠ "" then 
     53                set rdf to rdf & "<foaf:nick>" & nickname of m & "</foaf:nick>" & return 
     54        end if 
     55         
     56         
     57        if group foaf exists then 
     58                repeat with this_person in every person of group foaf 
     59                         
     60                         
     61                        set rdf to rdf & "<foaf:Person>" & return 
     62                        set rdf to rdf & "<foaf:name>" & first name of this_person & " " & last name of this_person & "</foaf:name>" & return 
     63                        repeat with e in emails of this_person 
     64                                set rdf to rdf & "<foaf:mbox>mailto:" & value of e & "</foaf:mbox>" & return 
     65                        end repeat 
     66                        if ((count of urls of this_person) > 0) then 
     67                                if label of url 1 of this_person is "FOAF" then 
     68                                        set rdf to rdf & "<rdfs:seeAlso rdf:resource=" & quote & value of url 1 of this_person & quote & "/>" & return 
     69                                end if 
     70                        end if 
     71                        set rdf to rdf & "</foaf:Person>" & return 
     72                end repeat 
     73        end if 
     74         
     75        set rdf to rdf & "</rdf:RDF>" 
     76         
     77         
     78end tell 
     79 
     80try 
     81        open for access the_file with write permission 
     82        set eof of the_file to 0 
     83        write (rdf) to the_file starting at eof 
     84        close access the_file 
     85on error 
     86        try 
     87                close access the_file 
     88        end try 
     89end try