Home / Online docs

M-cube Sample Queries

Parser and Generator test queries

These queries are provided to show how parser and SQL code generator work. To test these queries use Parse and Show SQL commands from M-cube query tool.

Sample 1
Info: 
Returns: IDs 11, 12

SELECT componentimplementations
HAVING ((ProductURL = "XXX") OR (NOT ProductURL = "YY"))
AND (OperatingSystem REV base "Solaris 2.6")

Sample 2
Info: 
Returns: nothing

SELECT componentimplementations
HAVING (ProductURL = "XXX")
AND (Processor successor "i80386")

Sample 3
Info: component types providing any interface
Returns: IDs 8, 6

SELECT componenttypes
JOIN (WITH interfaces THROUGH REV provides)

Sample 4
Info: component implementations with primitive architectures
Returns: IDs 11, 12

SELECT componentimplementations
JOIN (WITH architectures THROUGH REV implements
      HAVING (ArchitectureType base "primitive"))

Sample 5
Info:  Parser stress test (Parse & Show SQL only, don't execute because DB engine hangs!)
Returns: N/A

SELECT componentimplementations
HAVING ((ProductURL = "XXX") OR (NOT ProductURL = "YY"))
AND (OperatingSystem REV base "Solaris 2.6")
JOIN ((WITH architectures THROUGH REV implements
      HAVING (ArchitectureType base "primitive"))
 AND (NOT WITH DistributionPackages THROUGH ContainedIn
      HAVING (ArchiveType base "ZIP")
      JOIN (WITH Interfaces THROUGH REV Contains)))
 OR  (WITH Architectures THROUGH REV implements
      HAVING (ArchitectureType base "root"))

Sample data testing

These queries are provided to check if parser and generator generate proper SQL statements together with proper relation and relationship closure rebuild.

Sample 6
Info: A simple query using a dimension (a hierarchical attribute)
Returns: IDs 3, 11, 12 (all objects of given type)

SELECT componentimplementations
HAVING (VirtualMachine base "JVM")

Sample 7
Info: A combination of hierarchical and ordinal attributes
Returns: ID 3

SELECT componentimplementations
HAVING (VirtualMachine base "JVM1.2") AND (VersionID = "1.2.2")
AND (ProductURL = "hhh")

Sample 8
Info: 
Returns: nothing

SELECT componentimplementations
HAVING (VirtualMachine base "SunJVM1.2Classical")

Sample 9
Info: reverse base relation (compare with Sample 8)
Returns: ID 3, 11

SELECT componentimplementations
HAVING (VirtualMachine REV base "SunJVM1.2Classical")

Sample 10
Info: ComponentTypes providing interface java.io.DataInput
Returns: ID 8

SELECT componenttypes
JOIN (WITH Interfaces THROUGH REV Provides
HAVING (FullName = "java.io.DataInput"))

Sample 11
Info: More complicated relationship chain, ComponentImplementations providing interface java.io.DataInput
Returns: ID 12

SELECT componentimplementations
JOIN (WITH architectures THROUGH REV implements
      JOIN (WITH componenttypes THROUGH REV refines
            JOIN (WITH Interfaces THROUGH REV Provides
            HAVING (FullName = "java.io.DataInput"))
            )
      )

Sample 12
Info: Relationships transitive closure test
Returns: IDs 16, 17

SELECT Interfaces
JOIN (WITH Interfaces THROUGH REV SubtypeOf
      HAVING (FullName = "java.io.DataInput"))

Sample 13
Info: NOT operator tests (See Sample 14 also)
Returns: ID 12

SELECT componentimplementations
HAVING (VirtualMachine base "JVM1.1")

Sample 14
Info: NOT operator tests (See Sample 13 also)
Returns: IDs 3, 11

SELECT componentimplementations
HAVING (NOT VirtualMachine base "JVM1.1")

M-cube repository self-describe samples

These queries operate over M-cube self-describing part of the sample database. They allow to check depenedencies between M-cube meta-repository object (meta level).

Sample 15
Info: types used by Object(s)
Returns: all the other objects of type McubeObject

SELECT McubeObject 
JOIN (WITH McubeObject THROUGH UsedBy
      HAVING (FullName = "Object"))

Sample 16
Info: types using TypeCategory
Returns: ObjectType (directly), Object (through ObjectType)

SELECT McubeObject 
JOIN (WITH McubeObject THROUGH REV Uses
      HAVING (FullName = "TypeCategory"))

- END -