Skip to content
Configurable Query Language
Branch: master
Clone or download
Pull request Compare This branch is 8 commits behind Lotes:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
CQL.Demo finishing code documentation of CQL Mar 13, 2018
CQL.WPF finishing code documentation of CQL Mar 13, 2018
CQL add auto-generated docs Mar 13, 2018
docs Rename to Mar 13, 2018
packaging Create Mar 17, 2018
.gitattributes initial commit May 5, 2017
.gitignore update nuget specs Mar 10, 2018 Create Mar 17, 2018
CQL.sln add auto-generated docs Mar 13, 2018 update documentation Feb 10, 2018 Update Mar 10, 2018 update documentation Mar 10, 2018 add auto-generated docs Mar 13, 2018
example.png add picture to Feb 10, 2018
icon.png add further flags for detailed configuration Mar 4, 2018
icon.svg add further flags for detailed configuration Mar 4, 2018
mkdocs.yml Update and rename docs/mkdocs.yml to mkdocs.yml Mar 13, 2018
xmldoc2md.ps1 add auto-generated docs Mar 13, 2018
xmldoc2md.xsl add auto-generated docs Mar 13, 2018

Configurable Query Language (CQL)


What is the problem?

The raison d'être for this project is the typical filter problem: On one side, your product delivers a dataset of complex types. On the other side the user wants to easily query certain rows in the dataset. But you also want to empower him to address complex properties.

Here is a solution!

The two components, provided here, are

  • a query language, that can be configured from a high-level point of view (like "my data has a field 'Name' of type 'String'") or/and from a low-level point of view (like "Use '+' to concat strings.")
  • a WPF user control (using the language) with auto-completion and tooltips for syntactical and semantical errors. The query can be typed in using the keyboard OR by clicking all ingredients together.


First, installation

PM> Install-Package CQL

Second, let me shortly explain the concepts. You actually need to provide three objects:

  • the query, which can be edited by the user
  • the context, which contains all variables, that are accessible for the query
  • the type system, which setups the way the variables can be queried or can be combined

Third, study the following code snippet:

[CQLType("Ticket", "Object of interest.")]
public class Ticket
	public Ticket(int id, string owner)
		this.Id = id;
		this.Owner = owner;

	[CQLNativeMemberProperty("Id", IdDelimiter.Dot)]
	public int Id { get; set; }

	[CQLNativeMemberProperty("Owner", IdDelimiter.Dot)]
	public string Owner { get; set; }
var typeSystemBuilder = new TypeSystemBuilder();
var typeSystem = typeSystemBuilder.Build();

var ticket1 = new Ticket() { Id = 123, Owner = "Me" };
var ticket2 = new Ticket() { Id = 124, Owner = "Myself" };
var ticket3 = new Ticket() { Id = 125, Owner = "I" };

var context = new EvaluationScope(typeSystem);
Assert.IsFalse(Queries.Evaluate("id > 123", ticket1, context));
Assert.IsFalse(Queries.Evaluate("id > 123 AND Owner = \"I\"", ticket2, context));
Assert.IsTrue(Queries.Evaluate("ID > 123 AND oWnEr = \"I\"", ticket3, context));

Current features

  • configurable type system
  • configurable context
  • configurable WPF component (in progress!!!)
    • beginner mode
    • expert mode
    • auto completion
    • syntax highlighting
You can’t perform that action at this time.