1. Supported Formats for Rule Documents

jQAssistant allows you to write your own rules, contraints and concepts, in three different format: XML, YAML, and Asciidoctor. This allows you to choose the document format which fits at best to your project and your environment. XML was the first and orginal document format supported by jQAssistant. Later jQAssistant allowed you embed rules in Asciidoctor documents, because Asciidoctor allows you to document your constraints and concepts and the ideas behind them much better than XML. YAML as document format is the latest addition to the set of supported formats. People how read and write a lot of YAML documents during their daily work might prefer it because of its clear structure.

The following sections provide a guidance how to embedded jQAssistant rules in these formats. How to write rules is described in the manual.

1.1. YAML

YAML is a markup language optimized to be human readable and supported by many editors and programming languages. YAML is basically based on three elements: scalar, sequence, and map. As a sequence and a map can contain any other element. Therefore YAML allows to build tree structures, a feature which allows jQAssistant to embed contraints, concepts, and groups in one document. The structure used for this is very much aligned to the XML Schema used by jQAssistant to embed rules in XML documents.

jQAssistant supports YAML 1.2. To take advantage of all YAML features, it is recommended to read the YAML specification available at https://yaml.org/spec/1.2/spec.html.

YAML 1.2 is a subset of JSON, that means any YAML 1.2 data structure can be represented by an equivalent JSON data structure. This allows to provide and to validate a YAML document against a JSON Schema.

Therefore jQAssistant provides a JSON Schema for rule documents, which can be found in the appendix.

💡
This schema can be used in an IDE like IntelliJ IDEA to check the validity of a rule document while writing it.

1.1.1. Toplevel Structure

A YAML rule document can have three keys: concepts, constraints, and groups. concepts and constraints can take a sequence with valid rule definitions and groups can take a sequence with group definitions.

Key Cardinality Description

concepts

0..1

Sequence of concept definitions

constraints

0..1

Sequence of constraint definitions.

groups

0..1

Sequence of group definitions.

A rule document with one concept, one constraint and one group definition
concepts:
  - id: spring-boot:Application
    description: >
      All types of of a Spring Boot application must be located in the same
      package or a sub-package of the application class.
    source: |
      MATCH
        (application:Type:Class)-[:ANNOTATED_BY]->
          ()-[:OF_TYPE]->(annotationType:Type)
      WHERE
        annotationType.fqn = "org.springframework.boot.autoconfigure.SpringBootApplication"
      SET
        application:Spring:Boot:Application:Configuration:Component
      RETURN
        application AS Application

constraints:
  - id: spring-component:ControllerMustOnlyDependOnServicesRepositories
    description: >
      A Spring controller can only have dependencies to other Spring components
      that are services or repositories.
    requiredConcepts:
      - refId: java:VirtualDependsOn
      - refId: spring-component:AnnotatedInjectables
    source: |
      MATCH
        (artifact:Artifact)-[:CONTAINS]->
          (controller:Spring:Controller)-[:DEPENDS_ON|VIRTUAL_DEPENDS_ON]->
            (other:Spring:Injectable)
      WHERE NOT (artifact:Test OR other:Service OR other:Repository )
      RETURN
        controller AS Controller, collect(other) AS InvalidDependencies

groups:
  - id: spring
    includedConstraints:
      - spring-component:ControllerMustOnlyDependOnServicesRepositories
    includedConcepts:
      - spring-boot:Application

1.1.2. Concepts and Constraints

Concepts and contraints are used differently by jQAssistant, but they share the same structure. Therefore contraints and concepts are document together. Due to the different usage of concepts and contraints, different default values are used for some of the available options. Since concepts and constraints are both rules, the term rule is used for both in this chapter.

A rule in a YAML rule document is represented as a map of keys. The keynames are the same or very similar to the element and attribute names used in jQAssistants’s XML Schema.

Table 1. Keys of a map to specify a rule in a YAML rule document
Key Cardinality Description

id

1

Unique id of the rule.

deprecated

0..1

Marks a rule as deprecated. A given text should be used to inform the user of the deprecation and the consequences of the deprecation.

description

0..1

Description of the rule. Intended to be shown to the user in case the verification of the rule failed and to document the rule itself.

language

0..1

Specifies the language the actual rule is written in.

