@Test public void summarize() { DmdlSemantics resolved = resolve(); ModelDeclaration simple = resolved.findModelDeclaration("simple"); assertThat(simple, not(nullValue())); PropertyDeclaration key = simple.findPropertyDeclaration("key"); assertThat(key, not(nullValue())); assertThat(key.getType(), is(type(BasicTypeKind.INT))); PropertyDeclaration sum = simple.findPropertyDeclaration("sum"); assertThat(sum, not(nullValue())); assertThat(sum.getType(), is(type(BasicTypeKind.LONG))); PropertyDeclaration count = simple.findPropertyDeclaration("count"); assertThat(count, not(nullValue())); assertThat(count.getType(), is(type(BasicTypeKind.LONG))); PropertyDeclaration max = simple.findPropertyDeclaration("max"); assertThat(max, not(nullValue())); assertThat(max.getType(), is(type(BasicTypeKind.DATE))); PropertyDeclaration min = simple.findPropertyDeclaration("min"); assertThat(min, not(nullValue())); assertThat(min.getType(), is(type(BasicTypeKind.DATE))); SummarizeTrait trait = simple.getTrait(SummarizeTrait.class); assertThat(trait, not(nullValue())); assertThat(trait.getTerms().size(), is(1)); ReduceTerm<AstSummarize> aTerm = trait.getTerms().get(0); assertThat(aTerm.getSource(), is(model("a"))); assertThat(aTerm.getGrouping(), has(property("key"))); assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.ANY, "value_a", "key"))); assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.SUM, "value_b", "sum"))); assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.COUNT, "value_a", "count"))); assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.MAX, "value_c", "max"))); assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.MIN, "value_c", "min"))); }
public synchronized DmdlSemantics resolve() throws DmdlSemanticException { checkDiagnostics(); resolveSymbols(); checkDiagnostics(); resolveAttributes(); checkDiagnostics(); verifyAttributes(); checkDiagnostics(); return context.getWorld(); }
DmdlAnalyzer { public synchronized DmdlSemantics resolve() throws DmdlSemanticException { checkDiagnostics(); resolveSymbols(); checkDiagnostics(); resolveAttributes(); checkDiagnostics(); verifyAttributes(); checkDiagnostics(); return context.getWorld(); } }
DmdlAnalyzer { public synchronized DmdlSemantics resolve() throws DmdlSemanticException { checkDiagnostics(); resolveSymbols(); checkDiagnostics(); resolveAttributes(); checkDiagnostics(); verifyAttributes(); checkDiagnostics(); return context.getWorld(); } DmdlAnalyzer(
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers);  DmdlAnalyzer(
            DmdlAnalyzerEnhancer enhancer,
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers); }
DmdlAnalyzer { public synchronized DmdlSemantics resolve() throws DmdlSemanticException { checkDiagnostics(); resolveSymbols(); checkDiagnostics(); resolveAttributes(); checkDiagnostics(); verifyAttributes(); checkDiagnostics(); return context.getWorld(); } DmdlAnalyzer(
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers);  DmdlAnalyzer(
            DmdlAnalyzerEnhancer enhancer,
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers); void addModel(AstModelDefinition<?> definition); synchronized DmdlSemantics resolve(); }
DmdlAnalyzer { public synchronized DmdlSemantics resolve() throws DmdlSemanticException { checkDiagnostics(); resolveSymbols(); checkDiagnostics(); resolveAttributes(); checkDiagnostics(); verifyAttributes(); checkDiagnostics(); return context.getWorld(); } DmdlAnalyzer(
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers);  DmdlAnalyzer(
            DmdlAnalyzerEnhancer enhancer,
            Iterable<? extends TypeDriver> typeDrivers,
            Iterable<? extends AttributeDriver> attributeDrivers); void addModel(AstModelDefinition<?> definition); synchronized DmdlSemantics resolve();  }