The Artima Developer Community
Sponsored Link

Java Buzz Forum
Network Address Book

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bill de hÓra

Posts: 1137
Nickname: dehora
Registered: May, 2003

Bill de hÓra is a technical architect with Propylon
Network Address Book Posted: Mar 7, 2008 3:36 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Bill de hÓra.
Original Post: Network Address Book
Feed Title: Bill de hÓra
Feed URL: http://www.dehora.net/journal/atom.xml
Feed Description: FD85 1117 1888 1681 7689 B5DF E696 885C 20D8 21F8
Latest Java Buzz Posts
Latest Java Buzz Posts by Bill de hÓra
Latest Posts From Bill de hÓra

Advertisement

So Google published a Contacts API based on Gdata (in turn based Atom and Atompub). This particular Application Protocol Interface allows client applications to view and update user contact details and most Google services have access to the contact list.

Here's an example of a  Google contact entry:

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
    xmlns:gd='http://schemas.google.com/g/2005'>
    <id>
         http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de
    </id>  
    <updated>2008-03-05T12:36:38.835Z</updated>
    <link rel='self' type='application/atom+xml'
      href='http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de' />
    <link rel='edit' type='application/atom+xml'
      href='http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de/1204720598835000' />      
  <atom:category scheme='http://schemas.google.com/g/2005#kind'
    term='http://schemas.google.com/contact/2008#contact' />
  <atom:title type='text'>Elizabeth Bennet</atom:title>
  <atom:content type='text'>Notes</atom:content>
  <gd:email rel='http://schemas.google.com/g/2005#work'
    address='liz@gmail.com' />
  <gd:email rel='http://schemas.google.com/g/2005#home'
    address='liz@example.org' />
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
    primary='true'>
    (206)555-1212
  </gd:phoneNumber>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
    (206)555-1213
  </gd:phoneNumber>
  <gd:im address='liz@gmail.com'
    protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
    rel='http://schemas.google.com/g/2005#home' />
  <gd:postalAddress rel='http://schemas.google.com/g/2005#work'
    primary='true'>
    1600 Amphitheatre Pkwy Mountain View
  </gd:postalAddress>
<div class="vcard">
</atom:entry>


Grand. Lots of extension XML. You talk GData you're set. However aside from pulling this data around into address books, a really common case is just showing the user the info.

In that vein, here's the same data, using the hCard microformat embedded in the atom:content element instead of GData extensions:

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
    xmlns:gd='http://schemas.google.com/g/2005'>
    <id>
     http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de
    </id>   
    <updated>2008-03-05T12:36:38.835Z</updated>
    <link rel='self' type='application/atom+xml'
        href='http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de' />
    <link rel='edit' type='application/atom+xml'
        href='http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de/1204720598835000' />       
    <atom:category scheme='http://schemas.google.com/g/2005#kind'
        term='http://schemas.google.com/contact/2008#contact' />
    <atom:title type='text'>Elizabeth Bennet</atom:title>
    <atom:content type='xhtml'>
      <div xmlns="http://www.w3.org/1999/xhtml">   
        <div class="vcard">
          <a class="fn url"
            href="http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base/c9012de">
            Elizabeth Bennet
          </a>
          <div class="adr">
            <span class="type">Work</span>:
            <div class="street-address">1600 Amphitheatre Pkwy Mountain View</div>
          </div>
          <div class="tel">
           <span class="type">home</span>(206)555-1213
          </div>
          <div class="tel">
            <span class="type">work</span> (206)555-1213
          </div>
          <div>Home Email:
           <span class="email">liz@example.org</span>
          </div>
          <div>Work Email:
           <span class="email">liz@gmail.com</span>
          </div> 
          <div>Gtalk:
          <a class="url" href="xmpp:liz@gmail.com>liz@gmail.com</a>
          </div>
        </div>
      </div>   
    </atom:content>   
</atom:entry>

It seems to me like Google could support a uF format option as a parameter flag.

There's more.

Here's a sample of the Windows Live Contacts API:

<?xml version="1.0" encoding="utf-8" ?> 
<Contact>
<Comment>This is updated primary ABCH test account</Comment>
<Profiles>
<Personal>
<NameToFileAs>Updated ABCH Int</NameToFileAs>
<NameTitle>UpdatedMr.</NameTitle>
<FirstName>UpdatedAbch</FirstName>
<MiddleName>UpdatedPg</MiddleName>
<LastName>UpdatedInt</LastName>
<Suffix>UpdatedJr.</Suffix>
<YomiFirstName>UpdatedAibiceiachi</YomiFirstName>
<YomiLastName>UpdatedCeshiban</YomiLastName>
<Birthdate>1987-02-26</Birthdate>
<Anniversary>May 8th</Anniversary>
<Gender>Female</Gender>
<TimeZone>GmtMinus6h</TimeZone>
<SpouseName>UpdatedStorage</SpouseName>
</Personal>
<Professional>
<JobTitle>UpdatedSDE</JobTitle>
<Profession>Updatedaddress books</Profession>
<Manager>UpdatedWindowsLive</Manager>
<Assistant>UpdatedSomeone</Assistant>
</Professional>
</Profiles>
</Contact>


Which is a format more focused on the address domain - for starters it does not use Atom as a scaffold. I'm not going to try to convert that into hCard, but do note the "CamelCase" style markup; that's generally done to ease roundtripping in and out of OO languages (if you're a Java dev and have used XStream you'll have seen this in action).

Finally moving further along the domain specific line, here's an example of xAL, the eXtensible Address Language from OASIS.

<!-- 201/2288 Pine Street
Vancouver, BC
V6J 5G4
Canada -->
<AddressDetails>
<Country>
<CountryName>Canada</CountryName>
<Locality Type="State">
<LocalityName NameType="Abbreviation">BC</LocalityName>
<LocalityName NameType="Full Name">BRITISH COLUMBIA</LocalityName>
<DependentLocality Type="City">
<DependentLocalityName>Vancouver</DependentLocalityName>
<Thoroughfare Type="Street">
<ThoroughfareName>Pine Street</ThoroughfareName>
<Premise Type="Apartment Building">
<PremiseNumber>2288</PremiseNumber>
<SubPremise Type="Unit">
<SubPremiseNumber>201</SubPremiseNumber>
</SubPremise>
</Premise>
</Thoroughfare>
</DependentLocality>
<PostalCode>
<PostalCodeNumber>V6J 5G4</PostalCodeNumber>
</PostalCode>
</Locality>
</Country>
</AddressDetails>

Again more CamelCase markup, but the thing to note here is that the elements are not always carying the key information. There are Type attrributes that have the information your really want, such as "Type='Street'". xAL is in a sense a 'domain specific schema language'. It also has overly specific and/or localised elements like "ThoroughfareTrailingType". There's a lot to the xAL spec; what you see there is but a fragment.


The Irish government have a profile of it for eGovernment interchange.

Conclusion: FTW!


Microformats rock for the web - as well as being machine readable they can be lopped into a browser and are instantly 'people readable'. hCard+Atom at least seems to hit a sweet spot between machine usefulness and ease of reading for people; I won't go as far as saying it's more generally useful than the other options I've shown (but I'm tempted). This is not meant as a slight on the people working on the 3 formats above; address modelling is a deceptively hard problem - read the xAL spec if you don't believe me.

Read: Network Address Book

Topic: Barack Obama: "We are the ones we have been waiting for" Previous Topic   Next Topic Topic: Firefox 3 Proto Interface for Mac

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use