134 lines
5.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_gvu6xe0" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="Process initiated">
<bpmn:outgoing>Flow_1nl5h18</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1nl5h18" sourceRef="StartEvent_1" targetRef="Activity_007mchr" />
<bpmn:scriptTask id="Activity_0zgmg71" name="Modify data">
<bpmn:extensionElements>
<spiffworkflow:unitTests>
<spiffworkflow:unitTest id="ScriptUnitTest_1ea9ygy">
<spiffworkflow:inputJson>// Test Inputs
{
"flag_stars": "12",
"longest_river": "nile",
"woman_nobel": "curie"
}</spiffworkflow:inputJson>
<spiffworkflow:expectedOutputJson>// Test Outputs
{
"flag_stars": "12",
"longest": "nile",
"num_correct": 3,
"score": 100,
"woman_nobel": "curie"
}</spiffworkflow:expectedOutputJson>
</spiffworkflow:unitTest>
</spiffworkflow:unitTests>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1rhufnh</bpmn:incoming>
<bpmn:outgoing>Flow_1nzxnal</bpmn:outgoing>
<bpmn:script>num_correct = 0
if flag_stars.lower().strip() == "twelve":
num_correct += 1
elif int(flag_stars) == 12:
num_correct += 1
if "nile" in longest.lower():
num_correct += 1
if "curie" in woman_nobel.lower():
num_correct += 1
score = int(num_correct / 3 * 100)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1nzxnal" sourceRef="Activity_0zgmg71" targetRef="Activity_0uidepv" />
<bpmn:userTask id="Activity_0uidepv" name="Review results">
<bpmn:extensionElements>
<spiffworkflow:preScript># Initialize denominator
k = 1
# Initialize sum
s = 0
for i in range(1000000):
# even index elements are positive
if i % 2 == 0:
s += 4/k
else:
# odd index elements are negative
s -= 4/k
# denominator is odd
k += 2
pi = s
del(k)</spiffworkflow:preScript>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1nzxnal</bpmn:incoming>
<bpmn:outgoing>Flow_00h8381</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="Event_1otyxgi" name="Process completed">
<bpmn:incoming>Flow_00h8381</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_00h8381" sourceRef="Activity_0uidepv" targetRef="Event_1otyxgi" />
<bpmn:sequenceFlow id="Flow_1rhufnh" sourceRef="Activity_007mchr" targetRef="Activity_0zgmg71" />
<bpmn:userTask id="Activity_007mchr" name="Input data">
<bpmn:extensionElements>
<spiffworkflow:properties>
<spiffworkflow:property name="formJsonSchemaFilename" value="sample-input-form-schema.json" />
<spiffworkflow:property name="formUiSchemaFilename" value="sample-input-form-uischema.json" />
</spiffworkflow:properties>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1nl5h18</bpmn:incoming>
<bpmn:outgoing>Flow_1rhufnh</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_gvu6xe0">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="-258" y="222" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-280" y="265" width="81" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1joau9d_di" bpmnElement="Activity_0zgmg71">
<dc:Bounds x="-10" y="200" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_02yp6de_di" bpmnElement="Activity_0uidepv">
<dc:Bounds x="150" y="200" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1otyxgi_di" bpmnElement="Event_1otyxgi">
<dc:Bounds x="312" y="222" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="305" y="265" width="51" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0xyo9aq_di" bpmnElement="Activity_007mchr">
<dc:Bounds x="-170" y="200" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1nl5h18_di" bpmnElement="Flow_1nl5h18">
<di:waypoint x="-222" y="240" />
<di:waypoint x="-170" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1nzxnal_di" bpmnElement="Flow_1nzxnal">
<di:waypoint x="90" y="240" />
<di:waypoint x="150" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_00h8381_di" bpmnElement="Flow_00h8381">
<di:waypoint x="250" y="240" />
<di:waypoint x="312" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1rhufnh_di" bpmnElement="Flow_1rhufnh">
<di:waypoint x="-70" y="240" />
<di:waypoint x="-10" y="240" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>