S-RAMP's tree structure design
brmeyer Nov 14, 2014 9:19 AMLately, a few questions have come up regarding S-RAMP's tree structure. For what it's worth, I figured I'd throw this out as a reference:
First, a couple of S-RAMP topics to note. Artifacts in the repository are either "primary" or "derived". As an example, if you upload a WSDL (primary artifact -- WsdlDocument), we automatically derive other artifacts from that: Messages, Operations, Ports, etc. All artifacts carry metadata, built-in and provided by S-RAMP. Users can also provide custom properties, as well as relationships between artifacts. Some of the relationships are automatic (based on the "derivers"), others are custom and controlled ad-hoc by the user. We also support ontology classifications.
All of that is to describe the tree. Here's a quick overview:
When you upload a primary artifact, it's assigned a UUID. That UUID is used to generate the tree path, rather than something more logical/hierarchical. There are several reasons for this, most notably performance (limit the tree width -- any node is guaranteed to have <= 255 children). For example, a UUID of 76baf4a0-69ad-11e4-9803-0800200c9a66 would end up on a path of /s-ramp/76/ba/f4/a0-69ad-11e4-9803-0800200c9a66 (more of a B-Tree structure). So, if you solely push in primary artifacts, those artifacts don't result in any derived artifacts, and no relationships are defined, you'd have a directed acyclic graph (although, technically, I believe Modeshape might have each node carry a "parent" reference, but we don't actually use that).
Derived artifacts are the only true hierarchical leaves on the tree, attached to the primary artifact that created them. Many of our built-in derivers (XSD, WSDL, WS-Policy, Switchyard, Teiid, etc.) result in relationships, linking together the set of derived artifacts in useful ways. Users can also define ad-hoc relationships between any artifacts, both primary and derived. All relationships become named Modeshape node references.
Other graphs, such as a pure cycle graph, are certainly possible. However, it is largely up to the client to configure the relationships in a cyclic manner.