0.0.3-next.12 • Published 3 years ago

navqlc v0.0.3-next.12

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

NavQL compiler

Define sources and link its. NavQL are not doing magic - it is making life easier. It provides simple methods and constructions for everyday tasks: describing static data-set, extracting dynamic data from storages, creating actions for client-applications.

// Static data
export items = static [
    { a: 40 + 2, b: "Hello, world!" },
    { b: $param.sSet1, c: toParam(1, 2, 3) },
    { xActions: client {
        preset $param.sSet1 = "fact";
        $param.sSet2 = 123;
        
        openScreen(200);
        alert("Welcome", AlertType.Success);
        showPopup(1337);
    } }
]

// Data from storage
dynamicData = pipe graph {
    filter id == 100500;
    map { city: _1 };
    uniq;
    map { sName: city, sValue: city };
}

Language constructions

Entry point

By default NavQL uses only one single expression, but if you are describing multiple source definition, entry point will be recognized next way: first exported expressing or the first expression ever.

You can exports something by name, or something without name, as anonymous expression. For making an expressing as entry point use export keyword. Take a look at examples:

// single-expression
static [{ n: 42 }]
// anonymous export
export static [{ s: "Hello, world" }]
// export by reference
value = static [{ x: 1 }]
export value
// named-export
export items = static [{i: 1}, {i: 2}]

Static set

If you need static data-set, use static statement. It is array of objects with custom properties. Yes, objects can contains different properties, you will get matrix of them all.

static [
    { a: 1, b: 2},
    { c: 3, d: 4},
]

// a, b, c, d  #  Properties
// 1, 2, -, -  #  First object
// -, -, 3, 4  #  Second object

But in common case this is not an important feature! Just look at it as an array of any objects.

Extracting data from source

Do not think about type of storage of local data-set, all of them is a source! If you have a source, you can extract data from it.

For a data extracting use pipe statement. Pipe is pipeline of data extracting operations like filter, map, uniq, order, group, with etc. Each next operator get data from previous operator, transform and take it to the next operator.

mySource = static [{n: 1}, {n: 2}, {n: 3, trash: "Hello"}]

export pipe mySource {
    map { x: n }; // Transform to new objects.
    filter x > 1; // Filter items by condition.
    uniq; // Skip duplicates.
    // Final transformation.
    map {
        sName: x,
        sValue: x + 10,
    };
}
  • filter expression - filter items by condition.
  • map mapping-object - transform to new objects.
  • uniq - skip duplicates.

Not supported yet:

  • order field - asc-direction sorting.
  • reverse field - desc-direction sorting.
  • group array-of-fields to mapping-object - aggregating transformation.
  • with source by a-b-expression to mapping-object - co-variations of data-sets.

Client operations

To creating interactive data-set you should define client behavior. NavQL provide the simple tool for that: client statement. This statement returns client-actions-expression data.

static [
    {
        sName: "Click me!",
        xAction: client {
            preset $param.dtDate = "2020-01-01";
            $param.sSet1 = "Russia";
            showPopup(10200);
        }.
    }.
]
  • preset param = value - set parameter without screen updating.
  • param = value - set parameter and update screen immediately.
  • alert(text, type) - show message bottom of screen.
  • showPopup(widget-id) - show widget top-most or as panel.
  • openScreen(screen-id) - redirect to other screen with all parameters.

Internal data storages

NavQL created for NavPlatform and provide secure access to internal data-bases.

NEW_PUB_NAV_GRAPH

Source alias is graph. Access to the storage managing by RM/RME and dependent by **nUserID system parameter. Contains next properties:

  • id - indicator identifier.
  • time - date and time of measurement.
  • value - numeral value.
  • _1-_20 - string data-axises.

To do

  • names and types control layer

pipe

  • order - asc order
  • reverse - desc order
  • with - like SQL join
  • group - aggregation functions
0.0.3-next.11

3 years ago

0.0.3-next.12

3 years ago

0.0.3-next.10

3 years ago

0.0.3-next.9

3 years ago

0.0.3-next.8

3 years ago

0.0.3-next.7

3 years ago

0.0.3-next.6

3 years ago

0.0.3-next.5

3 years ago

0.0.3-next.4

3 years ago

0.0.3-next.3

3 years ago

0.0.3-next.2

3 years ago

0.0.3-next.1

3 years ago

0.0.3-next

3 years ago