-
Notifications
You must be signed in to change notification settings - Fork 22
HTTP API
Tomas Machalek edited this page Dec 10, 2021
·
26 revisions
While it is possible to use both simple and advanced query types it is strongly advised to use the advanced variant when dealing with the API as the query encoding is much easier in such case.
- URL:
/query_submit?format=json
- HTTP Method:
POST
- content type:
application/json
Request body:
{
"type": "concQueryArgs",
"maincorp": "syn2020",
"usesubcorp": null,
"viewmode": "kwic",
"pagesize": 40,
"attrs": ["word","tag"],
"attr_vmode": "visible-kwic",
"base_viewattr": "word",
"ctxattrs": [],
"structs": ["text","p","g"],
"refs": [],
"fromp": 0,
"shuffle": 0,
"queries": [
{
"qtype": "advanced",
"corpname": "syn2020",
"query": "[word=\"celou\"] [lemma=\"pravda\"]",
"pcq_pos_neg": "pos",
"include_empty": false,
"default_attr":"word"
}
],
"text_types": {},
"context":
{
"fc_lemword_wsize": [-5, 5],
"fc_lemword": "",
"fc_lemword_type": "all",
"fc_pos_wsize": [-5, 5],
"fc_pos": [],
"fc_pos_type": "all"
},
"async": false
}
name | description |
---|---|
type | this is always a constant concQueryArgs
|
usesubcorp |
null or name of user's subcorpus |
viewmode | `kwic |
pagesize | a positive number specifying size of the resulting page |
attrs | a list of positional attributes we want to retrieve |
attr_vmode | `visible-all |
base_viewattr | the main attribute the flow of text will be based on |
ctxattrs | TODO |
structs | a list (possibly empty) of structural attributes to be shown |
refs | a list (possibly empty) of additional metadata attached to each row |
fromp | a number specifying a starting page |
shuffle | `0 |
queries | a list of objects, each for active corpus (normally 1 item, for aligned corpora > 1) |
queries[].qtype | advanced |
queries[].corpname | "syn2020", |
queries[].query | A CQL query (e.g. [word=\"their\"] [lemma=\"truth\"] ) |
queries[].pcq_pos_neg | applies for aligned corpora queries |
queries[].include_empty | `true |
queries[].default_attr | a positional attribute applied for simplied CQL expressions |
Response:
- HTTP status:
201 Created
(if without errors) - content type:
application/json
{
"size": 110,
"finished": true,
"conc_args": {
"maincorp": "syn2020",
"viewmode": "kwic",
"pagesize": 40,
"attrs": "word,tag",
"attr_vmode": "visible-kwic",
"base_viewattr": "word",
"structs": "text,p,g"
},
"query_overview": {
},
"Q": [ "~gUgICee6K2ka" ],
"conc_persistence_op_id": "gUgICee6K2ka"
}
name | description |
---|---|
size | size of the resulting concordance (in tokens) |
finished | if async is set to true then this is always true
|
conc_persistence_op_id | a public ID of the resulting concordance |
conc_args | additional parameters affecting how the concordance is displayed |
- URL:
/view?q=~[concordance persistence ID]
- HTTP Method:
GET