From 39cf4c7d192cddd012afe7060f4b45504ec917a6 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Mon, 6 Feb 2023 15:51:49 +0100
Subject: [PATCH] DOC: Nested queries are possible already.

---
 CHANGELOG.md                     |  2 ++
 src/doc/CaosDB-Query-Language.md | 20 +++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d8101a54..8942e49f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Documentation ###
 
+- Nested queries.
+
 ## [0.9.0] - 2023-01-19
 
 ### Added
diff --git a/src/doc/CaosDB-Query-Language.md b/src/doc/CaosDB-Query-Language.md
index 0e05a56b..182e0767 100644
--- a/src/doc/CaosDB-Query-Language.md
+++ b/src/doc/CaosDB-Query-Language.md
@@ -310,6 +310,13 @@ One may omit the property specification:
 * `FIND ename1 WITH @ ename2`
 * `FIND ename1 . @ ename2`
 
+### Nested queries, or filtering by sub-properties ###
+
+Nested queries can easily be searched by simply concatenating `WHICH` or `WITH` expressions:
+
+* `FIND ename WHICH HAS A pname WHICH HAS A subpname=val`
+* For example: `FIND AN experiment WHICH HAS A camera WHICH HAS A 'serial number'= 1234567890`
+
 ### Combining Filters with Propositional Logic
 
 Any result set can be filtered by logically combining POV filters or back reference filters:
@@ -391,14 +398,13 @@ Since Caosdb 0.2 entities are optionally version controlled. The query language
 * The `ANY VERSION OF` modifier currently the only expression for taking the versioning into account when using the query language.
 * Subproperties are not supported yet, e.g. `FIND ANY VERSION OF ENTITY WHICH IS REFERENCED BY ename WITH ...`. This applies to all cases where you specify properties of *referenced* entities or *referencing* entities.
 
-### Future
-
-* Add `(LATEST|LAST|OLDEST|NEWEST|FIRST) VERSION OF` modifiers.
-* Add `(ANY|LATEST|LAST|OLDEST|NEWEST|FIRST) VERSION (BEFORE|AFTER) (<timestamp>|<transaction id>|<entity@version>) OF` modifier.
-* Add support for subproperties, e.g. `FIND ANY VERSION OF ENTITY WHICH IS REFERENCED BY ename WITH ...`.
-
 ## Future
 
- * *Sub Queries* (or *Sub Properties*): `FIND ename WHICH HAS A pname WHICH HAS A subpname=val`. This is like: `FIND AN experiment WHICH HAS A camera WHICH HAS A 'serial number'= 1234567890`
+* Additional versioning queries:
+  * Add `(LATEST|LAST|OLDEST|NEWEST|FIRST) VERSION OF` modifiers.
+  * Add `(ANY|LATEST|LAST|OLDEST|NEWEST|FIRST) VERSION (BEFORE|AFTER) (<timestamp>|<transaction
+    id>|<entity@version>) OF` modifier.
+  * Add support for subproperties, e.g. `FIND ANY VERSION OF ENTITY WHICH IS REFERENCED BY ename
+    WITH ...`.
  * *More Logic*, especially `ANY`, `ALL`, `NONE`, and `SUCH THAT` key words (and equivalents) for logical quantisation: `FIND ename1 SUCH THAT ALL ename2 WHICH HAVE A REFERENCE TO ename1 HAVE A pname=val`. This is like `FIND experiment SUCH THAT ALL person WHICH ARE REFERENCED BY THIS experiment AS conductor HAVE AN 'academic title'=professor.`
  
-- 
GitLab