use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn in project legend-pure by finos.
the class TestSimpleGrammar method testMappingScope.
@Test
public void testMappingScope() {
Loader.parseM3("import other::*;\n" + "\n" + "Class other::Person\n" + "{\n" + " name : String[1];\n" + " id : Integer[1];" + " other : String[1];" + "}\n" + "###Relational\n" + "Database mapping::pack::db" + "(" + " Table employeeTable\n" + " (\n" + " id INT PRIMARY KEY,\n" + " name VARCHAR(200),\n" + " other VARCHAR(200),\n" + " firmId INT\n" + " )" + ")\n" + "###Mapping\n" + "import mapping::pack::*;\n" + "Mapping mappingPackage::myMapping\n" + "(\n" + " /* comment */\n" + " other::Person: Relational\n" + " {" + " scope([db])" + " (" + " name : employeeTable.name\n" + " )," + " scope([db]default.employeeTable)" + " (" + " id : id" + " )," + " scope([db]employeeTable)" + " (" + " other : other" + " )" + " }\n" + ")\n", this.repository, new ParserLibrary(Lists.immutable.with(new M3AntlrParser(), new MappingParser(), new RelationalParser())), ValidationType.DEEP, VoidM3M4StateListener.VOID_M3_M4_STATE_LISTENER, this.context);
this.runtime.compile();
CoreInstance mapping = this.runtime.getCoreInstance("mappingPackage::myMapping");
CoreInstance personClassMappingImplementation = Instance.getValueForMetaPropertyToManyResolved(mapping, "classMappings", this.processorSupport).getFirst();
ListIterable<? extends CoreInstance> personClassMappingImplementationPropertyMappings = Instance.getValueForMetaPropertyToManyResolved(personClassMappingImplementation, "propertyMappings", this.processorSupport);
final StringBuilder sb = new StringBuilder("[\n");
personClassMappingImplementationPropertyMappings.forEach(new Procedure<CoreInstance>() {
@Override
public void value(CoreInstance each) {
CoreInstance relationalOperationElement = Instance.getValueForMetaPropertyToOneResolved(each, "relationalOperationElement", TestSimpleGrammar.this.processorSupport);
Printer.print(sb, relationalOperationElement, 3);
sb.append("\n");
}
});
final String mappingGraphDump = sb.append("]").toString();
Assert.assertEquals("[\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " name instance String\n" + " nullable(Property):\n" + " true instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Varchar\n" + " size(Property):\n" + " 200 instance Integer\n" + " columnName(Property):\n" + " name instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] id instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] other instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " schema(Property):\n" + " default instance String\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " id instance String\n" + " nullable(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Integer\n" + " columnName(Property):\n" + " id instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] name instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] other instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " other instance String\n" + " nullable(Property):\n" + " true instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Varchar\n" + " size(Property):\n" + " 200 instance Integer\n" + " columnName(Property):\n" + " other instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] name instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] id instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "]", mappingGraphDump);
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn in project legend-pure by finos.
the class RelationalOperationElementProcessor method processColumnExpr.
static void processColumnExpr(RelationalOperationElement impl, CoreInstance implementation, CoreInstance mappingOwner, MutableSet<TableAlias> tableAliases, Matcher matcher, ProcessorState state, ModelRepository repository, ProcessorSupport processorSupport) throws PureCompilationException {
if (impl instanceof TableAliasColumn) {
processTableAliasColumn((TableAliasColumn) impl, mappingOwner, tableAliases, processorSupport);
} else if (impl instanceof DynaFunction) {
processDynaFunction((DynaFunction) impl, implementation, mappingOwner, tableAliases, matcher, state, repository, processorSupport);
} else if (impl instanceof RelationalOperationElementWithJoin) {
RelationalOperationElement relationalOperationElement = ((RelationalOperationElementWithJoin) impl)._relationalOperationElement();
if (relationalOperationElement != null) {
if (relationalOperationElement instanceof DynaFunction) {
processDynaFunction((DynaFunction) relationalOperationElement, implementation, mappingOwner, tableAliases, matcher, state, repository, processorSupport);
} else if (relationalOperationElement instanceof TableAliasColumn) {
processTableAliasColumn((TableAliasColumn) relationalOperationElement, mappingOwner, tableAliases, processorSupport);
}
}
JoinTreeNode joinTreeNode = ((RelationalOperationElementWithJoin) impl)._joinTreeNode();
if (joinTreeNode != null) {
processJoinTreeNode(joinTreeNode, mappingOwner, matcher, state, repository, processorSupport);
tableAliases.clear();
}
} else if (impl instanceof Literal) {
// Do nothing
} else {
throw new PureCompilationException(impl.getSourceInformation(), "Not Supported Yet! " + impl);
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn in project legend-pure by finos.
the class DatabaseUnloadUnbind method processTableAliasColumn.
private static void processTableAliasColumn(TableAliasColumn tableAliasColumn, TableAlias joinTarget, ProcessorSupport processorSupport) throws PureCompilationException {
TableAlias tableAlias = tableAliasColumn._alias();
if ((joinTarget != null) && (tableAlias == joinTarget)) {
// Replace the join target with a {target} alias
ModelRepository repository = tableAliasColumn.getRepository();
TableAlias targetAlias = (TableAlias) repository.newAnonymousCoreInstance(tableAliasColumn.getSourceInformation(), joinTarget.getClassifier());
targetAlias._name(DatabaseProcessor.SELF_JOIN_TABLE_NAME);
tableAliasColumn._alias(targetAlias);
} else {
tableAlias._relationalElementRemove();
ImportStub tableAliasDatabase = (ImportStub) tableAlias._databaseCoreInstance();
if (tableAliasDatabase != null) {
Shared.cleanImportStub(tableAliasDatabase, processorSupport);
}
}
tableAliasColumn._columnRemove();
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn in project legend-pure by finos.
the class RelationalOperationElementUnbind method cleanNode.
public static void cleanNode(RelationalOperationElement element, ModelRepository modelRepository, ProcessorSupport processorSupport) throws PureCompilationException {
if (element instanceof TableAliasColumn) {
TableAliasColumn tableAliasColumn = (TableAliasColumn) element;
ImportStub database = (ImportStub) tableAliasColumn._alias()._databaseCoreInstance();
Shared.cleanUpReferenceUsage(database, tableAliasColumn, processorSupport);
Shared.cleanImportStub(database, processorSupport);
tableAliasColumn._columnRemove();
TableAlias alias = tableAliasColumn._alias();
alias._relationalElementRemove();
} else if (element instanceof DynaFunction) {
for (RelationalOperationElement val : ((DynaFunction) element)._parameters()) {
cleanNode(val, modelRepository, processorSupport);
}
} else if (element instanceof RelationalOperationElementWithJoin) {
if (((RelationalOperationElementWithJoin) element)._relationalOperationElement() != null) {
cleanNode(((RelationalOperationElementWithJoin) element)._relationalOperationElement(), modelRepository, processorSupport);
}
if (((RelationalOperationElementWithJoin) element)._joinTreeNode() != null) {
cleanJoinTreeNode(((RelationalOperationElementWithJoin) element)._joinTreeNode(), modelRepository, processorSupport);
}
} else if (element instanceof Literal) {
// Nothing to do
} else {
throw new RuntimeException("TO CODE: clean relational operation element node of type " + PackageableElement.getUserPathForPackageableElement(element.getClassifier()));
}
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.metamodel.TableAliasColumn in project legend-pure by finos.
the class DatabaseProcessor method processFilter.
private void processFilter(Filter filter, Database defaultDb, ProcessorSupport processorSupport) throws PureCompilationException {
MutableMap<String, MutableMap<String, CoreInstance>> tableByAlias = UnifiedMap.newMap();
Operation operation = filter._operation();
MutableList<TableAliasColumn> selfJoinTarget = FastList.newList();
scanOperation(operation, tableByAlias, selfJoinTarget, defaultDb, null, processorSupport, false);
}
Aggregations