Search in sources :

Example 6 with ConceptTreeConnector

use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.

the class SerializationTests method cqConcept.

@Test
public void cqConcept() throws JSONException, IOException {
    final Dataset dataset = new Dataset();
    dataset.setName("dataset");
    final TreeConcept concept = new TreeConcept();
    concept.setName("concept");
    concept.setDataset(dataset);
    final ConceptTreeConnector connector = new ConceptTreeConnector();
    connector.setConcept(concept);
    concept.setConnectors(List.of(connector));
    final CQConcept cqConcept = new CQConcept();
    cqConcept.setElements(List.of(concept));
    cqConcept.setLabel("Label");
    final CQTable cqTable = new CQTable();
    cqTable.setConnector(connector);
    cqTable.setFilters(List.of());
    cqTable.setConcept(cqConcept);
    cqConcept.setTables(List.of(cqTable));
    final CentralRegistry registry = new CentralRegistry();
    registry.register(dataset);
    registry.register(concept);
    registry.register(connector);
    SerializationTestUtil.forType(CQConcept.class).registry(registry).test(cqConcept);
}
Also used : Dataset(com.bakdata.conquery.models.datasets.Dataset) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) CQTable(com.bakdata.conquery.apiv1.query.concept.filter.CQTable) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CQConcept(com.bakdata.conquery.apiv1.query.concept.specific.CQConcept) CentralRegistry(com.bakdata.conquery.models.identifiable.CentralRegistry) Test(org.junit.jupiter.api.Test) IdMapSerialisationTest(com.bakdata.conquery.models.identifiable.IdMapSerialisationTest)

Example 7 with ConceptTreeConnector

use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.

the class FEValueTest method sortedValidityDates.

@Test
public void sortedValidityDates() {
    Dataset dataset = new Dataset();
    dataset.setName("testDataset");
    Table table = new Table();
    table.setDataset(dataset);
    table.setName("testTable");
    Column column = new Column();
    column.setName("testColumn");
    column.setTable(table);
    ConceptTreeConnector connector = new ConceptTreeConnector();
    connector.setName("testConnector");
    TreeConcept concept = new TreeConcept();
    concept.setDataset(dataset);
    concept.setName("testConcept");
    ValidityDate val0 = new ValidityDate();
    val0.setName("val0");
    val0.setConnector(connector);
    ValidityDate val1 = new ValidityDate();
    val1.setName("val1");
    val1.setConnector(connector);
    ValidityDate val2 = new ValidityDate();
    val2.setName("val2");
    val2.setConnector(connector);
    List<ValidityDate> validityDates = List.of(val0, val1, val2);
    connector.setColumn(column);
    connector.setConcept(concept);
    connector.setValidityDates(validityDates);
    FETable feTable = FrontEndConceptBuilder.createTable(connector);
    assertThat(feTable.getDateColumn().getOptions()).containsExactly(new FEValue("val0", val0.getId().toString()), new FEValue("val1", val1.getId().toString()), new FEValue("val2", val2.getId().toString()));
}
Also used : FETable(com.bakdata.conquery.apiv1.frontend.FETable) ValidityDate(com.bakdata.conquery.models.datasets.concepts.ValidityDate) FETable(com.bakdata.conquery.apiv1.frontend.FETable) Table(com.bakdata.conquery.models.datasets.Table) Column(com.bakdata.conquery.models.datasets.Column) Dataset(com.bakdata.conquery.models.datasets.Dataset) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) FEValue(com.bakdata.conquery.apiv1.frontend.FEValue) Test(org.junit.jupiter.api.Test)

Example 8 with ConceptTreeConnector

use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.

the class CBlockTest method serialize.

