Commit 8fe19e59 authored by Fred Eisele's avatar Fred Eisele
Browse files

loading mappings

parent 43e47ef7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/9qb/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/fjo/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
......
This diff is collapsed.
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/9qb/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/fjo/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.ParserRuleContext;
......@@ -2464,13 +2464,25 @@ public class AqlParserBaseListener implements AqlParserListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMappingLambda(AqlParser.MappingLambdaContext ctx) { }
@Override public void enterMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMappingLambda(AqlParser.MappingLambdaContext ctx) { }
@Override public void exitMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx) { }
/**
* {@inheritDoc}
*
......@@ -2500,13 +2512,37 @@ public class AqlParserBaseListener implements AqlParserListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEvalMappingFn(AqlParser.EvalMappingFnContext ctx) { }
@Override public void enterEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEvalMappingFn(AqlParser.EvalMappingFnContext ctx) { }
@Override public void exitEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx) { }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/9qb/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/fjo/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
......@@ -1445,7 +1445,14 @@ public class AqlParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> impleme
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMappingLambda(AqlParser.MappingLambdaContext ctx) { return visitChildren(ctx); }
@Override public T visitMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......@@ -1466,7 +1473,21 @@ public class AqlParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> impleme
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEvalMappingFn(AqlParser.EvalMappingFnContext ctx) { return visitChildren(ctx); }
@Override public T visitEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/9qb/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/fjo/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeListener;
......@@ -2208,15 +2208,29 @@ public interface AqlParserListener extends ParseTreeListener {
*/
void exitMappingAttributeSig(AqlParser.MappingAttributeSigContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#mappingLambda}.
* Enter a parse tree produced by the {@code MappingAttrTerm_Lambda}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
*/
void enterMappingLambda(AqlParser.MappingLambdaContext ctx);
void enterMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#mappingLambda}.
* Exit a parse tree produced by the {@code MappingAttrTerm_Lambda}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
*/
void exitMappingLambda(AqlParser.MappingLambdaContext ctx);
void exitMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx);
/**
* Enter a parse tree produced by the {@code MappingAttrTerm_Path}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
*/
void enterMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx);
/**
* Exit a parse tree produced by the {@code MappingAttrTerm_Path}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
*/
void exitMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#mappingGen}.
* @param ctx the parse tree
......@@ -2238,15 +2252,41 @@ public interface AqlParserListener extends ParseTreeListener {
*/
void exitMappingGenType(AqlParser.MappingGenTypeContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#evalMappingFn}.
* Enter a parse tree produced by the {@code EvalMappingFn_Gen}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void enterEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx);
/**
* Exit a parse tree produced by the {@code EvalMappingFn_Gen}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void exitEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx);
/**
* Enter a parse tree produced by the {@code EvalMappingFn_Mapping}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void enterEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx);
/**
* Exit a parse tree produced by the {@code EvalMappingFn_Mapping}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void exitEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx);
/**
* Enter a parse tree produced by the {@code EvalMappingFn_Typeside}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void enterEvalMappingFn(AqlParser.EvalMappingFnContext ctx);
void enterEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#evalMappingFn}.
* Exit a parse tree produced by the {@code EvalMappingFn_Typeside}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
*/
void exitEvalMappingFn(AqlParser.EvalMappingFnContext ctx);
void exitEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#mappingFn}.
* @param ctx the parse tree
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/9qb/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/fjo/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
......@@ -1315,11 +1315,19 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitMappingAttributeSig(AqlParser.MappingAttributeSigContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#mappingLambda}.
* Visit a parse tree produced by the {@code MappingAttrTerm_Lambda}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMappingLambda(AqlParser.MappingLambdaContext ctx);
T visitMappingAttrTerm_Lambda(AqlParser.MappingAttrTerm_LambdaContext ctx);
/**
* Visit a parse tree produced by the {@code MappingAttrTerm_Path}
* labeled alternative in {@link AqlParser#mappingAttributeTerm}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMappingAttrTerm_Path(AqlParser.MappingAttrTerm_PathContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#mappingGen}.
* @param ctx the parse tree
......@@ -1333,11 +1341,26 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitMappingGenType(AqlParser.MappingGenTypeContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#evalMappingFn}.
* Visit a parse tree produced by the {@code EvalMappingFn_Gen}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEvalMappingFn_Gen(AqlParser.EvalMappingFn_GenContext ctx);
/**
* Visit a parse tree produced by the {@code EvalMappingFn_Mapping}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEvalMappingFn_Mapping(AqlParser.EvalMappingFn_MappingContext ctx);
/**
* Visit a parse tree produced by the {@code EvalMappingFn_Typeside}
* labeled alternative in {@link AqlParser#evalMappingFn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEvalMappingFn(AqlParser.EvalMappingFnContext ctx);
T visitEvalMappingFn_Typeside(AqlParser.EvalMappingFn_TypesideContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#mappingFn}.
* @param ctx the parse tree
......
......@@ -33,7 +33,7 @@ mappingLiteralSection
allOptions
;
mappingLiteralSubsection
: ENTITY mappingEntitySig*
: ENTITY mappingEntitySig
(FOREIGN_KEYS mappingForeignSig*)?
(ATTRIBUTES mappingAttributeSig*)?
;
......@@ -44,18 +44,28 @@ mappingForeignSig
: schemaForeignId RARROW schemaPath ;
mappingAttributeSig
: schemaAttributeId RARROW (mappingLambda | schemaPath) ;
: schemaAttributeId RARROW mappingAttributeTerm ;
mappingLambda
: LAMBDA mappingGen (COMMA mappingGen)* DOT evalMappingFn ;
mappingAttributeTerm
: LAMBDA mappingGen (COMMA mappingGen)* DOT evalMappingFn
# MappingAttrTerm_Lambda
| schemaPath
# MappingAttrTerm_Path
;
mappingGen : symbol (COLON mappingGenType)? ;
mappingGenType : symbol ;
evalMappingFn
: mappingGen
| mappingFn LPAREN evalMappingFn (COMMA evalMappingFn)* RPAREN
| LPAREN evalMappingFn (typesideFnName evalMappingFn)* RPAREN
: mappingGen
# EvalMappingFn_Gen
| mappingFn LPAREN evalMappingFn (COMMA evalMappingFn)* RPAREN
# EvalMappingFn_Mapping
| LPAREN evalMappingFn (typesideFnName evalMappingFn)* RPAREN
# EvalMappingFn_Typeside
;
mappingFn : typesideFnName | schemaAttributeId | schemaForeignId ;
......@@ -42,6 +42,17 @@ public final class RawTerm {
}
return head + "(" + Util.sep(args, ", ") + ")";
}
public List<String> unpack() {
final LinkedList<String>
ls = new LinkedList<>(
this.args.stream()
.map(x -> x.unpack())
.flatMap(x -> x.stream())
.collect(Collectors.toList()));
ls.addFirst(this.head);
return ls;
}
private static Set<Triple<Term<Ty, En, Sym, Fk, Att, Gen, Sk>, Ctx<Var, Chc<Ty, En>>, Chc<Ty, En>>> infer_good(
RawTerm e, Chc<Ty, En> expected, Collage<Ty, En, Sym, Fk, Att, Gen, Sk> col, String pre, AqlJs<Ty, Sym> js,
......@@ -540,6 +551,32 @@ public final class RawTerm {
public RawTerm(String head) {
this(head, Collections.emptyList(), null);
}
public RawTerm clone() {
final List<RawTerm> args = new LinkedList<>();
for (final RawTerm term : this.args) {
args.add(term.clone());
}
return new RawTerm(this.head, args);
}
/**
* Make a clone (deep-copy) first.
*
* @param tail
* @return
*/
public RawTerm append(String tail) {
final List<RawTerm> last = new LinkedList<>();
last.add(new RawTerm(tail));
List<RawTerm> c = this.args;
while (!c.isEmpty()) {
c = c.get(0).args;
}
c.addAll(last);
return this;
}
// TODO: aql use of toString here is ugly
public static RawTerm fold(Set<Fk> fks, Set<En> entities, List<String> l, String v) {
......
......@@ -7,7 +7,6 @@ import java.util.Map;
import java.util.function.Function;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeProperty;
......@@ -26,9 +25,10 @@ import catdata.aql.exp.TyExpRaw.Sym;
import catdata.aql.exp.TyExpRaw.Ty;
import catdata.aql.grammar.AqlParser;
import catdata.aql.grammar.AqlParser.GraphLiteralSectionContext;
import catdata.aql.grammar.AqlParser.MappingExp_LiteralContext;
import catdata.aql.grammar.AqlParser.MappingGenContext;
import catdata.aql.grammar.AqlParser.MappingLiteralSectionContext;
import catdata.aql.grammar.AqlParser.MappingRefContext;
import catdata.aql.grammar.AqlParser.SchemaEntityIdContext;
import catdata.aql.grammar.AqlParser.SchemaEquationSigContext;
import catdata.aql.grammar.AqlParser.SchemaGenTypeContext;
import catdata.aql.grammar.AqlParser.SchemaLiteralSectionContext;
......@@ -53,21 +53,32 @@ public class AqlLoaderListener extends AqlParserBaseListener {
return new LocStr(ctx.getStart().getStartIndex(), ctx.getText());
}
public class Loc<Ob> extends Pair<Integer, Ob> {
private static final long serialVersionUID = 1L;
public Loc(final ParserRuleContext ctx, final Ob ob) {
super(ctx.getStart().getStartIndex(), ob);
}
}
public AqlLoaderListener() {
this.decls = new LinkedList<>();
this.global_options = new LinkedList<>();
this.kind = q -> q.kind().toString();
this.exps = new ParseTreeProperty<>();
this.mapped_terms = new ParseTreeProperty<>();
this.value_option = new ParseTreeProperty<>();
this.terms = new ParseTreeProperty<>();
this.quads = new ParseTreeProperty<>();
}
private final ParseTreeProperty<Pair<String,String>> value_option = new ParseTreeProperty<>();
private final ParseTreeProperty<Exp<?>> exps = new ParseTreeProperty<>();
private final ParseTreeProperty<List<String>> strList = new ParseTreeProperty<>();
private final ParseTreeProperty<RawTerm> terms = new ParseTreeProperty<>();
private final ParseTreeProperty<Quad<String,String,RawTerm,RawTerm>> quads = new ParseTreeProperty<>();
public final List<Triple<String, Integer, Exp<?>>> decls;
public final List<Pair<String, String>> global_options;
public Function<Exp<?>, String> kind;
private final ParseTreeProperty<Exp<?>> exps;
private final ParseTreeProperty<RawTerm> terms;
public final Map<String, Exp<?>> ns = new HashMap<>();
/***************************************************
......@@ -84,6 +95,8 @@ public class AqlLoaderListener extends AqlParserBaseListener {
* Options section
* see AqlOptions.g4
*/
private final ParseTreeProperty<Pair<String,String>> value_option;
@Override public void exitOptionsDeclarationSection(AqlParser.OptionsDeclarationSectionContext ctx) {
for(final ParseTree child : ctx.optionsDeclaration() ) {
......@@ -378,6 +391,9 @@ public class AqlLoaderListener extends AqlParserBaseListener {
this.exps.put(ctx,exp);
}
private final ParseTreeProperty<Quad<String,String,RawTerm,RawTerm>> quads;
@Override public void exitSchemaExp_Literal(AqlParser.SchemaExp_LiteralContext ctx) {
final SchemaLiteralSectionContext
ctx_lit = ctx.schemaLiteralSection();
......@@ -417,8 +433,8 @@ public class AqlLoaderListener extends AqlParserBaseListener {
new Pair<>(
eq.getStart().getStartIndex(),
new Pair<>(
this.strList.get(eq.schemaPath(0)),
this.strList.get(eq.schemaPath(1)))))
this.terms.get(eq.schemaPath(0)).unpack(),
this.terms.get(eq.schemaPath(1)).unpack())))
.collect(Collectors.toList());
final List<Pair<LocStr, Pair<String, String>>>
......@@ -516,21 +532,24 @@ public class AqlLoaderListener extends AqlParserBaseListener {
}
@Override public void exitSchemaPath_ArrowId(AqlParser.SchemaPath_ArrowIdContext ctx) {
final List<String> path = new LinkedList<>();
path.add(ctx.schemaArrowId().getText());
this.strList.put(ctx,path);
final RawTerm term = new RawTerm(ctx.schemaArrowId().getText());
this.terms.put(ctx,term);
}
@Override public void exitSchemaPath_Dot(AqlParser.SchemaPath_DotContext ctx) {
final List<String> path = new LinkedList<>();
path.addAll(this.strList.get(ctx.schemaPath()));
path.add(ctx.schemaArrowId().getText());
this.strList.put(ctx,path);
final List<RawTerm> args = new LinkedList<>();
args.add(this.terms.get(ctx.schemaPath()));
final RawTerm term = new RawTerm(ctx.schemaArrowId().getText(), args);
this.terms.put(ctx,term);
}
@Override public void exitSchemaPath_Paren(AqlParser.SchemaPath_ParenContext ctx) {
final List<String> path = new LinkedList<>();
path.addAll(this.strList.get(ctx.schemaPath()));
path.add(ctx.schemaArrowId().getText());
this.strList.put(ctx,path);
final List<RawTerm> args = new LinkedList<>();
args.add(this.terms.get(ctx.schemaPath()));
final RawTerm term = new RawTerm(ctx.schemaArrowId().getText(), args);
this.terms.put(ctx,term);
}
......@@ -598,70 +617,38 @@ public class AqlLoaderListener extends AqlParserBaseListener {
// TODO
}
private final ParseTreeProperty<
Pair<LocStr, // old entity name/loc
Triple<String, // new entity name
List<Pair<LocStr, // old fk name/loc
List<String>>>, // new fk path (names)
List<Pair<LocStr, // old attr name/loc
Triple<String, // universal variable
String, // entity for universal variable
RawTerm>>>>>> // new path to attribute
mapping = new ParseTreeProperty<>();
@Override public void exitMappingExp_Literal(AqlParser.MappingExp_LiteralContext ctx) {
final MappingLiteralSectionContext
ctx_lit = ctx.mappingLiteralSection();
final SchExp<Ty, En, Sym, Fk, Att>
schemaSrc = new SchExp.SchExpVar<>(ctx.schemaRef(0).getText());
final SchExp<Ty, En, Sym, Fk, Att>
schemaTgt = new SchExp.SchExpVar<>(ctx.schemaRef(1).getText());
final TyExp<Ty, Sym>
typeside = new TyExp.TyExpVar<>(ctx.typesideKind().getText());
final MappingLiteralSectionContext
ctx_lit = ctx.mappingLiteralSection();
final List<LocStr>
imports = ctx_lit.typesideImport().stream()
.map(ty -> makeLocStr(ty))
imports = ctx_lit.mappingRef().stream()
.map(ref -> makeLocStr(ref))
.collect(Collectors.toList());
final List<LocStr>
entities = ctx_lit.mappingEntityId().stream()
.map(elt -> makeLocStr(elt))
.collect(Collectors.toList());
final List<Pair<LocStr, Pair<String, String>>>
arrows = ctx_lit.mappingForeignSig().stream()
.map(fk -> {
final Pair<String,String>
arrow = new Pair<>(
fk.MappingEntityId(0).getText(),
fk.MappingEntityId(1).getText());
return new LinkedList<>(
fk.MappingForeignId().stream()
.map(fkid -> new Pair<>(makeLocStr(fkid), arrow))
.collect(Collectors.toList()));
})
.flatMap(x -> x.stream())
.collect(Collectors.toList());
final List<Pair<Integer, Pair<List<String>, List<String>>>>
commutes = ctx_lit.mappingPathEqnSig().stream()
.map(eq ->
new Pair<>(
eq.getStart().getStartIndex(),
new Pair<>(
this.strList.get(eq.MappingPath(0)),
this.strList.get(eq.MappingPath(1)))))
.collect(Collectors.toList());
final List<Pair<LocStr, Pair<String, String>>>
attrs = ctx_lit.mappingAttributeSig().stream()
.map(att -> {
final Pair<String,String>
arrow = new Pair<>(
att.MappingEntityId().getText(),
att.typesideTypeId().getText());
return new LinkedList<>(
att.MappingAttributeId().stream()
.map(attid -> new Pair<>(makeLocStr(attid), arrow))
.collect(Collectors.toList()));
})
.flatMap(x -> x.stream())
.collect(Collectors.toList());
final List<Pair<Integer, Quad<String, String, RawTerm, RawTerm>>>
observes = ctx_lit.mappingObservationEquationSig().stream()
.map(obs ->
new Pair<>(obs.getStart().getStartIndex(),
this.quads.get(obs)))
final List<Pair<LocStr,
Triple<String,
List<Pair<LocStr, List<String>>>,
List<Pair<LocStr, Triple<String, String, RawTerm>>>>>>
entities = ctx_lit.mappingLiteralSubsection().stream()
.map(elt -> this.mapping.get(elt))
.collect(Collectors.toList());
final List<Pair<String, String>>
......@@ -671,14 +658,99 @@ public class AqlLoaderListener extends AqlParserBaseListener {
elt.getStop().getText()))
.collect(Collectors.toList());
final SchExpRaw mapping =
new SchExpRaw(typeside, imports,
entities, arrows, commutes, attrs, observes, options);
final MapExpRaw mapping = new MapExpRaw(schemaSrc, schemaTgt, imports, entities, options);
this.exps.put(ctx,mapping);
}
private final ParseTreeProperty<Triple<String,String,RawTerm>> mapped_terms;
@Override public void exitMappingLiteralSubsection(AqlParser.