Class PrologGraphReader

All Implemented Interfaces:
IO, ProCAKEReader

public class PrologGraphReader extends IOImpl implements ProCAKEReader
Capable of reading Prolog-styled text-formats, which do represent a Graph-structure. Following are the import-capabilities of this parser

With this parser it is possible to import Graph-structures into CAKE.

There is functionality in CAKE to transform Block-oriented representation of Workflows into Graph-oriented, however since there are situations, when Block-oriented representation will not work out for your situation, you might consider using this file-format for importing into CAKE

All lines starting with "wnd(" or "wed(" or "sde(" will get recognized by the importer (and NOTHING ELSE). These comment lines will not be recognized. The "%"-sign is used to keep the casebase prolog-compatible (% = comment in prolog). DON'T use comments at the end of a program-line, because this is not supported by the parser.

Method descriptions

wnd(A,B,C,D). =

New workflow(graph)-node, which belongs to the workflow A, has the uniqueID B, has the type C and uses the semantic description D

C: can be w (workflow-node), t (task-node), xs (XOR-Split), xj (XOR-Join), as (AND-Split), aj (AND-Join)

wed(A,B,C,D,E,F). =

New workflow(graph)-edge, which belongs to the workflow A, has the uniqueID B, has the preceeding node C, the following node D, the type E and the semantic description F

E: can be ht (has-task → generic-partofEdge), hc (has-control → generic-partofEdge), f (follows → generic-controlflowEdge), df (generic-dataflowEdge), g (generic-partofEdge)

The edgetypes (like has-task, has-control, ...) are recognized but not used furtheron. Instead the generic edgeClass will be instantiated and nothing more.

If you wish to compute similarites for these edgetypes → use the semantic description for these types.

sde(A, B). =

New semantic description with the ID A, and the content B

B: the prefix "name(" where name stands for a name of choice, defines the Semantic-Aggregate-class, which is used in CAKE when importing the file

B: Make sure that this name corresponds to a class-definition in the model.xml (user-class-definition-file)

B: The content inside of the brackets (e.g. "<name>(someContent)" ) is containing two fields in this example (string, array of strings)

B: The parser however supports a change of the number of fields. You could something like (string, string, array of numbers, string, number)

B: If you change that, make sure you edit also the semantic-class-definition in the model.xml

B: The order of appearance of the items has to be the same as in the semantic-class-definition in the model.xml

The order of content (node, edge, semantic description) is not of importance (wnd, wed, sed)

Any other features than described here are not supported by the parser and will result in a runtime-exception

Author:
Alexander Stromer
  • Field Details

  • Constructor Details

    • PrologGraphReader

      public PrologGraphReader()
  • Method Details

    • getName

      public String getName()
      Each io component must have a name that is used in IOFactory.newIO(String). The name must be unique thus it is usefull to use a short description or to the class name ( this.getClass().getName()).
      Specified by:
      getName in interface IO
      Returns:
      Returns the name of the io component.
    • isHandlerFor

      public boolean isHandlerFor(Class value)
      Checks if the io component is capable to perform the operation for objects of this class.

      A typical implementation looks like:

       public boolean isHandlerFor(Class value) {
              if (DataObject.class.isAssignableFrom(value))
                      return true;
              return false;
       }
       
      Specified by:
      isHandlerFor in interface IO
      Parameters:
      value - The class that has to be checked.
      Returns:
      Results true if the class can oeprate with the given class.
    • copy

      public IO copy()
      overwritten copy-method from Object; use it to copy a complete operator
      Specified by:
      copy in interface IO
      Returns:
    • setFilename

      public void setFilename(String filename)
      Each reader must be able to read a file from a specified path.
      Specified by:
      setFilename in interface ProCAKEReader
      Parameters:
      filename - The filename that should be read.
    • setInputStream

      public void setInputStream(InputStream inputStream)
      Each reader must be able to read from an input stream.
      Specified by:
      setInputStream in interface ProCAKEReader
      Parameters:
      inputStream - The that should be read.
    • read

      public Object read() throws CAKEIOException
      Reads the give filename or input source and returns the parsed object.

      Reads the content of the previously set filename into the pool.

      Specified by:
      read in interface ProCAKEReader
      Returns:
      Returns the parsed object.
      Throws:
      CAKEIOException