<commit_before>deep-query : tools to query json/object structures. 
==========================

[Back to tutorials](./tutorials.md)

A other proposal for (json/object)-query which (as differences from official proposal):
use simple slash delimitted syntax, 
could handle regular expression for step selection, 
could handle rql (for filtering) on each step selection,
could be relative to where the query are placed in a object/json
so could handle steps toward any ancestor
could handle json-schema in rql filtering
could handle ancestor in rql filtering


## Queries examples:  the result is always the result of the last step.

/foo/bar/

From root : Select from root the property foo then give me the property bar in it


../foo/bar?zoo.name//price?=in=(12,55)

From ME (somewhere in a json/object) : Give me in my parent the property named foo
On this, give me 'bar' which has a property 'zoo' which has a property 'name'
On this give me any price (at any sublevel) equal to 12 or 55


//(p.+)gi/../../foo//bar?=3

From root : Give me recursively any property which its name correspond to (p.+)gi.
on this, take the parent of its parent (if any).
on this : take 'foo'.
on this : recursively take any property named bar and equal to 3


/?foo=2&bar/(myArray.*)?length=gt=10/[1:4:2,@.length-2]//(^p.*)g?=in=(hello,bye)&_parent.taxerate=lt=0.12&_schema.type=string

From root : Give me any property. 
On this : give me those which have a property named foo and equal to 2 AND has a property named bar (different of undefined, null, false, or 0).
On this : select any property named myArray.* (RegExp) where length > 10.
On this : give me property (if any) named 1 or 3 or an index equal to parent.length-2 (parent is myAtrray.*).
On this : Recursively give me any property where its name correspond to (^p.*)g AND where its value is either 'hello' or 'bye'
	AND its parent has a property taxerate less than 0,12
	AND its type is 'string'


## Syntaxe

A query consist of succession of steps.

A step is : 
move selector ? rql


### Start (first move)

/	start from root
./	start from me (from somewhere in a json/object)
../ start from my parent (from somewhere in a json/object)
// 	start from root and give me any properties at any sub level

### Moves

/ 		current level
//		recursively seek any property from current level
../		take my parent level (you could select any of its properties from there)
../!	take my parent reference (you need to add '/' (e.g. ../!/) to select any of its properties as above))<commit_msg>Update deep-queries.md<commit_after>deep-query : tools to query json/object structures. 
==========================

[Back to tutorials](./tutorials.md)

A other proposal for (json/object)-query which (as differences from official proposal):
use simple slash delimitted syntax, 
could handle regular expression for step selection, 
could handle rql (for filtering) on each step selection,
could be relative to where the query are placed in a object/json
so could handle steps toward any ancestor
could handle json-schema in rql filtering
could handle ancestor in rql filtering


## Queries examples:  the result is always the result of the last step.

/foo/bar/

From root : Select from root the property foo then give me the property bar in it



../foo/bar?zoo.name//price?=in=(12,55)

From ME (somewhere in a json/object) : Give me in my parent the property named foo
On this, give me 'bar' which has a property 'zoo' which has a property 'name'
On this give me any price (at any sublevel) equal to 12 or 55



//(p.+)gi/../../foo//bar?=3

From root : Give me recursively any property which its name correspond to (p.+)gi.
on this, take the parent of its parent (if any).
on this : take 'foo'.
on this : recursively take any property named bar and equal to 3



/?foo=2&bar/(myArray.*)?length=gt=10/[1:4:2,@.length-2]//(^p.*)g?=in=(hello,bye)&_parent.taxerate=lt=0.12&_schema.type=string

From root : Give me any property. 
On this : give me those which have a property named foo and equal to 2 AND has a property named bar (different of undefined, null, false, or 0).
On this : select any property named myArray.* (RegExp) where length > 10.
On this : give me property (if any) named 1 or 3 or an index equal to parent.length-2 (parent is myAtrray.*).
On this : Recursively give me any property where its name correspond to (^p.*)g AND where its value is either 'hello' or 'bye'
	AND its parent has a property taxerate less than 0,12
	AND its type is 'string'



## Syntaxe

A query consist of succession of steps.

A step is : 
move selector ? rql


### Start (first move)

/	start from root
./	start from me (from somewhere in a json/object)
../ start from my parent (from somewhere in a json/object)
// 	start from root and give me any properties at any sub level

### Moves

/ 		current level
//		recursively seek any property from current level
../		take my parent level (you could select any of its properties from there)
../!	take my parent reference (you need to add '/' (e.g. ../!/) to select any of its properties as above))
{'fraction_non_alphanumeric': 0.10152083744815327, 'fraction_numerical': 0.011850681414181316, 'mean_word_length': 3.75046904315197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '877073', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1458, 'n_words': 756}