Format

Creates new string attribute based on existing relation values.

Usage

format (indata, format, attrs, new-attr : outdata)

Details

Adds new-attr to indata (i.e., a dependent join) with the value equal to the template specified by format combined with the set of attributes attrs of indata. Templates consist of static strings and slot variables, that refer to attrs (in order), with each slot variable identified by the string %s.

Notes

Known Bugs

Example

Using the input:
      RELATION books: title char, author char, pub_date date, pages number
      Title1|Author1|09-01-1991|34
      Title2|Author2|12-23-1954|479
      Title3|Author2|05-09-2002|733
      Title4|Author3|01-01-1968|32
      Title5|Author2|07-03-2001|1152
    
when executing the plan:
      PLAN test
      {
       INPUT: stream books
       OUTPUT: 
      
       BODY
       {
         format (books, "The author of %s is %s", "title, author", "sentence" : result)
       }
      }
    
generates the following output:
      ----------------------------------------------
      RELATION: uformat1_result
         attrs: title, author, pub_date, pages, sentence
      ----------------------------------------------
      Title1|Author1|09-01-1991|34|The author of Title1 is Author1
      Title3|Author2|05-09-2002|733|The author of Title3 is Author2
      Title4|Author3|01-01-1968|32|The author of Title4 is Author3
      Title2|Author2|12-23-1954|479|The author of Title2 is Author2
      Title5|Author2|07-03-2001|1152|The author of Title5 is Author2
      ----------------------------------------------