Define properties with superclass from another uri

Is there a way to define own properties with superclasses from another uri?
I tried to reference the bpmn types with a bpmn or bpmn2 prefix, similar to XML Schema, but that did not work.

// the following is an excerpt of my own property definition json file. 
"types": [
{
  "name": "Guard",
  "superClass": [
    "bpmn2:FormalExpression"
  ]
}

Thanks in advance for any help.

How do you bootstrap your model?

And what “did not work”?

My project is based on the BPMN Modeler Example that is linked on the website. I created a moddleExtension and an additionalModule. I wanted to add a guard/condition property to the Lane extensionsElement. Actually this works when I use the bpmn:FormalExpression superClass as shown above. When I download the bpmn xml structure there is an extensionElement child named bpmne:guard. The bpmne namespace is also included. Everything looks fine to me, but when I try to reopen the configuration again, an error occurs with the messages:

could not parse node
Error: unrecognized element <bpmne:guard>

// This is an example part of the downloaded xml looking absolutely fine to me.
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:bpmn2="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:di="http://www.omg.org/spec/DD/20100524/DI"
               xmlns:bpmne="http://anyurl.com/schema/1.0" id="sample-diagram"
               targetNamespace="http://bpmn.io/schema/bpmn"
               xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:collaboration id="Collaboration_1f24flf">
    <bpmn2:participant id="Participant_1vscwr8" processRef="Process_1"/>
</bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:laneSet>
        <bpmn2:lane id="Lane_1yahs73">
            <bpmn2:flowNodeRef>StartEvent_1</bpmn2:flowNodeRef>
        </bpmn2:lane>
        <bpmn2:lane id="Lane_1oaiq5m">
            <bpmn2:extensionElements>
                <bpmne:guard>guard</bpmne:guard>
            </bpmn2:extensionElements>
        </bpmn2:lane>
    </bpmn2:laneSet>
    <bpmn2:startEvent id="StartEvent_1"/>
</bpmn2:process>

Please provide a reproducible test case for us, for example a HTML page similar to the bpmn-js-seed that allows us to checkout your extension locally.

I’ve added a small test case to verify that sub-classing bpmn:FormalExpression works.

I created a project that shows the issue. It is based on the properties-panel-extension example using npm and grunt. I modified the newDiagram, so that it includes the new property that extends from bpmn:FormalExpression. So you only have to click the “create a new diagram” link and the error occurs.

http://tmp.waloszek.com/bpmn-property-ext/

If you’d like to store stuff as an extension element, it must extend the reserved Element type. Extending bpmn:FormalExpression does not make sense considering the XML you import.

Sorry, but I don’t understand why this does not make sense. The FormalExpression is an Expression is a BaseElementWithMixedContent. Why isn’t FormalExpression an Element type?

The following shows an excerpt of my extension’s XML schema

<xsd:element name="guard" type="bpmne:Guard" />
<xsd:complexType name="Guard">
    <xsd:complexContent>
        <xsd:extension base="bpmn:tFormalExpression" />
    </xsd:complexContent>
</xsd:complexType>

So an xml block like that is valid

<bpmn2:lane id="Lane_1bv6cx9">
    <bpmn2:extensionElements>
        <bpmne:guard language="groovy"><![CDATA[${x < 6}]]></bpmne:guard>
    </bpmn2:extensionElements>
</bpmn2:lane>

Why isn’t FormalExpression an Element type?

Because Element is a reserved name for any type in the context of the BPMN meta-model.

Just add Element as an additional super class and you will probably be fine.

I tried it with the multiple inheritance way you described and that works well. Thanks a lot for your help.

Because Element is a reserved name for any type in the context of the BPMN meta-model2.

Ah okay, this is bpmn-moddle implementation specific. Wouldn’t it make sense that the BaseElement has a Superclass Element? Seems to me as that there is a difference between the bpmn-moddle and the BPMN Meta-Model XML Schema definition.

The XML Schema says

<xsd:element name="extensionElements" type="tExtensionElements" /> 
<xsd:complexType name="tExtensionElements">
	<xsd:sequence>
		<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /> 
	</xsd:sequence>
</xsd:complexType>

where xsd:any can be any element including tFormalExpression

Whereas the bpmn.json definition says

{
  "name": "ExtensionElements",
  "properties": [
    {
      "name": "valueRef",
      "isAttr": true,
      "isReference": true,
      "type": "Element"
    },
    {
      "name": "values",
      "type": "Element",
      "isMany": true
    },
    {
      "name": "extensionAttributeDefinition",
      "type": "ExtensionAttributeDefinition",
      "isAttr": true,
      "isReference": true
    }
  ]
},

where the values must be of type Element and FormalExpression is not of type Element

I’m glad I could help you.

The BPMN XSD schema is vague about which elements are eligible as AnyType. We simply decided that you need to be explicit about what you plan to use as a BPMN extension. That helps you to build your extension, too as only a sub-set of your elements will ever reside in <bpmn:extensionElements> directly.

You should not think of XSD as a meta model, too. It is a description of structural data and in that sense more strict about the structure but very week when it comes to references between objects (i.e. references are simply QNames or IDs). You need type information to perform a proper semantic validation.

The OMG, the creators of the BPMN standard published CMOF meta-model descriptors of the BPMN standard, too. That is the BPMN meta model, unfortunately not really maintained by the OMG in recent times. Check out their site and search for CMOF if you’re interested in details.