Dave Johnson on open web technologies, social software and software development
« Web Integration... | Main | WIP: Common Navigati... »
This is the first in my series of Web Integration Patterns. Check out the intro at this URL http://rollerweblogger.org/roller/entry/web_integration_patterns
Synopsis
Use links as a way to integrate web sites & applications via navigation and relationships between resources.
Motivations
Related patterns
The web is the web and hypertext is hyper because of links. Links allow for the most deep and also the most shallow forms of integration. Links enable navigation and with some discipline, links can also express relationships between resources. There are a variety of ways to express links; the standard and most popular way is to use HTML, but there are others and Ill cover them below.
With links, you can provide navigation between web applications at the application, or the feature level. One example is providing a link from the blog application of a social software suite to the wiki, forums and other component applications. Another is providing a link from one application to one specific part or feature of another application. This type of linking is easy to implement but fairly shallow. Its convenience and not much more.
Whats more useful and powerful, is using links to create meaningful relationships between the resources provided by web applications. For example, there's obvious value linking a defect in a bug tracking system to the source code changes that fixed the bug in a source code management system. Or, you might link a Requirement resource to the Work-Item resources that implement it. By the way, those example are drawn from the OSLC specs for ALM / PLM integration.
If you want to use links to establish relationships, then you do have to have some discipline about the URLs you offer and the URLs you link to. You have to treat links with the same rigor and respect youd give primary and foreign keys in a relational database. For example, if you make a resource available in different formats, and each at a different URL, one that ends in .html and one with .xml and one with .json then youve got three URLs that refer same resource. In this case, its better to use Content Negotiation so you can offer one URL that others can use to link to the resource.
One way to get yourself some link discipline is to adopt Linked Data and the RDF data model, which extends the linking structure of the Web to use URIs to name the relationship between things as well as the two ends of the link. See also the Web Annotations and Linked Data & REST pattern.
The standard way to represent links on the web is through HTML and in HTML, links are expressed in a variety of ways, via anchor tags, via image tags, the link tag and others. There are other standard ways to express links, but none as popular as HTML.
HTML
In HTML, links can be expressed via the <a>
element, for expressing a hyperlink in text, and the <link>
element, for expressing a link to a resource associated with the page.
<a>
and <link>
links can specify not only the URL of the link but also the relationship type of the link, as well as content-type and language for the resource that lies at the other end of the link. For example, a link type of rel=next
indicates that a link points to the next page in a series of pages, or multi-page article. A link type of rel=stylesheet
indicates that the link is to style-sheet to be applied to the current page. There are a standard set of link relationship types in the HTML spec. Here's an example from this very blog page, the link to this blogs Atom feed:
<link rel="alternate" type="application/atom+xml" title="Recent Entries (Atom)" href="http://rollerweblogger.org/roller/feed/entries/atom" />
Atom
The Atom Syndication Format defines a <link>
element, modeled on the one in HTML. Atom adds a length attribute, the size in bytes of the resource at the other end of the link. Atom defines some new links types, alternate, related, self and enclosure. Atom also allows new links to be added and a Atom link-type registry is maintained at IANA.org. Heres an example link from the Atom comments feed for this blog:
<link rel="alternate" type="text/html" href= "http://rollerweblogger.org/roller/entry/apache_roller_5_0_rc3#comment-12941523" />
RDF
Another standard way to express links is RDF, using any of the RDF serializations: RDF/XML, Turtle, N3 and soon, there will be a W3C standard for RDF/JSON. Yes, there will be a standard way to express links in JSON and that's good news. For now, we're stuck with RDF/XML. In RDF/XML a link is expressed via the rdf:resource
attribute, so for example a link from a Requirement to the user that created the requirement might look like this:
<dc:creator rdf:resource="https://localhost:9443/user/676" />
RDF (Wikipedia page) goes way beyond the couple dozen link attributes and relationship types provided by HTML and Atom. RDF provides ways to specify property values about any linked resource, and property values of each link. RDF also provides ways to define vocabularies of properties.
It's time to wrap-up. For better or worse, Ive written more than I expected to write and Im nowhere near done with the topic of links. I hope Ive covered the important parts. Comments are open so please correct me and make suggestions if you got some. This is the first pattern that Ive written up, so Im also interested in comments about the format, level of abstraction, value, etc. as well.
Next up: Common Navigation.
Dave Johnson in Web Development
02:49AM Mar 21, 2011
Comments [2]
Tags:
atompub
html
linkeddata
links
rdf
wip
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Web Development, some may be related to this entry.
Posted by Damian on March 21, 2011 at 02:44 PM EDT #
Posted by Dave Johnson on March 21, 2011 at 05:47 PM EDT #