Custom Query Languages:
Why? How?
@AnjanaVakil - J on the Beach 2017
HOLA!
I’m @AnjanaVakil
Software Engineer/DSL-builder, ÜberResearch
with input from Tobias Johansson
Technical Lead, Valo
DIMENSIONS
uberresearch.com/dimensions
Scientific research funding data
for funders, researchers, and
research organizations.
VALO
valo.io
Real-time and historical
analytics on data streams.
Plus beachy conferences.
WHAT
is a Custom Query Language (CQL) ?
CUSTOM QUERY LANGUAGE (CQL)
domain-
specific
CUSTOM QUERY LANGUAGE (CQL)
data retrieval
& analysis
CUSTOM QUERY LANGUAGE (CQL)
text-based
interface
“a common text that acts as both
executable software and a description
that domain experts can read
Martin Fowler, Domain Specific Languages
search grants
for "malaria"
where funder.acronym="NIH"
return categories, years,
researchers:[surname]
aggregate funding
sort by funding
DIMENSIONS
query language
VALO
query language
from /streams/sensors/air
group by sampleTime
window of 1 minute
select sampleTime, sensor,
avg(pollution)
WHY
would you want your own CQL ?
MODELING
VALO
modeling time
from historical
/streams/tenant/collection/name
group by timestamp window of 3
seconds every 1 second
select timestamp, count(),
sum(value)
order by timestamp
Display from Model
DECOUPLING
Model from Storage
DIMENSIONS
decoupling
SOLR
DIMENSIONS
decoupling
SOLR
DIMENSIONS
decoupling
SOLR
</>
Elastic
?
“Trying to describe a domain using a
DSL is useful even if the DSL is never
implemented. It can be beneficial just
as a platform for communication.
Martin Fowler, Domain Specific Languages
HOW
should you design a CQL ?
1. Clarity
2. Concision
3. Familiarity
4. Responsiveness
WHAT MAKES A GREAT USER INTERFACE?
5. Consistency
6. Aesthetics
7. Efficiency
8. Forgiveness
https://www.smashingmagazine.com/user-interface-design-in-modern-web-applications
1.
2. Concision
3. Familiarity
4.
the user can easily express what they want
5.
6. Aesthetics
7. Efficiency
8.
VALO
historical
data
from historical
/streams/sensors/air
group by sampleTime
window of 1 minute
select sampleTime, sensor,
avg(pollution)
1. Clarity
2.
3. Familiarity
4. Responsiveness
the user doesn’t often need the docs
5. Consistency
6.
7.
8. Forgiveness
not
Unknown source 'articles'
Did you mean one of these
sources?
applications
clinical_trials
grants
patents
publications
DIMENSIONS
error messages
it will change
but no matter how good your design
Get user feedback ASAP
expect & embrace change (as usual)
Design for flexibility
HOW
can you implement a CQL ?
PARSING YOUR CQL
Terrence Parr, The Definitive ANTLR4 Reference
Use a parser generator
Prototype quickly, giving up
control over some details of
lexing/parsing.
e.g. ANTLR, parboiled2
PARSING YOUR CQL
Roll your own
Retain full control over
lexing/parsing and internal
syntactic representation.
Use a parser generator
Prototype quickly, giving up
control over some details of
lexing/parsing.
e.g. ANTLR, parboiled2
PARSING YOUR CQL
Roll your own
Retain full control over
lexing/parsing and internal
syntactic representation.
ANTLR (v4)
antlr.org
Java-based parser generator
with targets for various other
languages (e.g. Python, JS, …)
THE ANTLR4 FLOW
grammar
lexer
parser
AST listener
grammar Query;
query: target results EOF;
target:
'search' name filter?;
results: ('return' name)+;
name: [a-z]+;ANTLR4
GRAMMAR
# Generated by ANTLR 4.5
from antlr4 import *
class QueryListener:
def enterTarget(self, ctx):
pass
def exitTarget(self, ctx):
pass
ANTLR4
LISTENER
Let’s
RECAP !
CUSTOM QUERY LANGUAGES
WHY bother
An executable model
of your domain/logic.
Decoupling display,
model, and storage.
HOW to design
Language as interface.
Expect & embrace
change.
HOW to implement
Parser generators can
speed up prototyping,
at the cost of some
control.
GRACIAS!I’m @AnjanaVakil
anjana@uberresearch.com
Huge thanks to Tobias Johansson & Valo!
Presentation template by SlidesCarnival