If not specified it is assumed that the actual rule is written in Cypher.

report

0..1

Specifies a report which should be generated based on the result of the of rule. See Keys of a map to specify a report for details.

requiresConcepts

0..1

Sequence of rule references to concepts required by the rule. Required conceptswill be executed before the rule itself will be executed. See Keys of a map to specify the required concepts for details.

requiresParameters

0..1

Sequence of required parameters of the rule. See Keys of a map to specify the required parameters for details.

severity

0..1

The serverity of the rule. Must be one of blocker, critical, major, minor, or info.

If not specified, the default severity for a concept is minor, for constraint it is major.

verify

0..1

The verification method of the rule. See Keys of a map to specify the verification method for details.

source

1

The statement representing the rule.

Table 2. Keys of a map to specify the required concepts
Key Cardinality Description

refId

1

The id of a concept which must be executed before this rule. jQAssistant will ensure the required execution order of all concepts.

severity

0..1

The severity to be applied to the referenced rule, overwriting the actual specified severity.

optional

0..1

Specifies if a rule is optional or not. Possible values are true and false. The default value is false.

Table 3. Keys of a map to specify the required parameters
Key Cardinality Description

name

1

The name of the required parameter.

type

1

The data type of the parameter. Must be one of: boolean, byte, char, double, float, int, long, short, String

defaultValue

0..1

The default value for the parameter if not specified.

Table 4. Keys of a map to specify the verification method
Key Cardinality Description

aggregation

0..1

Verification should be performed by aggregating the value of a specific column. See Keys of a map to specify a result verification via aggregation for details.

rowCount

0..1

Verification should be performed by counting the results rows. See Keys of a map to specify a result verification via row counting for details.

If no verification method has been specified, the default result verification will be performed via rowcounting.

Table 5. Keys of a map to specify a result verification via aggregation
Key Cardinality Description

column

0..1

The column those value will be used to perform the verification. If omitted the first column of the result set will be used for the verification.

max

0..1

The allowed inclusive maximal value for the verification used column.

min

0..1

The allowed inclusive minimal value for the verification used column.

Table 6. Keys of a map to specify a result verification via row counting
Key Cardinality Description

max

0..1

Allowed maximal inclusive number of rows in the result set of a rule.

For a constraint, the default value is 0, since a constraint may not have any results. For a concept, max has no default value, that means that there is no upper limit for the size of the result set.

min

0..1

Required minimal inclusive number of rows in the result set of a rule.

For a constraint, the default value is 0, since a constraint may not have any results. For a concept, min has a default value of 1, as a concept must have at least one match to be concidered as successful.

Table 7. Keys of a map to specify a report
Key Cardinality Description

primaryColumn

1

Specifies the column of the result set, which will be overhanded as primary column to the plugin generating the report.

If not specified the first column of the result set will be taken als primary column.

properties

0..1

Map with properties, which will be overhanded to the plugin generating the report.

type

1

Specifies the report to be generated. Which reports are available depends on the used report plugins.

1.1.3. Groups

A group in a YAML rule document is represented as a map of keys.

Table 8. Keys of a map to specify a group in a YAML rule document
Key Cardinality Description

id

1

The unique id for this group.

severity

0..1

Severity for all included groups, constraints, and concept, overwriting the specified severity for those. Must be one of blocker, critical, major, minor, or info.

includedConcepts

0..1

Sequence of rule references to concepts to be included in this group. See Keys of a map to specify a rule reference for details

includedConstraints

0..1

Sequence of rule references to constraints to be included in this group. See Keys of a map to specify a rule reference for details

includedGroups

0..1

Sequence of references to other groups to be included in this group. See Keys of a map to specify a rule reference for details

Table 9. Keys of a map to specify a rule reference
Key Cardinality Description

refId

1

The id of a rule or group which should be included in the containing group.

severity

0..1

The severity to be applied to the referenced rule or group, overwriting the actual specified severity.

optional

0..1

Specifies if the rule or group is optional or not. Possible values are true and false. The default value is false.

1.1.4. Examples

1.2. XML

1.3. Asciidoctor

2. AsciiDoc Report Plugin

The documentation of this plugin is still only the section Asciidoc Report Plugin of the jQAssistant Manual available.

3. CDI Plugin

The documentation of this plugin is still only the section CDI Plugin of the jQAssistant Manual available.

