How to use the defination about 'bpmn:import'?

How is the definition of’bpmn:import’ used in practical applications? I saw this definition in the definition file, but I didn’t find more explanation. Can you give me an example?

What is the definition file?

Generally, bpmn:import is about importing external files to BPMN. Then, you can use those in bpmn:itemDefinitions. I’ve found one example of bpmn:import in the MIWG test suite: bpmn-miwg-test-suite/C.1.1.bpmn at master · bpmn-miwg/bpmn-miwg-test-suite · GitHub

I find the definition in moddle-xml

Thanks barmac for your reply :grin:.

Usually we do the collaboration process like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dd="http://www.mycompany.com/NewBPMN4186350044842" id="Def_1620887979618" name="definition" targetNamespace="http://www.mycompany.com/NewBPMN4186350044842" exporter="BPMN" exporterVersion="1.0">
  <collaboration id="Collaboration_1ddv8cm">
    <participant id="Participant_00we9pd" processRef="Pro_1620887979618" />
    <participant id="Participant_1hnsfj7" processRef="Process_1irpueh" />
  </collaboration>
  <process id="Process_apox1sz" name="new process">
    <startEvent id="Event_180m6wb" />
    <endEvent id="Event_0qc51la" />
  </process>
  <process id="Process_1irpueh">
    <startEvent id="Event_16lif8m" />
    <endEvent id="Event_1wef4yk" />
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1" name="">
    <bpmndi:BPMNPlane bpmnElement="Collaboration_1ddv8cm">
      <bpmndi:BPMNShape id="Participant_00we9pd_di" bpmnElement="Participant_00we9pd" isHorizontal="true">
        <dc:Bounds x="170" y="90" width="600" height="250" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_180m6wb_di" bpmnElement="Event_180m6wb">
        <dc:Bounds x="242" y="192" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0qc51la_di" bpmnElement="Event_0qc51la">
        <dc:Bounds x="682" y="192" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Participant_1hnsfj7_di" bpmnElement="Participant_1hnsfj7" isHorizontal="true">
        <dc:Bounds x="170" y="420" width="600" height="250" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_16lif8m_di" bpmnElement="Event_16lif8m">
        <dc:Bounds x="242" y="542" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1wef4yk_di" bpmnElement="Event_1wef4yk">
        <dc:Bounds x="682" y="542" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

bpmn:participant in bpmn:collaboration use processRef to associate a process id. Can I use bpmn:import to import an external bpmn2 file and render it in the participant, without using process?

As follows:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dd="http://www.mycompany.com/NewBPMN4186350044842" id="Def_1620887979618" name="definition" targetNamespace="http://www.mycompany.com/NewBPMN4186350044842" exporter="BPMN" exporterVersion="1.0">
  <import importType="http://www.w3.org/2001/XMLSchema" location="remote_file1.bpmn2" namespace="http://xsdTypes.org/"/>
  <import importType="http://www.w3.org/2001/XMLSchema" location="remote_file2.bpmn2" namespace="http://xsdTypes.org/"/>
  <collaboration id="Collaboration_1ddv8cm">
    <participant id="Participant_00we9pd" processRef="some_remote_file_id_1" />
    <participant id="Participant_1hnsfj7" processRef="some_remote_file_id_2" />
  </collaboration>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1" name="">
    <bpmndi:BPMNPlane bpmnElement="Collaboration_1ddv8cm">
      <bpmndi:BPMNShape id="Participant_00we9pd_di" bpmnElement="Participant_00we9pd" isHorizontal="true">
        <dc:Bounds x="170" y="90" width="600" height="250" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_180m6wb_di" bpmnElement="Event_180m6wb">
        <dc:Bounds x="242" y="192" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0qc51la_di" bpmnElement="Event_0qc51la">
        <dc:Bounds x="682" y="192" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Participant_1hnsfj7_di" bpmnElement="Participant_1hnsfj7" isHorizontal="true">
        <dc:Bounds x="170" y="420" width="600" height="250" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_16lif8m_di" bpmnElement="Event_16lif8m">
        <dc:Bounds x="242" y="542" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1wef4yk_di" bpmnElement="Event_1wef4yk">
        <dc:Bounds x="682" y="542" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


Depends on the tool you use. In bpmn-js, we can only read one XML/BPMN at time. Why don’t you just include the processes in your BPMN?

We are using bpmn-js to refactor an old project to be compatible with the flow chart of the old version,so… :upside_down_face: