H Factor
The H Factor of a media-type is a measurement of the level of hypermedia support and sophistication of a media-type. H Factor values can be used to compare and contrast media types in order to aid in selecting the proper media-type(s) for your implementation.
H-Factor values are made up of two parts, each with their own set of factors: [MCA: Is this a complete list? overkill?]
- Link Support
- [LE]Embedding links
- [LO]Outbound links
- [LT]Templated queries
- [LN]Non-Idempotent updates
- [LI]Idempotent updates
- Control Data Support
By checking each hypermedia element in media-type for each of the identified factors, one can arrive at the composite 'H Factor' for the target media type.
Example H Factor Charts
When comparing media types, it can be helpful to document the existing H Factors in a simpel visual chart. In the exmaples below, the bottom row identifies basic link factors. These are the most most noticeable hypermedia factors. The upper two rows identify control data factors. These factors allow media types to provide support for additional aspects of hypmermedia semantics.
Link Support Values:
- LE
-
Support for embedded links (HTTP GET)
<img src="http://www.example.org/images/logo" title="company logo" />
- LO
-
Support for out-bound navigational links (HTTP GET)
<a href="http://www.example.org/search" title="view search page">Search</a>
- LT
-
Support for templated queries (HTTP GET)
<form method="get"> <label>Search term:</label> <input name="query" type="text" value="" /> <input type="submit" /> </form>
- LN
-
Support for non-idempotent updates (HTTP POST)
<form method="post" action="http://www.example.org/my-keywords"/> <label>Keywords:</label> <input name="keywords" type="text" value="" /> <input type="submit" /> </form>
- LI
-
Support for idempotent updates (HTTP PUT, DELETE)
function delete(id) { var client = new XMLHttpRequest(); client.open("DELETE", "/records/"+id); }
Control Data Support Values:
- CR
-
Support for modifying control data for read requests (e.g. HTTP
Accept-*
headers).<xsl:include href="http://www.exmaple.org/newsfeed" accept="application/rss" />
- CU
-
Support for modifying control data for update requests (e. g.
Content-*
headers).<form method="post" action="http://www.example.org/my-keywords" enctype="application/x-www-form-urlencoded" /> <label>Keywords:</label> <input name="keywords" type="text" value="" /> <input type="submit" /> </form>
- CM
-
Support for indiciating the interface method for requests (e.g. HTTP
GET,POST,PUT,DELETE
methods).<form method="post" action="http://www.example.org/my-keywords" /> <label>Keywords:</label> <input name="keywords" type="text" value="" /> <input type="submit" /> </form>
- CL
-
Support for adding semantic meaning to link elements using link relations (e.g. HTML
rel
attribute).<entry xmlns="http://www.w3.org/2005/Atom"> <title>Atom-Powered Robots Run Amok</title> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <author><name>John Doe</name></author> <content>Some text.</content> <link rel="edit" href="http://example.org/edit/first-post.atom"/> </entry>
Update History
- 2010-05-31
Updated storage and layout - 2010-03-10
Cleaned up Control Data descriptions - 2010-03-09
Initial post