4. EJB 3 Plugin

The documentation of this plugin is still only the section EJB 3 Plugin of the jQAssistant Manual available.

5. GraphML Plugin

The documentation of this plugin is still only the section GraphML Plugin of the jQAssistant Manual available.

6. GraphQL Plugin

The GraphQL plugin provides scanners for GraphQL schemas provided via

  • SDL files (having the extension .graphql or .graphqls)

  • Introspection queries to HTTP endpoints by scanning an URL, e.g. jqassistant scan -u graphql:schema::https://bahnql.herokuapp.com/graphql

💡
For an introduction into GraphQL, its schema and elements refer to http://graphql.org.

6.1. Features

  • Scanning of

    • SDL files

    • HTTP endpoints by executing an introspection query using scope graphql:schema

  • Supported schema elements

    • Object types including fields and implemented interfaces

    • Input object types including fields

    • Enum types including defined values

    • Scalar types

    • Interface types including fields

    • Union types including the types

    • Directive types

  • All supported elements provide additional information

    • The source location (i.e. line and column numbers)

    • Specifed directives and their values

6.2. Feature Requests and Bugs

In case of a missing feature or any kind of unexpected or faulty behaviour, please file an issue via Github.

6.3. The Model

Entity Used Combination of Labels

Schema

:GraphQL:Schema

Schema File

:GraphQL:Schema:File

Schema URL

:GraphQL:Schema:URL

Type

:GraphQL:Type

Value

:GraphQL:Value

Scalar Type

:GraphQL:Scalar:Type

Scalar Value

:GraphQL:Scalar:Value

Enum Type

:GraphQL:Enum:Type

Enum Value

:GraphQL:Enum:Value

Interface Type

:GraphQL:Interface:Type

Object Type

:GraphQL:Object:Type

Field

:GraphQL:Field

Input Object Type

:GraphQL:Input:Object:Type

Input Field

:GraphQL:Input:Field

Input Value Definition

:GraphQL:Input:ValueDefinition

Union Type

:GraphQL:Union:Type

List Type

:GraphQL:List:Type

Directive Type

:GraphQL:Directive:Type

Directive Value

:GraphQL:Directive:Value

Directive Location

:GraphQL:Directive:Location

Argument

:GraphQL:Argument

6.4. Schema

Represents a GraphQL schema.

Table 10. Used Combination of Labels

Used labels

:GraphQL:Schema

Table 11. Relations of a GraphQL Schema
Relation Name Target Node Cardinality Description

DECLARES_TYPE

Type

0..n

References all GraphQL types which are declared in the schema

REQUIRES_TYPE

Type

0..n

References all GraphQL types which are required by the schema (i.e. referenced but not declared)

6.5. Schema File

A file with the the extension .graphql or .graphqls containing a GraphQL Schema.

Table 12. Used Combination of Labels

Used labels

:GraphQL:Schema:File

6.6. Schema Url

A URL (i.e. endpoint) providing a GraphQL Schema.

Table 13. Used Combination of Labels

Used labels

:GraphQL:Schema:URL

Table 14. Properties of :GraphQL:Schema:URL
Property Name Existence Description

url

always

The URL.

6.7. Type

Represents a GraphQL type.

Table 15. Used Combination of Labels

Used labels

:GraphQL:Type

Table 16. Relations of a GraphQL Type
Relation Name Target Node Type Cardinality Description

DECLARES_DIRECTIVE

Directive Value

0..n

References to the declared directive values

Table 17. Properties of :GraphQL:Type
Property Name Existence Description

name

always

The name.

description

not always

The optional description as provided in the GraphQL schema.

line

not always

The optional line number of the source location within the GraphQL schema.

column

not always

The optional column of the source location within the GraphQL schema.

6.8. Value

Represents a value (e.g. a scalar or enum).

Table 18. Used Combination of Labels

Used labels

:GraphQL:Value

6.9. Scalar Type

Represents a GraphQL Scalar Type.

Table 19. Used Combination of Labels

Used labels

:GraphQL:Scalar:Type

6.10. Scalar Value

Represents a GraphQL Scalar value.

Table 20. Used Combination of Labels

Used labels

:GraphQL:Scalar:Value

Table 21. Properties of :GraphQL:Scalar:Value
Property Name Existence Description