More Related Content

PPTX
Demystifying Robotic Process Automation (RPA) & Automation Testing
PPT
The 10 most interesting slides that helped our SaaS company raise 9 million
PPTX
An introduction to fundamental architecture concepts
PDF
Exquisite Software Development, LLC - 2015 Brochure
PPTX
Velocis Presentations
PDF
Observability at Scale
PDF
[Pcamp19] - Escalando o uso de dados no Nubank - André Tavares | Nubank
PPTX
Data Ops at TripActions
Demystifying Robotic Process Automation (RPA) & Automation Testing
The 10 most interesting slides that helped our SaaS company raise 9 million
An introduction to fundamental architecture concepts
Exquisite Software Development, LLC - 2015 Brochure
Velocis Presentations
Observability at Scale
[Pcamp19] - Escalando o uso de dados no Nubank - André Tavares | Nubank
Data Ops at TripActions

What's hot (20)

PDF
Data Science em uma instituição financeira moderna
PDF
Fivetran
PDF
Observability & Datadog
PDF
Event Driven Architecture
PPTX
What is Platform Observability? An Overview
PPTX
Application Rationalization with LeanIX
PPTX
あじゃいる時代の品質保証 ~DevSQAの提案~
PPTX
Implementing Effective Enterprise Architecture
PDF
Swipes pitch deck for Beta Pitch 2013 Finals in Berlin
PPTX
Agile, TOGAF and Enterprise Architecture: Will They Blend?
PDF
The how and why of patch management by N-able
PPTX
Low code platform and Outsystems
PPTX
Enterprise Integration Patterns
PPTX
Rapid Data Analytics @ Netflix
KEY
Event Driven Architecture
PDF
TechCrunch Pitch Deck Teardown 83 - $30M - Series A - Xyte
PDF
presentation.pdf
PDF
Apply MLOps at Scale
PDF
Building Data Quality Audit Framework using Delta Lake at Cerner
PDF
シナリオテストについて考えてみる
Data Science em uma instituição financeira moderna
Fivetran
Observability & Datadog
Event Driven Architecture
What is Platform Observability? An Overview
Application Rationalization with LeanIX
あじゃいる時代の品質保証 ~DevSQAの提案~
Implementing Effective Enterprise Architecture
Swipes pitch deck for Beta Pitch 2013 Finals in Berlin
Agile, TOGAF and Enterprise Architecture: Will They Blend?
The how and why of patch management by N-able
Low code platform and Outsystems
Enterprise Integration Patterns
Rapid Data Analytics @ Netflix
Event Driven Architecture
TechCrunch Pitch Deck Teardown 83 - $30M - Series A - Xyte
presentation.pdf
Apply MLOps at Scale
Building Data Quality Audit Framework using Delta Lake at Cerner
シナリオテストについて考えてみる
Ad

Similar to Custom Query Languages: Why? How? (20)

