[This local archive copy is from the official and canonical URL, http://www.mel.nist.gov/psl/xml/, 1999-02-23; please refer to the canonical source document if possible.]


Representing PSL as XML

[Return to PSL home page]


The following example illustrates how data described by PSL semantics can be represented using XML (the Extensible Markup Language). The XML representation employs RDF (the Resource Description Framework). Although RDF is designed for specifying metadata about resources on the Web, a basic type system defined for RDF enables RDF to be used for specifying schemas. The example makes use of this RDF schema language.

Process Scenario

The scenario represented is a very simple one and is not intended to prove or disprove anything regarding XML's suitability for encoding process specifications, nor does it claim to capture all of the semantics that a PSL specification would. It is meant merely to serve as an initial experiment in mapping PSL to XML. The scenario, adapted from the larger and far more complicated Camile Motor Works manufacturing process interoperability scenario (documented in this technical report, a 628K postscript file), consists of an activity Finish product. Finish product involves a Paint activity, followed by a Sand activity, followed by another Paint activity, and concluding with a final Sand activity. Paint has three sub-activities: Mix paint, Apply paint, and Clean brush. Sanding is performed the first time using 100 grit sand paper and the second time using 200 grit sand paper.

So Why Use XML and RDF to Represent PSL-modeled Data?

XML is desirable for representing process specifications because:

Here is an example of what an interactive PSL browser for the scenario above implemented using XML might look like. The user interface consists of an outline specifying the process's activities in sequential order. Users may collapse or expand the outline by clicking on the icons to the left of each activity occurrence. Thanks to the data structures output by the XML parser, the application is able to dynamically change the appearance of the PSL browser window in response to a user's mouse clicks.

openFinish product p1 to p9
openPaint p1 to p4
openMix paint p1 to p2
Paint="paint-primer" PaintMixer="mixer"
openApply paint p2 to p3
Paint="paint-primer" PaintBrush="brush"
closedClean brush p3 to p4
closedSand p4 to p5
closedPaint p5 to p8
openSand p8 to p9
SandPaper="s2[grit=200]"

Representation in XML

This document is a complete XML specification of our simple scenario and is a superset of the XML fragments specified in-line below. Its XML markup has been tested for well-formedness using James Clark's SP tool kit, and its RDF parses successfully with the SiRPAC RDF parser.

The paint, brush, mixer, thinner, and sand paper are represented in RDF as follows:

   <rdf:RDF>
      <Class ID="Paint"/>
      <Class ID="PaintBrush"/>
      <Class ID="PaintMixer"/>
      <Class ID="PaintThinner"/>
      <Class ID="SandPaper"/>
      <Property ID="grit">
         <rdfs:range rdf:resource="#Grit"/>
         <rdfs:domain rdf:resource="#SandPaper"/>
      </Property>
      <Class ID="Grit"/>
      <c:Grit rdf:ID="100"/>
      <c:Grit rdf:ID="200"/>
      <c:Paint rdf:ID="paint-primer"/>
      <c:Paint rdf:ID="paint-blue"/>
      <c:PaintBrush rdf:ID="brush"/>
      <c:PaintMixer rdf:ID="mixer"/>
      <c:PaintThinner rdf:ID="thinner"/>
      <c:SandPaper rdf:ID="s1">
         <c:grit rdf:resource="#100"/>
      </c:SandPaper>
      <c:SandPaper rdf:ID="s2">
         <c:grit rdf:resource="#200"/>
      </c:SandPaper>
   </rdf:RDF>

The following picture, created using SiRPAC, is a graphical visualization of the subset of the data model describing the sand paper.

sand paper RDF data model

Activity specifications are represented in a hierarchical fashion with sub-activities enclosed inside their parent(s). If an activity requires a resource, a reference is made to the class defined in the RDF model for that resource.

   <activities>
      <activity id="a1">
         <name>Finish product</name>
         <subactivities>
            <activity id="a2">
               <name>Paint</name>
               <subactivities>
                  <activity id="a3">
                     <name>Mix paint</name>
                     <requires>
                        <resource rdf:resource="#Paint"/>
                        <resource rdf:resource="#PaintMixer"/>
                     </requires>
                  </activity>
                  <activity id="a4">
                     <name>Apply paint</name>
                     <requires>
                        <resource rdf:resource="#Paint"/>
                        <resource rdf:resource="#PaintBrush"/>
                     </requires>
                  </activity>
                  <activity id="a5">
                     <name>Clean brush</name>
                     <requires>
                        <resource rdf:resource="#PaintBrush"/>
                        <resource rdf:resource="#PaintThinner"/>
                     </requires>
                  </activity>
               </subactivities>
            </activity>
            <activity id="a6">
               <name>Sand</name>
               <requires>
                  <resource rdf:resource="#SandPaper"/>
               </requires>
            </activity>
         </subactivities>
      </activity>
   </activities>

Occurrences of activities are specified in sequential order with sub-activities enclosed inside parent activities. Each activity occurrence has a beginning and ending time point and, if it cannot be decomposed into sub-activities, a list of RDF-defined objects it uses. Here is the XML defining the first occurrence of the Paint activity:

         <occurrence activity="a2" begin="p1" end="p4">
            <suboccurrences>

               <!-- mix primer -->
               <occurrence activity="a3" begin="p1" end="p2">
                  <objects>
                     <resource rdf:resource="#paint-primer"/>
                     <resource rdf:resource="#mixer"/>
                  </objects>
               </occurrence>

               <!-- apply primer -->
               <occurrence activity="a4" begin="p2" end="p3">
                  <objects>
                     <resource rdf:resource="#paint-primer"/>
                     <resource rdf:resource="#brush"/>
                  </objects>
               </occurrence>

               <!-- clean brush -->
               <occurrence activity="a5" begin="p3" end="p4">
                  <objects>
                     <resource rdf:resource="#brush"/>
                     <resource rdf:resource="#thinner"/>
                  </objects>
               </occurrence>

            </suboccurrences>
         </occurrence>

XML and RDF Reference Materials

Questions? Comments?

Contact Josh Lubell.


Last modified Jan 20, 1999.