value

always

The scalar value.

6.11. Enum Type

Represents a GraphQL Enum Type.

Table 22. Used Combination of Labels

Used labels

:GraphQL:Enum:Type

Table 23. Relations of an Enum Type
Relation Name Target Node Cardinality Description

DECLARES_VALUE

Enum Value

1..n

References an enum value declared by the type.

6.12. Enum Value

Represents a GraphQL Enum value.

Table 24. Used Combination of Labels

Used labels

:GraphQL:Enum:Value

Table 25. Relations of an Enum Value
Relation Name Target Node Cardinality Description

DECLARES_DIRECTIVE

Directive Value

0..n

References to the declared directive values

Table 26. Properties of :GraphQL:Enum:Value
Property Name Existence Description

name

always

The name.

description

not always

The optional description as provided in the GraphQL schema.

6.13. Interface Type

Represents a GraphQL Interface Type.

Table 27. Used Combination of Labels

Used labels

:GraphQL:Interface:Type

Table 28. Relations of an Interface Type
Relation Name Target Node Cardinality Description

DECLARES_FIELD

Field

0..n

References the declared GraphQL fields

6.14. Object Type

Represents a GraphQL Object Type.

Table 29. Used Combination of Labels

Used labels

:GraphQL:Object:Type

Table 30. Relations of an Object Type
Relation Name Target Node Cardinality Description

IMPLEMENTS

Interface Type

0..n

References the implemented interface types.

DECLARES_FIELD

Field

0..n

References the declared GraphQL fields

6.15. Field

Represents a field of an object or interface type.

Table 31. Used Combination of Labels

Used labels

:GraphQL:Field

Table 32. Relations of a Field
Relation Name Target Node Cardinality Description

OF_TYPE

Of Type (Relation)

1

References the field type

DEFINES_INPUT_VALUE

Input Value Definition

0..n

References the declared GraphQL input value definitions

Table 33. Properties of :GraphQL:Field
Property Name Existence Description

name

always

The name.

description

not always

The optional description as provided in the GraphQL schema.

6.16. Of Type Relation

References a GraphQL type indicating if this reference is nullable.

Table 34. Relation to a GraphQL Type
Relation Name Target Node Type

OF_TYPE

Type

Table 35. Properties of :OF_TYPE
Property Name Existence Description

nonNull

always

If true the reference is not nullable.

6.17. Input Object Type

Represents a GraphQL Input Object Type.

Table 36. Used Combination of Labels

Used labels

:GraphQL:Input:Object:Type

Table 37. Relations of an Input Object Type
Relation Name Target Node Cardinality Description

DECLARES_FIELD

Input Field

1..n

References the declared input fields.

6.18. Input Field

Represents a GraphQL Input Field, having similar properties and relations.

Table 38. Used Combination of Labels

Used labels

:GraphQL:Input:Field

6.19. Input Value Definition

Defines an input value.

Table 39. Used Combination of Labels

Used labels

:GraphQL:Input:ValueDefinition

Table 40. Relations of an Input Value Definition
Relation Name Target Node Cardinality Description

OF_TYPE

Of Type (Relation)

1

The relation to the type.

HAS_DEFAULT_VALUE

Value

0..1

References the default value.

DECLARES_DIRECTIVE

Directive Value

0..n

References to the declared directive values

Table 41. Properties of :GraphQL:Input:ValueDefinition
Property Name Existence Description

index

always

The index number (starting with 0).

name

always

The name.

description

not always

The optional description as provided in the GraphQL schema.

line

not always

The optional line number of the source location within the GraphQL schema.

column

not always

The optional column of the source location within the GraphQL schema.

6.20. Union Type

Represents a GraphQL Union Type.

Table 42. Used Combination of Labels

Used labels

:GraphQL:Union:Type

Table 43. Relations of an Union Type
Relation Name Target Node Cardinality Description

DECLARES_TYPE

Union Declares Type

1..n

References the declared GraphQL fields

6.21. Union Declares Type

References a GraphQL type indicating the index of the relation.

Table 44. Relation to a GraphQL Type
Relation Name Target Node Type

DECLARES_TYPE

Type

Table 45. Properties of :DECLARES_TYPE
Property Name Existence Description

index

always

The index number (starting with 0).

