OpenService Extensions

From Microformats Wiki
Revision as of 22:26, 28 April 2008 by Anarchyco (talk | contribs)
Jump to navigation Jump to search

To increase the value of web content annotated with microformats (or other semantic web technologies) it is required to define a language that can be used by web applications to describe and publish their services available for different semantic contents (e.g. for a hCard).

There could be other alternatives, but one of them is to extend Microsoft [Open Service Description] and reusing also some [Open Search] concepts.

Generic OpenService Extension

mime-type

OpenService description documents are referred to via the following type:

application/openservicedescription+xml

This type is pending IANA registration.

Automatic Discovery

HTML and XHTML documents may reference related OpenService description documents via the HTML 4.0 <link/> element.

The following restrictions apply:

  • The "type" attribute must contain the value "application/openservicedescription+xml ".
  • The "rel" attribute must contain the value "service".
  • The "href" attribute must contain a URI that resolves to an OpenService description document.
  • The "title" attribute may contain a human-readable plain text string describing the service.

The HTML <head/> element should include a "profile" attribute that contains the value "http://www.microsoft.com/schemas/openservicedescription/1.0". Example of an HTML document that includes OpenSearch autodiscovery link elements:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
   <head profile="http://www.microsoft.com/schemas/openservicedescription/1.0">
     <!--- ... --->
     <link rel="service"
           type="application/openservicedescription+xml" 
           href="http://example.com/service1.xml"
           title="Service 1" />
     <link rel="service"
           type="application/opensearchdescription+xml" 
           href="http://example.com/service2.xml"
           title="Service 2" />
     <!--- ... --->
   </head>
   <body>
     <!--- ... --->
   </body>
 </html>

The "rel" attribute of the link element should contain the value "service" when referring to OpenService description documents. This relationship value is pending IANA registration.

OpenService extension for microformats contexts (a.k.a. microservices)

This specification extends the original [OpenService specification].

OpenService description includes the concept of context which is used to describe the content this service can be applied to. The possible contexts included in the original OpenService specification are selection, document and link. This specification extends the possible contexts to include microformats. The value used must be the standard microformat name as defined in microformats.org (e.g. hCard, hCalendar, tag). To indicate a required parent for the microformat a dotted notation can be used (e.g. hCard.adr indicates an addr content that must be child of a hCard content)

Other required extension is new variables that can be used to compose the url parameters that will be sent to the service. These new variables include the microformats' properties:

  • The name of the variables must be the standard property name as defined in microformats.org and prepended by the microformat name to avoid collisions (hCard.fn, hCalendar.location, tag).
  • The value of the variable must be the value of the microformat's property.
    • If the property is a composed property.... TBD
    • If more than one instance of the property is found (plural properties), they must be included separated by commas.
<?xml version="1.0" encoding="utf-8"?>
<openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0">
<display>
<name>Find videos on YouTube</name>
<icon>http://www.youtube.com/favicon.ico</icon>
</display>
<homepageUrl>http://youtube.com</homepageUrl>
<activity category="Tags">
<activityAction context="adr">
<execute method="get" action="http://youtube.com/results?search_query={adr.street-address}">
</execute>
</activityAction>
</activity>
</openServiceDescription>

All variables are treated as required unless it the modifier "?". An optional variable that cannot be resolved is treated as an empty string for an inline parameterized URL. In a form-based parameterized URL the entire parameter element is ignored.

Example of an optional variable in an inline parameterized URL:

<execute method="get" action="http://youtube.com/results?search_query={adr.street-address}">

Pending issues:

  • Include support for services that require more than one microformat.
  • Include support for semantic content other than microformats (RDF, RDFa, eRDF)
  • Should be very identifier prepended by a "microformat" prefix to avoid collisions (e.g. microformat.hCard.adr)?

OpenService extension to describe Operator User Scripts

<?xml version="1.0" encoding="utf-8"?>
<openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0">
<display>
<name>Find videos on YouTube</name>
<icon>http://www.youtube.com/favicon.ico</icon>
</display>

<homepageUrl>http://youtube.com</homepageUrl>
<activity category="Tags">
<activityAction context="tag">
<execute method="script">
<script>
<![CDATA[
if (semanticObject.tag) {
return("http://youtube.com/results?search_query=" + encodeURIComponent(semanticObject.tag));
}
]]>
</script>
</execute>
</activityAction>
</activity>

</openServiceDescription>