Search in sources :

Example 1 with GraphPathContext

use of org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.GraphPathContext in project legend-pure by finos.

the class GraphAntlrTreeWalker method visitRootGraphDefinition.

private String visitRootGraphDefinition(GraphDefinitionContext graphDefinitionContext, DefinitionContext definitionContext) {
    SourceInformation definitionSourceInfo = this.sourceInformation.getPureSourceInformation(definitionContext.start, graphDefinitionContext.start, graphDefinitionContext.stop);
    SourceInformation classSourceInfo = this.sourceInformation.getPureSourceInformation(definitionContext.qualifiedName().start, definitionContext.qualifiedName().identifier().start, definitionContext.qualifiedName().stop);
    MutableList<String> subTrees = FastList.newList();
    for (GraphPathContext graphPathContext : graphDefinitionContext.graphPaths().graphPath()) {
        subTrees.add(this.visitGraphPathContext(graphPathContext));
    }
    return "^meta::pure::graphFetch::RootGraphFetchTree<" + definitionContext.qualifiedName().getText() + "> " + definitionSourceInfo.toM4String() + " (" + "class = " + "^meta::pure::metamodel::import::ImportStub " + classSourceInfo.toM4String() + " (importGroup = system::imports::" + this.importId._name() + ", idOrPath = '" + definitionContext.qualifiedName().getText() + "'), " + "subTrees = " + subTrees.makeString("[", ", ", "]") + ")";
}
Also used : GraphPathContext(org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.GraphPathContext) AntlrSourceInformation(org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation) SourceInformation(org.finos.legend.pure.m4.coreinstance.SourceInformation)

Example 2 with GraphPathContext

use of org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.GraphPathContext in project legend-pure by finos.

the class GraphAntlrTreeWalker method visitGraphPathContext.

private String visitGraphPathContext(GraphPathContext graphPathContext) {
    SourceInformation definitionSourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.start, graphPathContext.start, graphPathContext.stop);
    SourceInformation propertySourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.identifier().start, graphPathContext.identifier().start, graphPathContext.identifier().stop);
    MutableList<String> subTrees = FastList.newList();
    if (graphPathContext.graphDefinition() != null) {
        for (GraphPathContext subGraphPathContext : graphPathContext.graphDefinition().graphPaths().graphPath()) {
            subTrees.add(this.visitGraphPathContext(subGraphPathContext));
        }
    }
    MutableList<String> parameters = FastList.newList();
    if (graphPathContext.propertyParameters() != null) {
        for (ParameterContext parameterContext : graphPathContext.propertyParameters().parameter()) {
            parameters.add(this.visitParameterContext(parameterContext));
        }
    }
    String subType = "";
    if (graphPathContext.subtype() != null) {
        SourceInformation subTypeSourceInfo = this.sourceInformation.getPureSourceInformation(graphPathContext.subtype().qualifiedName().start, graphPathContext.subtype().qualifiedName().start, graphPathContext.subtype().qualifiedName().stop);
        subType = "^meta::pure::metamodel::import::ImportStub " + subTypeSourceInfo.toM4String() + " (importGroup = system::imports::" + this.importId._name() + ", idOrPath = '" + graphPathContext.subtype().qualifiedName().getText() + "')";
    }
    String alias = "";
    if (graphPathContext.alias() != null) {
        alias = graphPathContext.alias().STRING().getText();
    }
    return "^meta::pure::graphFetch::PropertyGraphFetchTree " + definitionSourceInfo.toM4String() + " (" + "property = " + "^meta::pure::metamodel::import::PropertyStub " + propertySourceInfo.toM4String() + " (propertyName = '" + graphPathContext.identifier().getText() + "'), " + "parameters = " + parameters.makeString("[", ", ", "]") + ", " + "subTrees = " + subTrees.makeString("[", ", ", "]") + ", " + "subType = [" + subType + "]" + ", " + "alias = [" + alias + "]" + ")";
}
Also used : GraphPathContext(org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.GraphPathContext) ScalarParameterContext(org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.ScalarParameterContext) ParameterContext(org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.ParameterContext) AntlrSourceInformation(org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation) SourceInformation(org.finos.legend.pure.m4.coreinstance.SourceInformation)

Aggregations

GraphPathContext (org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.GraphPathContext)2 SourceInformation (org.finos.legend.pure.m4.coreinstance.SourceInformation)2 AntlrSourceInformation (org.finos.legend.pure.m4.serialization.grammar.antlr.AntlrSourceInformation)2 ParameterContext (org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.ParameterContext)1 ScalarParameterContext (org.finos.legend.pure.m3.inlinedsl.graph.serialization.grammar.GraphParser.ScalarParameterContext)1