6.22. List Type

Represents a GraphQL list Type that declares an element Type.

Table 46. Used Combination of Labels

Used labels

:GraphQL:List:Type

Table 47. Relations of a GraphQL List Type
Relation Name Target Node Type Cardinality Description

OF_ELEMENT_TYPE

Of Type (Relation)

1

References the field type

6.23. Of Element Type Relation

References a GraphQL type indicating if this reference is nullable.

Table 48. Relation to a GraphQL Type
Relation Name Target Node Type

OF_ELEMENT_TYPE

Type

Table 49. Properties of :OF_TYPE
Property Name Existence Description

nonNull

always

If true the reference is not nullable.

6.24. Directive Type

Represents a directive Type that is defined within a GraphQL schema.

Table 50. Used Combination of Labels

Used labels

:GraphQL:Directive:Type

Table 51. Relations of a GraphQL Directive Type
Relation Name Target Node Cardinality Description

DECLARES_LOCATION

Directive Location

1..n

References the allowed locations the directive can be applied to.

DEFINES_INPUT_VALUE

Input Value Definition

0..n

References the declared GraphQL input value definitions

6.25. Directive Value

Represents a directive that is present at an element of the GraphQL schema.

Table 52. Used Combination of Labels

Used labels

:GraphQL:Directive:Value

Table 53. Relations of a GraphQL Directive Value
Relation Name Target Node Cardinality Description

OF_TYPE

Directive Type

1

References the type of the directive

HAS_ARGUMENT

Argument

0..n

References arguments of the directive

6.26. Directive Location

Represents the allowed locations for a directive.

Table 54. Used Combination of Labels

Used labels

:GraphQL:Directive:Location

Table 55. Properties of :GraphQL:Directive:Location
Property Name Existence Description

name

always

The name.

6.27. Argument

Represents an argument of a GraphQL directive.

Table 56. Used Combination of Labels

Used labels

:GraphQL:Argument

Table 57. Relations of a GraphQL Argument
Relation Name Target Node Cardinality Description

HAS_VALUE

Value

1

References the argument value.

OF_INPUT_VALUE

Input Value Definition

1

References the input value defined for this argument.

Table 58. Properties of :GraphQL:Argument
Property Name Existence Description

index

always

The index number (starting with 0).

7. Java Plugin

The documentation of this plugin is still only the section Java Plugin of the jQAssistant Manual available.

8. Java EE 6 Plugin

The documentation of this plugin is still only the section Java EE 6 Plugin of the jQAssistant Manual available.

9. JAX-RS Plugin

The documentation of this plugin is still only the section JAX-RS Plugin of the jQAssistant Manual available.

10. JPA 2 Plugin

The documentation of this plugin is still only the section JPA 2 Plugin of the jQAssistant Manual available.

11. JSON Plugin

The documentation of this plugin is still only the section JSON Plugin of the jQAssistant Manual available.

12. JUnit Plugin

The documentation of this plugin is still only the section JUnit Plugin of the jQAssistant Manual available.

13. Maven 2 Repository Plugin

The documentation of this plugin is still only the section Maven 2 Repository Plugin of the jQAssistant Manual available.

14. Maven 3 Plugin

The documentation of this plugin is still only the section Maven 3 Plugin of the jQAssistant Manual available.

15. OSGi Plugin

The documentation of this plugin is still only the section OSGi Plugin of the jQAssistant Manual available.

16. RDBMS Plugin

The documentation of this plugin is still only the section RDBMS Plugin of the jQAssistant Manual available.

17. Spring Plugin

The documentation of this plugin is still only the section Spring Plugin of the jQAssistant Manual available.

18. TestNG Plugin

The documentation of this plugin is still only the section TestNG Plugin of the jQAssistant Manual available.

19. Tycho Plugin

The documentation of this plugin is still only the section Tycho Plugin of the jQAssistant Manual available.

20. XML Plugin

The documentation of this plugin is still only the section XML Plugin of the jQAssistant Manual available.

21. YAML Plugin

The documentation of this plugin is still only the section YAML Plugin of the jQAssistant Manual available.

22. YAML II Plugin

The jQAssistant YAML 2 Plugin allows jQAssistant scan YAML documents and to build a graph model out of any valid YAML 1.2 document.

