use of com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId in project conquery by bakdata.
the class FrontEndConceptBuilder method createCTRoot.
private static FENode createCTRoot(Concept<?> c, StructureNode[] structureNodes) {
MatchingStats matchingStats = c.getMatchingStats();
StructureNodeId structureParent = Arrays.stream(structureNodes).filter(sn -> sn.getContainedRoots().contains(c.getId())).findAny().map(StructureNode::getId).orElse(null);
FENode n = FENode.builder().active(true).description(c.getDescription()).label(c.getLabel()).additionalInfos(c.getAdditionalInfos()).matchingEntries(matchingStats.countEvents()).matchingEntities(matchingStats.countEntities()).dateRange(matchingStats.spanEvents() != null ? matchingStats.spanEvents().toSimpleRange() : null).detailsAvailable(Boolean.TRUE).codeListResolvable(c.countElements() > 1).parent(structureParent).selects(c.getSelects().stream().map(FrontEndConceptBuilder::createSelect).collect(Collectors.toList())).tables(c.getConnectors().stream().map(FrontEndConceptBuilder::createTable).collect(Collectors.toList())).build();
if (c instanceof ConceptTreeNode) {
ConceptTreeNode<?> tree = (ConceptTreeNode<?>) c;
if (tree.getChildren() != null) {
n.setChildren(tree.getChildren().stream().map(ConceptTreeChild::getId).toArray(ConceptTreeChildId[]::new));
}
}
return n;
}
use of com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId in project conquery by bakdata.
the class IdTests method testInterning.
@Test
public void testInterning() throws JsonParseException, JsonMappingException, JsonProcessingException, IOException {
String raw = "1.concepts.2.3.4";
ConceptTreeChildId id1 = ConceptTreeChildId.Parser.INSTANCE.parse(raw);
ConceptTreeChildId id2 = ConceptTreeChildId.Parser.INSTANCE.parse(raw);
assertThat(id1).isSameAs(id2);
assertThat(id1.getParent()).isSameAs(id2.getParent());
assertThat(id1.findConcept()).isSameAs(id2.findConcept());
assertThat(id1.findConcept().getDataset()).isSameAs(id2.findConcept().getDataset());
}
use of com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId in project conquery by bakdata.
the class IdTests method testEquals.
@Test
public void testEquals() {
ConceptTreeChildId idA = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
ConceptTreeChildId idB = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
assertThat(idA).isEqualTo(idB);
assertThat(idA).hasSameHashCodeAs(idB);
assertThat(idA.toString()).isEqualTo(idB.toString());
}
use of com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId in project conquery by bakdata.
the class IdTests method testJacksonBinarySerialization.
@Test
public void testJacksonBinarySerialization() throws JsonParseException, JsonMappingException, JsonProcessingException, IOException {
ConceptTreeChildId id = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
ObjectMapper mapper = Jackson.BINARY_MAPPER;
ConceptTreeChildId copy = mapper.readValue(mapper.writeValueAsBytes(id), ConceptTreeChildId.class);
assertThat(copy).isEqualTo(id);
assertThat(copy).hasSameHashCodeAs(id);
assertThat(copy.toString()).isEqualTo(id.toString());
}
use of com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId in project conquery by bakdata.
the class IdTests method testJacksonSerialization.
@Test
public void testJacksonSerialization() throws JsonParseException, JsonMappingException, JsonProcessingException, IOException {
ConceptTreeChildId id = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
ObjectMapper mapper = Jackson.MAPPER;
ConceptTreeChildId copy = mapper.readValue(mapper.writeValueAsBytes(id), ConceptTreeChildId.class);
assertThat(copy).isEqualTo(id);
assertThat(copy).hasSameHashCodeAs(id);
assertThat(copy.toString()).isEqualTo(id.toString());
}
Aggregations