Download OpenAPI specification:
Read-only Cypher queries over the instance data of a knowledge network. A query is compiled into a single SQL statement and executed through vega-backend, so the subset accepted here is what compiles that way: one MATCH over a single path, a WHERE over properties, and a projection of properties and aggregates of them. Everything else is refused by name rather than approximated. Paging is written in the query itself with SKIP and LIMIT; there is no paging parameter. Exposed under /api/bkn-backend/v1 (OAuth2) and /api/ontology-manager/v1 (alias), with the branch query parameter defaulting to main.
Compiles a Cypher query against the knowledge network's model and returns the rows it
produces. Requires application/json content type and the query_data operation on each
object type and relation type the query names; a network-wide query_data grant covers
them, since the child operation inherits from its parent network. Every property the
query names -- in RETURN, WHERE, ORDER BY, an aggregate or an inline property map --
must have the effective property access level full for the caller. A property at
level none does not exist for the caller: naming it is a 400
BknBackend.Cypher.InvalidQuery "unknown property", exactly as for a property outside
the model, and it is never offered as a suggestion. A Column Masking (masked) or schema-only property is
refused with 403 BknBackend.Cypher.PropertyForbidden naming it as
object_type_id.property. Join keys that a relation type maps are not checked unless
the query names them. Column Masking is not applied to Cypher results.
The caller needs no grant on the vega resources behind those object types. The compiled statement runs through vega-backend's raw query under the caller's own identity first, and vega-backend checks view_detail on each resource, as before; a caller holding those grants is answered that way. Only when vega-backend refuses that run with 403, on the main branch and when every object type and relation type binding the query reads through is a current published binding, is the same statement run again under the knowledge network's managed proxy account, which vega-backend checks for view_detail on each resource. The statement is generated from the model, so it references only the resources of those bindings. When the network has no usable proxy (no mapping, not active, not synchronized with the published model, or a binding not published), on other branches, or when the proxy account is refused too, the refusal is returned as 403 BknBackend.Cypher.Forbidden. Other failures are not retried.
A concept the caller may not query is absent from the model the query is compiled against, so naming it reads as an unknown label rather than as a refusal: this endpoint cannot be used to find out what a model contains. A caller who may read nothing in the network gets 403.
Labels and relationship types accept either the id or the name of the object type or relation type. Properties are addressed by property name; display names and logic properties are not accepted. A query that does not write its own LIMIT is capped at 1000 rows, and a LIMIT above 10000 is refused rather than silently reduced.
The generated SQL is not returned: it names physical tables and columns, which the caller is not entitled to just because they may read the data.
| kn_id required | string Business knowledge network ID |
| branch | string Default: "main" Branch name. Defaults to main. |
object Values for the $name references in the query. A parameter is a value and never an identifier: it can change which rows come back, never which resource or column is read. Strings, numbers and booleans are accepted; a null is refused, because IS NULL says that and a comparison against null never matches. A parameter used as IN $name takes a non-empty array of scalars of one kind (integers and floats both count as numbers), with no null and at most 500 elements. Several long lists in one query can still be refused with 400 as too large; split them across queries. | |
| query required | string <= 8192 characters The Cypher query. Supported shape:
MATCH (a:Label [{property: value, ...}]) [-[:RELATION]-(b:Label) ...]
[WHERE A condition compares a property with =, <>, <, >, <= or >= against a literal or a parameter, or tests it with IN [ ... ], IN $list (the whole list as one parameter), IS NULL or IS NOT NULL. A string property can also be matched with STARTS WITH, ENDS WITH or CONTAINS against a string literal or parameter: the match is a literal substring match (% and _ are not wildcards), a null property never matches, case sensitivity follows the column collation, and using them on a non-string property is refused with 400. Conditions combine with AND, OR and NOT, and parentheses group them. XOR is not supported. Aggregates are count, sum, avg, min and max, each also in its DISTINCT form, plus count(*). Cypher has no GROUP BY: aggregating anything groups by everything else the query returns. A grouped or DISTINCT result can only be sorted by a value it returns. A MATCH may contain several comma-separated paths, and a query may contain several MATCH clauses; both mean one shape. A variable written twice is the node it named the first time, which is how two paths meet, and paths that share no variable are a cartesian product. The first mention of a node names its object type; a later one may omit the label but must not contradict it. A path may contain several relationships. Each names exactly one relation type and may be written -[:R]->, <-[:R]- or undirected as -[:R]-; each node names exactly one object type and may carry an inline property map, which means the equalities it stands for. Cypher forbids one MATCH from traversing the same relationship twice, and that
is enforced: within one MATCH, every pair of hops over one relation type must
differ in its source row or its target row, which needs those object types to
have a primary key. Where one of the hops is undirected the requirement cannot
be stated, and the query is refused rather than answered with paths Cypher would
not return. Hops in different MATCH clauses are not compared: writing
|
{- "parameters": {
- "region": "eu",
- "floor": 100
}, - "query": "MATCH (o:order)-[:rel_order_item_order]->(i:order_item) WHERE o.status IN ['paid', 'shipped'] AND o.amount > $floor RETURN o.status AS status, count(*) AS orders ORDER BY orders DESC LIMIT 20"
}{- "columns": [
- {
- "name": "string",
- "type": "string"
}
], - "entries": [
- { }
]
}