use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.
the class BucketManager method addConcept.
public void addConcept(Concept<?> concept) {
storage.updateConcept(concept);
if (!(concept instanceof TreeConcept)) {
return;
}
CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
for (ConceptTreeConnector connector : ((TreeConcept) concept).getConnectors()) {
for (Bucket bucket : storage.getAllBuckets()) {
if (!bucket.getTable().equals(connector.getTable())) {
continue;
}
final CBlockId cBlockId = new CBlockId(bucket.getId(), connector.getId());
if (hasCBlock(cBlockId)) {
continue;
}
job.addCBlock(bucket, connector);
}
}
jobManager.addSlowJob(job);
}
use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.
the class BucketManager method addBucket.
public void addBucket(Bucket bucket) {
storage.addBucket(bucket);
registerBucket(bucket, entities, tableToBuckets);
CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
for (Concept<?> concept : storage.getAllConcepts()) {
if (!(concept instanceof TreeConcept)) {
continue;
}
for (ConceptTreeConnector connector : ((TreeConcept) concept).getConnectors()) {
if (!connector.getTable().equals(bucket.getTable())) {
continue;
}
CBlockId cBlockId = new CBlockId(bucket.getId(), connector.getId());
if (hasCBlock(cBlockId)) {
continue;
}
job.addCBlock(bucket, connector);
}
}
jobManager.addSlowJob(job);
}
use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.
the class FilterTest method importConcepts.
private void importConcepts(StandaloneSupport support) throws JSONException, IOException {
Dataset dataset = support.getDataset();
concept = new TreeConcept();
concept.setLabel("concept");
concept.setValidator(support.getValidator());
concept.setDataset(support.getDataset());
rawConnector.put("name", "connector");
rawConnector.put("table", "table");
((ObjectNode) rawConnector.get("filters")).put("name", "filter");
connector = parseSubTree(support, rawConnector, ConceptTreeConnector.class, conn -> conn.setConcept(concept));
concept.setConnectors(Collections.singletonList((ConceptTreeConnector) connector));
support.getDatasetsProcessor().addConcept(dataset, concept);
}
use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.
the class SerializationTests method treeConcept.
@Test
public void treeConcept() throws IOException, JSONException {
Dataset dataset = new Dataset();
dataset.setName("datasetName");
TreeConcept concept = new TreeConcept();
concept.setDataset(dataset);
concept.setLabel("conceptLabel");
concept.setName("conceptName");
Table table = new Table();
Column column = new Column();
column.setLabel("colLabel");
column.setName("colName");
column.setType(MajorTypeId.STRING);
column.setTable(table);
Column dateColumn = new Column();
dateColumn.setLabel("colLabel2");
dateColumn.setName("colName2");
dateColumn.setType(MajorTypeId.DATE);
dateColumn.setTable(table);
table.setColumns(new Column[] { column, dateColumn });
table.setDataset(dataset);
table.setLabel("tableLabel");
table.setName("tableName");
column.setTable(table);
ConceptTreeConnector connector = new ConceptTreeConnector();
connector.setConcept(concept);
connector.setLabel("connLabel");
connector.setName("connName");
connector.setColumn(column);
concept.setConnectors(List.of(connector));
ValidityDate valDate = new ValidityDate();
valDate.setColumn(dateColumn);
valDate.setConnector(connector);
valDate.setLabel("valLabel");
valDate.setName("valName");
connector.setValidityDates(List.of(valDate));
CentralRegistry registry = new CentralRegistry();
registry.register(dataset);
registry.register(concept);
registry.register(column);
registry.register(dateColumn);
registry.register(table);
registry.register(connector);
registry.register(valDate);
final Validator validator = Validators.newValidator();
concept.setValidator(validator);
SerializationTestUtil.forType(TreeConcept.class).registry(registry).injectables(new Injectable() {
@Override
public MutableInjectableValues inject(MutableInjectableValues values) {
return values.add(Validator.class, validator);
}
}).test(concept);
}
use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.
the class SerializationTests method testFormQuery.
@Test
public void testFormQuery() throws IOException, JSONException {
CQConcept concept = new CQConcept();
final TreeConcept testConcept = new TreeConcept();
Dataset dataset = new Dataset();
dataset.setName("testDataset");
testConcept.setDataset(dataset);
testConcept.setName("concept");
final ConceptTreeConnector connector = new ConceptTreeConnector();
connector.setConcept(testConcept);
connector.setName("connector1");
testConcept.setConnectors(List.of(connector));
concept.setElements(Collections.singletonList(testConcept));
CQTable[] tables = { new CQTable() };
connector.setTable(new Table());
tables[0].setConnector(connector);
tables[0].setConcept(concept);
concept.setTables(Arrays.asList(tables));
ConceptQuery subQuery = new ConceptQuery(concept);
CQOr features = new CQOr();
features.setChildren(Collections.singletonList(concept));
AbsoluteFormQuery query = new AbsoluteFormQuery(subQuery, CDateRange.exactly(LocalDate.now()).toSimpleRange(), ArrayConceptQuery.createFromFeatures(Collections.singletonList(features)), List.of(ExportForm.ResolutionAndAlignment.of(Resolution.COMPLETE, Alignment.NO_ALIGN), ExportForm.ResolutionAndAlignment.of(Resolution.QUARTERS, Alignment.QUARTER)));
CentralRegistry centralRegistry = new CentralRegistry();
centralRegistry.register(dataset);
centralRegistry.register(testConcept);
centralRegistry.register(connector);
SerializationTestUtil.forType(AbsoluteFormQuery.class).registry(centralRegistry).test(query);
}
Aggregations