Request for comments on this proposal for APML-JSON. Cheers.

 

David Novakovic and Ben Novakovic

 

APML JSON

Rationale

As more and more web applications become APML aware there will be

services delivering "APML-Like" data as JSON, often converted directly

from APML itself. This document seeks to outline a sane specification

for JSON-APML to take the guess work out of it for developers seeking

to do work with APML in Javascript, or even seeking a lightweight

alternative to APML itself. Henceforth in this document the original

APML spec will be referred to as "APML" and the new JSON specification

will be referred to as "APML-JSON".

 

For the most part this specification will mirror the original APML

specification as closely as possible. The largest difference is that

where a NodeList of Concept/Source nodes with "key" attributes exist

in the APML spec now are replaced with keyword indexed values in a

JSON associative array. This will become clearer in the example.

 

Another relatively large difference is the use of camelCase for keys

that are capitalised in the XML nodes, rather than all caps. This is a

compromise between the reccomendation of W3 for using no caps with

underscores and the APML all caps way. Naturally people will do what

they want. ;)  Additionally, with  the JSON version, if fields are

missing, they are just assumed to be empty, this saves having to

transmit redundant markup.

 

Examples

To see an example of javascript using JSON with this notation, head

over to Ben Novakovic's example at http://bmn.name/examples/apml/ .

Look at the source to see the javascript.

 

APML-JSON Breakdown

Basically the root element contains two main parts, the head and the body:

 

{

    "head":{},

    "body":{}

}
 

The head contains some metadata:

 

"head": {

    "version": 0.6,

    "title": "Example APML-JSON file for apml.org",

    "generator": "Written by Hand",

    "userEmail": "sam...@apml.org",

    "dateCreated": "2007-03-11T01:55:00Z"

}
 

Then the body contains some profiles and also has a default profile:

 

"body": {

    "defaultProfile": "Work",

    "profiles": {}

}
 

Each profile contains explicitdata and implicitdata

 

"profiles": {

    "work": {

        "implicitData": {},

        "explicitData": {}

    }

    "home": {

        "implicitData": {},

        "explicitData": {}

    }

}
 

Explicit data and implicit data are similar with slightly different

attribute, so we'll look aty implicit ones here. There will be

examples of others in the example APML-JSON file that will be at the

end of this documents. Data can be in the form of sources or concepts.

 

"implicitData": {

    "concepts": {

        "attention": {

            "value": "1.0",

            "from": "",

            "updated": "2007-03-11T01:55:00Z"

        },

        "content distribution": {

            "value": "1.0",

            "from": "GatheringTool.com",

            "updated": "2007-03-11T01:55:00Z"

        }

    },

    "sources":   {

        "http://feeds.feedburner.com/apmlspec": {

            "name": "APML.org",

            "value": "1.0",

            "type":  "application/rss+xml",

            "value": "0.4"

        }

    }

}
 

Sources can also contain an Author.

 

"http://feeds.feedburner.com/apmlspec": {

    "name": "APML.org",

    "value": "1.00",

    "type":  "application/rss+xml",

    "value": "0.4"

    "author": {

            "key": "Sample",

            "value": "0.5",

            "from": "GatheringTool.com",

            "updated": "2007-03-11T01:55:00Z"

    }

}
 

So here we have a full example:

 

{

    "head": {

           "version": "0.6",

           "title": "Example APML-JSON file for apml.org",

           "generator": "Written by Hand",

           "userEmail": "sample@apml.org",

           "dateCreated": "2007-03-11T01:55:00Z"

    },

    "body": {

        "defaultProfile": "Work",

        "profiles": {

            "work": {

                "implicitData": {

                    "concepts": {

                        "attention": {

                            "value": 0.1,

                            "from": "Sometool.com",

                            "updated": "2007-03-11T01:55:00Z"

                        },

                        "content distribution": {

                            "value": 0.1,

                            "from": "Sometool.com",

                            "updated": "2007-03-11T01:55:00Z"

                        }

                    },

                    "sources":   {

                        "http://feeds.feedburner.com/apmlspec": {

                            "name": "APML.org",

                            "value": 1.00,

                            "type":  "application/rss+xml"

                            "authors": {

                                "Sample":{

                                    "value": 0.5,

                                    "from": "GatheringTool.com",

                                    "updated": "2007-03-11T01:55:00Z"

                                }

                            }

                        }

                    }

                },

                "explicitData": {

                    "concepts": {

                        "attention": {

                            "value": 0.1

                        },

                        "content distribution": {

                          "value": 0.1,

                        }

                    },

                    "sources":   {

                        "http://feeds.feedburner.com/apmlspec": {

                            "name": "APML.org",

                            "value": "1.00",

                            "type":  "application/rss+xml"

                            "authors": {

                                "Sample": {

                                    "value": 0.5,

                                }

                            }

                        }

                    }

                }

            },

            "home": {

                "implicitData": {},

                "explicitData": {}

            }

        },

        "applications": {

            "sample.com": {

                "sampleAppEI": {}

            }

        }

    }

 

XSLT for APML to APML-JSON

 

 

If someone knows how to normalise the xslt output that'd be really nice.

 

 apml2js.xslt

 


Page Information

  • 1 month ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts