1. A method for implementing a document workflow system that can be represented by a Petri net, the method comprising: determining if a document contains a control code at a refinable place in the Petri net; replacing the refinable place with a refinement network and processing the document using the refinement network only if the document contains the control code; and deleting the refinement network after the document has been processed using the refinement network.