@SneakyThrows
@Test
public void serialize() throws IOException, JSONException {
    final CentralRegistry registry = new CentralRegistry();
    final Dataset dataset = new Dataset();
    dataset.setName("dataset");
    final TreeConcept concept = new TreeConcept();
    concept.setDataset(dataset);
    concept.setName("concept");
    final ConceptTreeConnector connector = new ConceptTreeConnector();
    connector.setName("connector");
    connector.setConcept(concept);
    concept.setConnectors(List.of(connector));
    final Table table = new Table();
    table.setName("table");
    table.setDataset(dataset);
    final Import imp = new Import(table);
    imp.setName("import");
    final Bucket bucket = new Bucket(0, 0, 0, new ColumnStore[0], Collections.emptySet(), new int[10], new int[10], imp);
    final CBlock cBlock = CBlock.createCBlock(connector, bucket, 10);
    registry.register(dataset).register(table).register(concept).register(connector).register(bucket).register(imp);
    SerializationTestUtil.forType(CBlock.class).registry(registry).test(cBlock);
}
Also used : Table(com.bakdata.conquery.models.datasets.Table) Import(com.bakdata.conquery.models.datasets.Import) Dataset(com.bakdata.conquery.models.datasets.Dataset) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CentralRegistry(com.bakdata.conquery.models.identifiable.CentralRegistry) Test(org.junit.jupiter.api.Test) SneakyThrows(lombok.SneakyThrows)

Example 9 with ConceptTreeConnector

use of com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector in project conquery by bakdata.

the class BucketManager method fullUpdate.

@SneakyThrows
public void fullUpdate() {
    CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
    for (Concept<?> c : storage.getAllConcepts()) {
        if (!(c instanceof TreeConcept)) {
            continue;
        }
        for (ConceptTreeConnector con : ((TreeConcept) c).getConnectors()) {
            for (Bucket bucket : storage.getAllBuckets()) {
                CBlockId cBlockId = new CBlockId(bucket.getId(), con.getId());
                if (!con.getTable().equals(bucket.getTable())) {
                    continue;
                }
                if (hasCBlock(cBlockId)) {
                    log.trace("Skip calculation of CBlock[{}], because it was loaded from the storage.", cBlockId);
                    continue;
                }
                log.warn("CBlock[{}] missing in Storage. Queuing recalculation", cBlockId);
                job.addCBlock(bucket, con);
            }
        }
    }
    if (!job.isEmpty()) {
        jobManager.addSlowJob(job);
    }
}
Also used : CBlockId(com.bakdata.conquery.models.identifiable.ids.specific.CBlockId) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CalculateCBlocksJob(com.bakdata.conquery.models.jobs.CalculateCBlocksJob) SneakyThrows(lombok.SneakyThrows)

Aggregations

ConceptTreeConnector (com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector)9 TreeConcept (com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept)9 Dataset (com.bakdata.conquery.models.datasets.Dataset)6 Test (org.junit.jupiter.api.Test)5 CQTable (com.bakdata.conquery.apiv1.query.concept.filter.CQTable)4 Table (com.bakdata.conquery.models.datasets.Table)4 CentralRegistry (com.bakdata.conquery.models.identifiable.CentralRegistry)4 CQConcept (com.bakdata.conquery.apiv1.query.concept.specific.CQConcept)3 IdMapSerialisationTest (com.bakdata.conquery.models.identifiable.IdMapSerialisationTest)3 CBlockId (com.bakdata.conquery.models.identifiable.ids.specific.CBlockId)3 CalculateCBlocksJob (com.bakdata.conquery.models.jobs.CalculateCBlocksJob)3 ConceptQuery (com.bakdata.conquery.apiv1.query.ConceptQuery)2 Column (com.bakdata.conquery.models.datasets.Column)2 ValidityDate (com.bakdata.conquery.models.datasets.concepts.ValidityDate)2 SneakyThrows (lombok.SneakyThrows)2 FETable (com.bakdata.conquery.apiv1.frontend.FETable)1 FEValue (com.bakdata.conquery.apiv1.frontend.FEValue)1 ArrayConceptQuery (com.bakdata.conquery.apiv1.query.ArrayConceptQuery)1 Query (com.bakdata.conquery.apiv1.query.Query)1 FilterValue (com.bakdata.conquery.apiv1.query.concept.filter.FilterValue)1