Red Hat Training
A Red Hat training course is available for Red Hat Fuse
4.5. Query Language
4.5.1. S-RAMP Query Language
S-RAMP defines a query language that allows clients to search artifacts by various criteria. The S-RAMP query language is a subset of the XPath 2.0 language, designed specifically to find and select S-RAMP artifacts.
The query language allows clients to search artifacts based on any of the following artifact meta-data:
- Core Properties
- Custom Properties
- Classifiers
- Relationships
Here is a basic structure of a typical S-RAMP query:
/s-ramp/<artifactModel>/<artifactType>/[ <artifact-predicate> ]/relationship[ <target-artifact-predicate> ]
4.5.2. S-RAMP Query Examples
The following table lists a range of S-RAMP queries:
Table 4.8. S-RAMP Queries
| Query | What It Selects |
|---|---|
/s-ramp | All artifacts. |
/s-ramp/core | All Core Model artifacts. |
/s-ramp/xsd/XsdDocument | All XsdDocument artifacts. |
/s-ramp/xsd/XsdDocument[@name='core.xsd'] | XsdDocument artifacts named core.xsd. |
/s-ramp/xsd/XsdDocument[@name='core.xsd' and @version='1.0'] | XsdDocument artifacts named core.xsd and versioned as 1.0. |
/s-ramp/soa[@myCustomProperty='foo'] | SOA artifacts with a custom property named myCustomProperty that has value foo. |
/s-ramp/core[classifiedByAnyOf(., Maine, Alaska)] | Core artifacts classified by either Maine or Alaska (presumably from the Regions ontology). |
/s-ramp/wsdl/PortType[@name='OrderServicePT']/operation | Artifacts related to any PortType artifact named OrderServicePT via a relationship named operation. This effectively returns all of the order service port type operations. |
/s-ramp/ext/ServletFilter[relatedDocument[@uuid='12345']] | All servlet filter artifacts derived from (that is, contain a relatedDocument relationship to) an artifact with UUID 12345. |
/s-ramp/wsdl/Message[xp2:matches(.,'get.*')]/part[element] | Element style WSDL parts from WSDL messages with names starting with get. |
Note
Use single quotes for query arguments and double quotes to surround the query on execution.
For example,
s-ramp> s-ramp:query "/s-ramp/xsd/XsdDocument[@name='core.xsd' and @version='1.0']"