Class PrologGraphParser
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
-
- de.uni_trier.wi2.procake.data.io.IOImpl
-
- de.uni_trier.wi2.procake.data.io.text.PrologGraphParser
-
public class PrologGraphParser extends IOImpl implements Reader
Capable of reading Prolog-styled text-formats, which do represent a Graph-structure. Following are the import-capabilities of this parserWith 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 Summary
Fields Modifier and Type Field Description static StringPARSERNAMEName of the parser-
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
COMPONENT, COMPONENT_KEY, DEFAULT_ENCODING, LOG_CONTENTHANDLER_NOT_FOUND, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, LOG_WRITER_NOT_FOUND, LOG_WRONG_PARAMATER_TYPE, RESOURCE_XML
-
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.Reader
COMPONENT, COMPONENT_KEY, LOG_ENTITY_NOT_FOUND, LOG_MISSING_ATTRIBUTE_IN_TAG, LOG_NO_READER_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_ATTRIBUTE_IN_TAG, LOG_UNKNOWN_TAG
-
-
Constructor Summary
Constructors Constructor Description PrologGraphParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IOcopy()overwritten copy-method from Object; use it to copy a complete operatorStringgetDescription()A description of the io component.StringgetName()Each io component must have a name that is used inIOFactory.newIO(String).booleanisHandlerFor(Class value)Checks if the io component is capable to perform the operation for objects of this class.Objectread()Reads the give filename or input source and returns the parsed object.voidsetFilename(String filename)Each reader must be able to read a file from a specified path.voidsetInputStream(InputStream inputStream)Each reader must be able to read from an input stream.-
Methods inherited from class de.uni_trier.wi2.procake.data.io.IOImpl
getFamily, getParameters, postInit, preInit, setFamily
-
Methods inherited from class de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
getParameter, initParametersBasedOn
-
-
-
-
Field Detail
-
PARSERNAME
public static final String PARSERNAME
Name of the parser- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public String getName()
Each io component must have a name that is used inIOFactory.newIO(String). The name must be unique thus it is usefull to use a short description or to the class name (this.getClass().getName()).
-
getDescription
public String getDescription()
A description of the io component. The description should contain the file format and the classes that can be managed.- Specified by:
getDescriptionin interfaceIO- Overrides:
getDescriptionin classIOImpl- Returns:
- a description 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:
isHandlerForin interfaceIO- Parameters:
value- The class that has to be checked.- Returns:
- Results
trueif the class can oeprate with the given class.
-
copy
public IO copy()
overwritten copy-method from Object; use it to copy a complete operator
-
setFilename
public void setFilename(String filename)
Each reader must be able to read a file from a specified path.- Specified by:
setFilenamein interfaceReader- 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:
setInputStreamin interfaceReader- Parameters:
inputStream- Thethat 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:
readin interfaceReader- Returns:
- Returns the parsed object.
- Throws:
CakeIOException
-
-