The YAML 2 Plugin is the successor of the jQAssistant YAML Plugin which suffers from a faulty graph model. As soon the YAML 2 Plugin is ready for production, it will replace the YAML Plugin.

💡
It is highly recommended to read the YAML 1.2 specification and to become more familiar with the possibilities of YAML.

Features

  • Support of YAML 1.2 specification

  • Full support for maps, scalars,and sequences

  • Support for aliases and anchors

Feature Requests and Bugs

In case of a missing feature or any kind of unexpected or faulty behaviour, please file an issue via Github.

Compatibility with the jQAssistant YAML Plugin

The graph model build by the YAML 2 Plugin is different from the one of the YAML Plugin and not compatible. Therefore, existing constraints and reports, which make use of the graph model generated by the previous plugin must be reworked.

22.1. The Model

Entity Used Combination of Labels

Alias

:Yaml:Alias

Anchor

:Yaml:Anchor

Complex Key

:Yaml:Key:Complex

Document

:Yaml:Document

File

:Yaml:File

Map

:Yaml:Map

Map value

:Yaml:Value

Sequence

:Yaml:Sequence

Simple Key

:Yaml:Key:Simple

Sequence Item

:Yaml:Item

22.2. File

A file with the the extension .yaml or .yml, which can contain multiple YAML documents.

Table 59. Used Combination of Labels

Used labels

:Yaml:File

Table 60. Relations of a YAML file
Relation Name Target Node Cardinality Description

HAS_DOCUMENT

Document

0..n

References all YAML documents contained in this file

Table 61. Properties of a YAML File
Property Name Existence Description

valid

always

Indicates whether or not the item underlying the node was successfully scanned.

In case the scanner of the YAML 2 plugin is not able to scan all documents of the YAML file, the file will be marked as not valid by setting the property valid of the node representing the YAML file to false. This is done on the file level even if only one document of many is not valid. This behavior is due to the used SnakeYAML Engine library.

22.3. Document

A single YAML document as specified in the YAML 1.2 specification. A document can contain either a scalar, a sequence or a map.

A YAML document with document prefix --- and suffix …​
---
# Comments are not handled by jQAssistant
NX-01: Jonathan Archer
NCC-1701-A: James Tiberius Kirk
NCC-1701-D: Jean-Luc Picard
...
Table 62. Used Combination of Labels

Used labels

:Yaml:Document

Table 63. Relations of :Yaml:Document
Relation Name Target Node Type Cardinality Description

HAS_SEQUENCE

Sequence

0..1

Reference to a sequence in the YAML document

HAS_MAP

Map

0..1

Reference to a map in the YAML document

HAS_SCALAR

Scalar

0..1

Reference to a scalar in the YAML document

22.4. Scalar

A scalar value as described in the YAML 1.2 specification.

Table 64. Used Combination of Labels

Used labels

:Yaml:Scalar

Table 65. Properties of :Yaml:Map
Property Name Existence Description

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

value

always

The scalar value itself

22.5. Sequence

A sequence as specified in the YAML 1.2 specification. Each item of sequence has an additional label :Item.

A Sequence with two maps as items
- Humans: Earth
- Hirogen: Delta quadrant
Table 66. Used Combination of Labels

Used labels

:Yaml:Sequence

Table 67. Relations of a Sequence
Relation Name Target Node Type Cardinality Description

HAS_ITEM

Scalar, Sequence or Map

1..n

Reference to an item in the sequence. The item can be either a scalar, a sequence or a map.

Table 68. Properties of :Yaml:Sequence
Property Name Existence Description

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

22.6. Sequence Item

Each item of a sequence is also labeled with :Item.

Table 69. Used Combination of Labels

Used labels

:Yaml:Item

Table 70. Additional Labels of an Item
Label Existence Description

:Yaml:Last

not always

The last item in a sequence in document order carries also the label :Last

:Yaml:First

not always

The first item in a sequence in document order carries also the label :First

22.7. Map

A map as specified in the YAML 1.2 specification with a set of key-value pairs. The key of a key-value pair can be either a simple key or a complex key. The value of the key-value pair can be an arbitrary YAML structure. Each value of a map has an additional Value label.

A map in a YAML document with three key-value-pairs
weight: 91
length: 103
height: 44
Table 71. Used Combination of Labels

