rest/property: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(→‎<link>: one each)
Line 38: Line 38:
= Open Issues =
= Open Issues =


* Can properties be hierarchical?  If so, is ";prop1/subprop1" the proper syntax?
* Is that the right href syntax for a relative property?
* Is that the right href syntax for a relative property?
* Can properties be chained together? If so, are they retrieved in parallel, or would those be subproperties?
* Can properties be chained together? If so, are they retrieved in parallel, or would those be subproperties?
* Would we need to worry about [http://lists.evolt.org/archive/Week-of-Mon-20020114/065707.html semicolon exploits]?
* Would we need to worry about [http://lists.evolt.org/archive/Week-of-Mon-20020114/065707.html semicolon exploits]?
: Probably not in general, but any implementation which uses a database-style back end (vs. flat files) would need to guard against injection attacks. The ";" itself isn't the problem at all, expect for the fact that it was used as a "escape sequence" by some applications, with the terminal string fed directly into a database (bad!).
* Are there other conventions we should follow/avoid?
* Are there other conventions we should follow/avoid?
* Should the "Link:" tag itself be declared in HTTP "OPTIONS"?
* Should the "Link:" tag itself be declared in HTTP "OPTIONS"?
* How does thi relate to RDF?  Could a normative RDF schema be mapped into relProperty? Or just vice versa?

Revision as of 23:42, 5 May 2006

The Problem

HTML has long used the meta tag for metadata to describe the contents of a document. While this works well for "intrinsic" metadata related to authoring (e.g, category, copyright), there's no equivalent function for "extrinsic" metadata provided by the server or external sources (e.g., last accessed time, size, alternate representations).

To address this need, [WebDAV] defined a new set of "PROP" methods to create, search, and retrieve properties. Unfortunately, in addition to defining a whole new protocol this violates the [rest]ful notion of each resource having a URL for manipulating it. This raises the question, "What is the RESTful way to use HTML and HTTP to provide useful properties?"

Proposal

relProperty

Our proposal, currentlly called "relProperty", is motivated by the following principles:

  1. Every property must have at least one well-defined URL which can be retrieved and updated.
  2. There must be an easy way to discover all the properties associated with a given document.
  3. It must be simple to implement on existing web servers without requiring non-trivial modifications
  4. It should respect and build on existing microformat principles and practices
  5. It should be consistent with URL rest/opacity (properly understood)

While other systems (e.g., RDF) nominally attempt to solve similar problems, the advantage of a microformats approach are:

  • no new schemas or syntax to learn
  • easily embedded in standard, validated HTML
  • trivially accessed/updated via existing HTTP methods

<link>

Together, this implies that that the optimal way to associate a property with a document is via the HTML link tag (or the equivalent, if somewhat deprecated, HTTP Link: header). This provides the requisite mechanism for telling the client how to construct an appropriate URL for getting or setting each property, as in:

<link rel="property" href=".;prop1">

This syntax assumes precisely one property per link statement, though it may be possible/desireable to define "chain" multiple property declarations into a single statement.

;property

It is conventional, but not mandatory, to use a semicolon (";") as the first character of each property. This follows the convention used in, e.g. ColdFusion, and eases human-readability.

Examples

  • TBD

Open Issues

  • Can properties be hierarchical? If so, is ";prop1/subprop1" the proper syntax?
  • Is that the right href syntax for a relative property?
  • Can properties be chained together? If so, are they retrieved in parallel, or would those be subproperties?
  • Would we need to worry about semicolon exploits?
Probably not in general, but any implementation which uses a database-style back end (vs. flat files) would need to guard against injection attacks. The ";" itself isn't the problem at all, expect for the fact that it was used as a "escape sequence" by some applications, with the terminal string fed directly into a database (bad!).
  • Are there other conventions we should follow/avoid?
  • Should the "Link:" tag itself be declared in HTTP "OPTIONS"?
  • How does thi relate to RDF? Could a normative RDF schema be mapped into relProperty? Or just vice versa?