mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-27 08:20:34 +00:00
Replace the old js CQiClient with fully featured new one
This commit is contained in:
@ -80,6 +80,33 @@ cqi.models.corpora.Corpus = class Corpus extends cqi.models.resource.Model {
|
||||
async query(subcorpusName, query) {
|
||||
return await this.client.api.cqp_query(this.apiName, subcorpusName, query);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* NOTE: The following are non standard implementations of nopaque *
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
get staticData() {
|
||||
return this.attrs.static_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {cqi.status.StatusOk}
|
||||
*/
|
||||
async updateDb() {
|
||||
return await this.client.api.corpus_update_db(this.apiName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number=} page
|
||||
* @param {number=} per_page
|
||||
* @returns {Promise<object>}
|
||||
*/
|
||||
async paginate(page, per_page) {
|
||||
return await this.client.api.corpus_paginate_corpus(this.apiName, page, per_page);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -95,11 +122,12 @@ cqi.models.corpora.CorpusCollection = class CorpusCollection extends cqi.models.
|
||||
return {
|
||||
api_name: corpusName,
|
||||
charset: await this.client.api.corpus_charset(corpusName),
|
||||
// full_name: await this.client.api.corpus_full_name(api_name),
|
||||
// info: await this.client.api.corpus_info(api_name),
|
||||
// full_name: await this.client.api.corpus_full_name(corpusName),
|
||||
// info: await this.client.api.corpus_info(corpusName),
|
||||
name: corpusName,
|
||||
properties: await this.client.api.corpus_properties(corpusName),
|
||||
size: await this.client.api.cl_attribute_size(`${corpusName}.word`)
|
||||
size: await this.client.api.cl_attribute_size(`${corpusName}.word`),
|
||||
static_data: await this.client.api.corpus_static_data(corpusName),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,37 @@ cqi.models.subcorpora.Subcorpus = class Subcorpus extends cqi.models.resource.Mo
|
||||
attribute2.apiName
|
||||
);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* NOTE: The following are non standard implementations of nopaque *
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* @param {number=} context
|
||||
* @param {number=} page
|
||||
* @param {number=} perPage
|
||||
* @returns {Promise<object>}
|
||||
*/
|
||||
async paginate(context, page, perPage) {
|
||||
return await this.client.api.cqp_paginate_subcorpus(this.apiName, context, page, perPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number[]} matchIdList
|
||||
* @param {number=} context
|
||||
* @returns {Promise<object>}
|
||||
*/
|
||||
async partialExport(matchIdList, context) {
|
||||
return await this.client.api.cqp_partial_export_subcorpus(this.apiName, matchIdList, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number=} context
|
||||
* @returns {Promise<object>}
|
||||
*/
|
||||
async export(context) {
|
||||
return await this.client.api.cqp_export_subcorpus(this.apiName, context);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user