Used labels

:Yaml:Map

Table 72. Relations of a map
Relation Name Target Node Type Cardinality Description

HAS_KEY

Simple key or complex key

1..n

Reference to key or a compley key in the map

Table 73. Properties of a Map
Property Name Existence Description

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

22.8. Simple Key

A simple key of a key-value pair in a map represented by a scalar value. Beside the simple key there is also the complex key, which can also be used as key for maps. Usage examples can be found in chapter 2.2 of the YAML specification.

A map with a simple key and a complex key in the same map
simpleKey: "Value for a simple key"
? - complex
  - key
: "Value for a complex key"
Table 74. Used Combination of Labels

Used labels

:Yaml:Key:Simple

Table 75. Relations of a simple key
Relation Name Target Node Cardinality Description

HAS_VALUE

Map, Sequence or Scalar

0..1

Reference to the value of this key-value pair

Table 76. Properties of simple key
Property Name Existence Description

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

name

always

The name of a key as scalar value

22.9. Complex Key

A complex key of a key-value pair in a map. A complex key starts with an ? and can be any valid YAML structure. Besides the complex key there is also the simple key, which is represented by a single scalar value.

A map with two complex keys
simpleKey: "Value for a simple key"
? - Vulcan
  - ShiKahr District
: Spock
? - Earth
  - North America
: James T. Kirk
Table 77. Used Combination of Labels

Used labels

:Yaml:Key:Complex

Table 78. Relations of a complex key
Relation Name Target Node Cardinality Description

HAS_VALUE

Map, Sequence or Scalar

0..1

Reference to the value of this key-value pair

22.10. Map Value

A value of a key-value pair in a map can be any valid YAML structure. The YAML 2 Plugin assigns each structure its standard labels, e.g. :Yaml:Map for a map used as value or :Yaml:Scalar to a simple scalar value like Romulan Star Empire. Any YAML structure used as value of a key-value pair is also labeled with :Value.

Table 79. Used Combination of Labels

Used labels

:Yaml:Value

22.11. Anchor

An anchor as specified in the YAML 1.2 specification, used to mark content in a YAML document for future reuse via an alias in the same document.

A Map with reused Content
"James T. Kirk" : &ufp "United Federation of Planets"
"Hikaru Kato Sulu" : *ufp
The resulting Map after processing all Anchors and Aliases
"James T. Kirk" : "United Federation of Planets"
"Hikaru Kato Sulu" : "United Federation of Planets"
Table 80. Used Combination of Labels

Used labels

:Yaml:Anchor

Table 81. Properties of an Anchor
Property Name Existence Description

anchorName

always

The name of the anchor

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

22.12. Alias

An alias as specified in the YAML 1.2 specification, used to reuse previously marked content in a document.

A Map with reused Content
"James T. Kirk" : &ufp "United Federation of Planets"
"Hikaru Kato Sulu" : *ufp
Table 82. Used Combination of Labels

Used labels

:Yaml:Alias

Table 83. Relations of an Alias
Relation Name Target Node Type Cardinality Description

IS_ALIAS_FOR

Anchor

1

Reference to the anchor of this alias in the YAML document

Table 84. Properties of an Alias
Property Name Existence Description

index

not always

Position of the element in document order in a sequence.
The index property is only a available if this element is an item in a sequence.

Appendix A: JSON Schema for rule documents

