Progress on surface syntax

The Owl-S group has been working on a draft surface syntax for the
language, plus a specification for how it gets translated into
RDF/XML.  We should be releasing a formal grammar shortly, but the
following examples more or less say it all.  If the terms "perform,"
"binding," etc. don't make sense to you, refer to the Owl-S 1.1
release.  


Example 1 --

define composite process foo(inputs: (x,y - integer),
			     precondition: loves(x,y),
			     result: (forall (z - integer u,v - string) 
					purple(x,z) => mauve(y,z)))
      {do_something;
        {
	   {
	    g :: perform a(n <= x); 
	    perform foo(x <= y, z <= g.out1)
	   }
	   ||
	   { c;d }
	}
      }

Parsetree --

<define-composite>
   foo
   iope
      <inputs>
         <hyphen>
            (x y integer)
      <precondition>
         <left-paren>
            (loves x y)
      <result>
         <left-paren>
            <forall>
               <left-paren>
                  <hyphen>
                     (z integer)
                  <hyphen>
                     (u v string)
               <when>
                  <left-paren>
                     (purple x z)
                  <left-paren>
                     (mauve y z)
   <semicolon>
      do_something
      <left-brace>
         <parallel>
            <left-brace>
               <semicolon>
                  <tag>
                     g
                     <perform>
                        a
                        <bind-param>
                           (n x)
                  <perform>
                     foo
                     <bind-param>
                        (x y)
                     <bind-param>
                        z
                        <dot>
                           (g out1)
            <left-brace>
               <semicolon>
                  (c d)

RDF/XML --

<CompositeProcess
      rdf:ID="foo">
   <hasPrecondition
         expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
         rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
      (loves x y)
   </hasPrecondition>
   <hasResult>
      <Result>
         <resultVar
               rdf:ID="#<left-paren [*_] #<hyphen [_*_]  z integer> #<hyphen [*_] u v string>>"/>
         <inCondition
               expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
               rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
            (purple x z)
         </inCondition>
         <hasEffect
               expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
               rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
            (mauve y z)
         </hasEffect>
      </Result>
   </hasResult>
   <Sequence
         rdf:parseType="Collection">
      do_something
      <Unordered
            rdf:parseType="Collection">
         <Sequence
               rdf:parseType="Collection">
            <Perform
                  rdf:ID="#g">
               <process rdf:resource="a"/>
               <hasDataFrom>
                  <Binding>
                     <theParam rdf:resource="n"/>
                     <valueFn
                           expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
                           rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
                        x
                     </valueFn>
                  </Binding>
               </hasDataFrom>
            </Perform>
            <Perform>
               <process rdf:resource="foo"/>
               <hasDataFrom>
                  <Binding>
                     <theParam rdf:resource="x"/>
                     <valueFn
                           expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
                           rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
                        y
                     </valueFn>
                  </Binding>
                  <Binding>
                     <theParam rdf:resource="z"/>
                     <valueFn
                           expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
                           rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
                        (dot g out1)
                     </valueFn>
                  </Binding>
               </hasDataFrom>
            </Perform>
         </Sequence>
         <Sequence rdf:parseType="Collection">cd</Sequence>
      </Unordered>
   </Sequence>
</CompositeProcess>


Example 2 --

define atomic process baz(outputs: (x - String),
			  result: (freezes_over(hell)
				   &
				   output(x <= 1000)))

Parsetree --

<define-atomic>
   baz
   iope
      <outputs>
         <hyphen>
            (x String)
      <result>
         <left-paren>
            <and>
               <left-paren>
                  (freezes_over hell)
               <output>
                  <bind-param>
                     (x 1000)

RDF/XML --

<AtomicProcess
      rdf:ID="baz">
   <hasResult>
      <Result>
         <hasEffect
               expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
               rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
            (freezes_over hell)
         </hasEffect>
         <withOutput>
            <OutputBinding>
               <toParam rdf:resource="#x"/>
               <valueFn
                     expressionLanguage="http://www.ihmc.us/users/phayes/SCLJune2004.html#CommonLogic"
                     rdf:dataType="http://www.w3.org/2001/XMLSchema#string">
                  1000
               </valueFn>
            </OutputBinding>
         </withOutput>
      </Result>
   </hasResult>
</AtomicProcess>


Comments: The XML is not really very accurate down at the expression
level.  I dump everything into an imaginary notation that I pretend is
Common Logic.  A more careful procedure would sort expressions into
the valueFn, valueSource, etc.  categories.

By the way, the parsetrees are "internalized" into XML tree
structures, which are then printed by an XML printer that knows
nothing about parsing or Owl-S.  The fact that there are no namespace
prefixes on most of the symbols is because I told it to print with the
default namespace set to
http://www.daml.org/services/owl-s/1.1/Process.owl.

I've written code to produce the ENTITY and xmlns preamble, but I
haven't actually tried it.

What I plan to do next is document the grammar in a form that people
can read.  I'll also put the the code to do all this in an accessible
place in case anyone wants to play with it.

-- 
                                   -- Drew McDermott
                                      Yale Computer Science Department

Received on Monday, 23 August 2004 15:58:20 UTC