Class PrologGraphReader
- All Implemented Interfaces:
IO
,ProCAKEReader
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 Summary
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
DEFAULT_ENCODING, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, LOG_WRONG_PARAMATER_TYPE, RESOURCE_XML
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.ProCAKEReader
LOG_ENTITY_NOT_FOUND, LOG_UNKNOWN_ATTRIBUTE_IN_TAG
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
overwritten copy-method from Object; use it to copy a complete operatorgetName()
Each io component must have a name that is used inIOFactory.newIO(String)
.boolean
isHandlerFor
(Class value) Checks if the io component is capable to perform the operation for objects of this class.read()
Reads the give filename or input source and returns the parsed object.void
setFilename
(String filename) Each reader must be able to read a file from a specified path.void
setInputStream
(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 Details
-
READER_NAME
Name of the parser- See Also:
-
-
Constructor Details
-
PrologGraphReader
public PrologGraphReader()
-
-
Method Details
-
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()
). -
isHandlerFor
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 interfaceIO
- Parameters:
value
- The class that has to be checked.- Returns:
- Results
true
if the class can oeprate with the given class.
-
copy
overwritten copy-method from Object; use it to copy a complete operator -
setFilename
Each reader must be able to read a file from a specified path.- Specified by:
setFilename
in interfaceProCAKEReader
- Parameters:
filename
- The filename that should be read.
-
setInputStream
Each reader must be able to read from an input stream.- Specified by:
setInputStream
in interfaceProCAKEReader
- Parameters:
inputStream
- Thethat should be read
.
-
read
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 interfaceProCAKEReader
- Returns:
- Returns the parsed object.
- Throws:
CAKEIOException
-