PPTX
Antconc
PDF
Compiler Construction | Lecture 6 | Introduction to Static Analysis
PDF
Apache Spark NLP: Extending Spark ML to Deliver Fast, Scalable & Unified Nat...
PPTX
Ant conc notes
PDF
How the Lucene More Like This Works
PDF
Natural Language Search in Solr
PDF
DataFest 2017. Introduction to Natural Language Processing by Rudolf Eremyan
PPT
ApacheCon NA 2011 report
PPTX
Wreck a nice beach: adventures in speech recognition
PPTX
dlux splunk>live! 2012 Beginners Session
PPT
lect36-tasks.ppt
PPT
NLP Tasks and Applications.ppt useful in
PDF
Elasticsearch Basics
PPTX
Skbp 1023 introduction to antconc
DOC
Maintenance of Dynamically vs. Statically typed Languages
PDF
Jasper report dependencies [santi caltabiano]
PPT
Lucene Bootcamp -1
PPT
Natural Language Processing & Semantic Models in an Imperfect World
ODP
Using ANTLR on real example - convert "string combined" queries into paramete...
PDF
Generative programming (mostly parser generation)
Antconc
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Apache Spark NLP: Extending Spark ML to Deliver Fast, Scalable & Unified Nat...
Ant conc notes
How the Lucene More Like This Works
Natural Language Search in Solr
DataFest 2017. Introduction to Natural Language Processing by Rudolf Eremyan
ApacheCon NA 2011 report
Wreck a nice beach: adventures in speech recognition
dlux splunk>live! 2012 Beginners Session
lect36-tasks.ppt
NLP Tasks and Applications.ppt useful in
Elasticsearch Basics
Skbp 1023 introduction to antconc
Maintenance of Dynamically vs. Statically typed Languages
Jasper report dependencies [santi caltabiano]
Lucene Bootcamp -1
Natural Language Processing & Semantic Models in an Imperfect World
Using ANTLR on real example - convert "string combined" queries into paramete...
Generative programming (mostly parser generation)
Ad

More from J On The Beach (20)

PDF
Massively scalable ETL in real world applications: the hard way
PPTX
Big Data On Data You Don’t Have
PPTX
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
PDF
Pushing it to the edge in IoT
PDF
Drinking from the firehose, with virtual streams and virtual actors
PDF
How do we deploy? From Punched cards to Immutable server pattern
PDF
Java, Turbocharged
PDF
When Cloud Native meets the Financial Sector
PDF
The big data Universe. Literally.
PDF
Streaming to a New Jakarta EE
PDF
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
PDF
Pushing AI to the Client with WebAssembly and Blazor
PDF
Axon Server went RAFTing
PDF
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
PDF
Madaari : Ordering For The Monkeys
PDF
Servers are doomed to fail
PDF
Interaction Protocols: It's all about good manners
PDF
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
PDF
Leadership at every level
PDF
Machine Learning: The Bare Math Behind Libraries
Massively scalable ETL in real world applications: the hard way
Big Data On Data You Don’t Have
Acoustic Time Series in Industry 4.0: Improved Reliability and Cyber-Security...
Pushing it to the edge in IoT
Drinking from the firehose, with virtual streams and virtual actors
How do we deploy? From Punched cards to Immutable server pattern
Java, Turbocharged
When Cloud Native meets the Financial Sector
The big data Universe. Literally.
Streaming to a New Jakarta EE
The TIPPSS Imperative for IoT - Ensuring Trust, Identity, Privacy, Protection...
Pushing AI to the Client with WebAssembly and Blazor
Axon Server went RAFTing
The Six Pitfalls of building a Microservices Architecture (and how to avoid t...
Madaari : Ordering For The Monkeys
Servers are doomed to fail
Interaction Protocols: It's all about good manners
A race of two compilers: GraalVM JIT versus HotSpot JIT C2. Which one offers ...
Leadership at every level
Machine Learning: The Bare Math Behind Libraries

Recently uploaded (20)

PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Five Habits of High-Impact Board Members
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
Modernising the Digital Integration Hub
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
A review of recent deep learning applications in wood surface defect identifi...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
CloudStack 4.21: First Look Webinar slides
Taming the Chaos: How to Turn Unstructured Data into Decisions
Benefits of Physical activity for teenagers.pptx
sustainability-14-14877-v2.pddhzftheheeeee
Five Habits of High-Impact Board Members
Group 1 Presentation -Planning and Decision Making .pptx
Tartificialntelligence_presentation.pptx
Final SEM Unit 1 for mit wpu at pune .pptx
WOOl fibre morphology and structure.pdf for textiles
observCloud-Native Containerability and monitoring.pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Getting Started with Data Integration: FME Form 101
1 - Historical Antecedents, Social Consideration.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Modernising the Digital Integration Hub
Web Crawler for Trend Tracking Gen Z Insights.pptx
A review of recent deep learning applications in wood surface defect identifi...

Custom Query Languages: Why? How?