JSON Schema 1.8 for jQAssitant rule documents
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{
  "$id" : "https://jqassistant.org/schema/jqassistant-rules-v1.8.schema.json",
  "$schema" : "https://json-schema.org/draft/2019-09/schema",
  "title" : "jQAssistant Rules Version 1.8",
  "$defs" : {

    "idJSch" : { "type" : "string" },

    "referenceJSch" : {
      "type" : "object",
      "properties" : {
        "refId" : { "$ref" : "#/$defs/idJSch" },
        "optional" : { "type" : "boolean" }
      },
      "additionalProperties" : false,
      "required" : [ "refId" ]
    },

    "includedReferenceJSch" : {
      "type" : "array",
      "items" : {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "refId" : { "$ref" : "#/$defs/idJSch" },
          "severity": { "$ref": "#/$defs/severityJSch" },
          "optional" : { "type" : "boolean" }
        },
        "required": [ "refId" ]
      }
    },

    "severityJSch" : {
      "enum" : [ "blocker", "critical", "major", "minor", "info" ]
    },

    "sourceJSch" : { "type" : "string" },

    "executableRuleJSch" : {
      "type" : "array",
      "items" : {
        "type" : "object",
        "properties" : {
          "id" : { "$ref" : "#/$defs/idJSch" },
          "deprecated" : { "type" : "string" },
          "description" : { "type" : "string" },
          "report" : {
            "anyOf" : [
              { "$ref" : "#/$defs/reportJScn" },
              { "type" : "null" }
            ]
          },
          "requiresConcepts" : {
            "type" : "array",
            "minItems" : 0,
            "items" : { "$ref" : "#/$defs/referenceJSch" }
          },
          "requiresParameters" : {
            "anyOf": [
              {
                "type": "array",
                "minItems": 0,
                "items": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "defaultValue": { "type": "string" },
                    "type": {
                      "enum": [
                        "boolean", "byte", "char", "double", "float",
                        "int", "long", "short", "String"
                      ]
                    },
                    "required": [ "name", "type" ]
                  },
                  "additionalProperties": false
                }
              },
              { "type": "null" }
            ]
          },
          "severity" : { "$ref" : "#/$defs/severityJSch" },
          "language" : { "type" : "string" },
          "source" : { "$ref" : "#/$defs/sourceJSch" },
          "verify" : {
            "type" : "object",
            "properties" : {
              "rowCount" : {
                "type" : "object",
                "properties" : {
                  "min" : {
                    "type" : "integer",
                    "minimum" : 0
                  },
                  "max" : {
                    "type" : "integer",
                    "minimum" : 0
                  }
                },
                "anyOf": [
                  { "required": [ "min" ] },
                  { "required": [ "max" ] },
                  { "required": [ "max", "min" ] }
                ],
                "additionalProperties" : false
              },
              "aggregation" : {
                "type" : "object",
                "properties" : {
                  "max": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "min": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "column": { "type": "string" }
                },
                "anyOf": [
                  { "required": ["column", "min", "max"] },
                  { "required": ["column", "min" ] },
                  { "required": ["column", "max" ] }
                ],
                "additionalProperties" : false
              }
            },
            "oneOf": [
              { "required": [ "aggregation" ] },
              { "required": [ "rowCount" ] }
            ],

            "additionalProperties" : false
          }
        },
        "required" : [ "id", "source" ],
        "additionalProperties" : false
      },
      "additionalProperties" : false
    },
    "reportJScn" : {
      "type" : "object",
      "properties" : {
        "primaryColumn" : {
          "type" : "string"
        },
        "properties" : {
          "type" : "object",
          "patternProperties" : {
            "^.+$" : {
              "anyOf" : [
                { "type" : "integer" },
                { "type" : "number" },
                { "type" : "boolean" },
                { "type" : "string" }
              ],
              "additionalProperties" : false
            }
          },
          "additionalProperties" : false
        },
        "type" : { "type" : "string" }
      },
      "required": [ "primaryColumn", "type" ],
      "additionalProperties" : false
    }
  },
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "concepts": {
          "anyOf": [
            { "$ref": "#/$defs/executableRuleJSch" },
            { "type": "null" }
          ]
        },
        "constraints": {
          "anyOf": [
            { "$ref": "#/$defs/executableRuleJSch" },
            { "type": "null" }
          ]
        },
        "groups": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": { "$ref": "#/$defs/idJSch" },
                  "severity": { "$ref": "#/$defs/severityJSch" },
                  "includedConcepts": {
                    "anyOf": [
                      { "$ref": "#/$defs/includedReferenceJSch" },
                      { "type": "null" }
                    ]
                  },
                  "includedConstraints": {
                    "anyOf": [
                      { "$ref": "#/$defs/includedReferenceJSch" },
                      { "type": "null" }
                    ]
                  },
                  "includedGroups": {
                    "anyOf": [
                      { "$ref": "#/$defs/includedReferenceJSch" },
                      { "type": "null" }
                    ]
                  }
                },
                "additionalProperties": false,
                "required": [ "id" ]
              }
            },
            { "type": "null" }
          ]
        }
      },
      "additionalProperties": false
    },
    { "type": "null" }
  ]
}