Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SML Overview

Revision as of 15:34, 25 August 2008 by Amehrega.ca.ibm.com (Talk | contribs) (SML References)

Service Modeling Language Overview

This document gives an overview of the emerging standards, Service Modeling Language (SML) and Service Modeling Language Interchange Format (SML-IF) and their support in COSMOS. For a complete description, see the linked standards and COSMOS Eclipse-based documentation.

What is SML?

Service Modeling Language (SML) is "used to model complex services and systems, including their structure, constraints, policies, and best practices." It uses an extension of XML schema and is based on a profile of Schematron.

The language is domain neutral and can be applied to "deployment, monitoring, policy, health, capacity planning, service level agreements", and etc...

The constraints are captured in two ways:

  • XML Schema Extensions
  • Schematron Rules

Before delving into each method, SML references needs to be explored.

SML References

One significant advantage of using SML is the ability to reference elements within or outside an SML document. The purpose of an SML reference is to declare a relationship between one entity and another. For example, the applications making up a service, the service registered on a repository, or a service conformance to a service level agreement (SLA). See the figure below:

Sml references.png

Although the standard is open to using any reference schema, there is a particular one defined: SML URI Scheme. The syntax of the scheme is:

 SMLURI ::= URI ('#' SMLXPath1_Fragment_ID)?

URI is dereferenced to retrieve the document and SMLXPath1_Fragment_ID is dereferenced to retrieve a specific element contained in the document. The fragment is defined using XPath. Here is an example of an SML reference:

<RequiredPreRequisite sml:ref="true">
   <sml:uri>Course1</sml:uri>
</RequiredPreRequisite>

XML Schema Extensions

In addition to using standard XML schema to define constraints, the SML standard defines six constraints on SML references. Each constraint is described in more details below:

  • sml:acyclic - Prohibits cycles for a referenced element type
  • sml:targetRequired - Indicates the requirement for a reference to be resolved
  • sml:targetElement - Indicates the element name a reference should resolve to
  • sml:targetType - Indicates the element type a reference should resolve to
  • sml:key - Similar to xs:key but allows cross document references
  • sml:keyref - Similar to xs:keyref but allows cross document references
  • sml:unique - Similar to xs:unique but allows cross document references

Schematron Rules

Schematron is an ISO standard used to define constraints not on the grammar but on the content of the document. Schematron is applied by first locating a context node and applying all assertion tests that applies. Examples of constraints includes:

  • IPv4 address must have four bytes
  • The text content of a dereferenced element must start with a token

There are different ways of applying rules to an SML document. See the specification for a details. The following example defines an Schematron rule on an element declaration. The constraint ensures an SLA is associated with all external services:

<xs:element name="Services" type="tns:ServicesType">
   <xs:annotation>
      <xs:appinfo>
         <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
            <sch:ns prefix="u" uri="http://service.example.org" />
            <sch:ns prefix="smlfn" uri="http://www.w3.org/2008/09/sml-function"/>
            <sch:pattern id="ExternalServicePattern">
               <sch:rule context="tns:Service[@type='external']">
                  <sch:assert test="count(smlfn:deref(tns:SLA)) > 0">
                     For security reasons, a service level agreement must be associated with
                     all external services
                  </sch:assert>                 
               </sch:rule>
            </sch:pattern>
         </sch:schema>
      </xs:appinfo>
   </xs:annotation>
</xs:element>

Back to the top