Example of multi-level CMDBf graph query
The CMDBf spec allows a multi-level graph query, but not to an undefined depth. In other words, you must define a prototypical graph for the query; the spec does not currently support a prototype of variable depth. Here's an example of a three-level graph query.
Business service –Depends on-> Application System –Hosted by-> ComputerSystem
I have a computer system; I want to know which application systems are hosted on it, and then which business services are dependent on those application systems.
<query xmlns="http://schema.cmdbf.org/datamodel"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cmdbf="http://schema.cmdbf.org/datamodel">
<itemTemplate id="i1">
<recordTypeSelector namespace="http://van.org/itil_thingy"
localName="BusinessService"/>
</itemTemplate>
<itemTemplate id="i2">
<recordTypeSelector namespace="http://van.org/cim_thingy"
localName="ApplicationSystem"/>
</itemTemplate>
<itemTemplate id="i3">
<instanceIdSelector>
<mdrId>myMdrId</mdrId>
<localId>myComputerId</localId>
</instanceIdSelector>
</itemTemplate>
<relationshipTemplate id="r1">
<recordTypeSelector namespace="http://van.org/cim_thingy"
localName="Dependency"/>
<source ref="i1"/>
<target ref="i2"/>
</relationshipTemplate>
<relationshipTemplate id="r2">
<recordTypeSelector namespace="http://van.org/cim_thingy"
localName="HostedDependency"/>
<source ref="i2"/>
<target ref="i3"/>
</relationshipTemplate>
</query>
The implementation could start with the most specific itemTemplate (i3) and traverse upward (to avoid processing very large intermediate result sets). Therefore as long as I am willing to accept a fixed depth, and possibly create multiple queries (one for each possible depth), I can accomplish what I want to achieve.
The committee has considered adding semantics to support variable depth queries, but no decision has been made.
_____
tags:

