Commit 91cc599d authored by Fred Eisele's avatar Fred Eisele
Browse files

all rawtypes removed, corrected toString, preparing to resolve uncheck casting warnings

parent fa1a714b
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/5sg/-ru88jt/AqlLexerRules.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql1/gen_src/catdata/aql/grammar/gg1/-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/5sg/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql1/gen_src/catdata/aql/grammar/gg1/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.ParserRuleContext;
......@@ -1175,18 +1175,6 @@ public class AqlParserBaseListener implements AqlParserListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSchemaExp_OfInstance(AqlParser.SchemaExp_OfInstanceContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx) { }
/**
* {@inheritDoc}
*
......@@ -4187,6 +4175,30 @@ public class AqlParserBaseListener implements AqlParserListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSchemaColimitQuotientSection(AqlParser.SchemaColimitQuotientSectionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScQuotientEqu(AqlParser.ScQuotientEquContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScQuotientEqu(AqlParser.ScQuotientEquContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx) { }
/**
* {@inheritDoc}
*
......@@ -4216,37 +4228,37 @@ public class AqlParserBaseListener implements AqlParserListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScEntityPath(AqlParser.ScEntityPathContext ctx) { }
@Override public void enterScGenType(AqlParser.ScGenTypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScEntityPath(AqlParser.ScEntityPathContext ctx) { }
@Override public void exitScGenType(AqlParser.ScGenTypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScFkPath(AqlParser.ScFkPathContext ctx) { }
@Override public void enterScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScFkPath(AqlParser.ScFkPathContext ctx) { }
@Override public void exitScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScAttrPath(AqlParser.ScAttrPathContext ctx) { }
@Override public void enterScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScAttrPath(AqlParser.ScAttrPathContext ctx) { }
@Override public void exitScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx) { }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/5sg/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql1/gen_src/catdata/aql/grammar/gg1/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
......@@ -690,13 +690,6 @@ public class AqlParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> impleme
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSchemaExp_OfInstance(AqlParser.SchemaExp_OfInstanceContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......@@ -2447,6 +2440,20 @@ public class AqlParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> impleme
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSchemaColimitQuotientSection(AqlParser.SchemaColimitQuotientSectionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitScQuotientEqu(AqlParser.ScQuotientEquContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......@@ -2467,21 +2474,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 visitScEntityPath(AqlParser.ScEntityPathContext ctx) { return visitChildren(ctx); }
@Override public T visitScGenType(AqlParser.ScGenTypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitScFkPath(AqlParser.ScFkPathContext ctx) { return visitChildren(ctx); }
@Override public T visitScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitScAttrPath(AqlParser.ScAttrPathContext ctx) { return visitChildren(ctx); }
@Override public T visitScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/5sg/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql1/gen_src/catdata/aql/grammar/gg1/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeListener;
......@@ -1033,18 +1033,6 @@ public interface AqlParserListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitSchemaExp_OfInstance(AqlParser.SchemaExp_OfInstanceContext ctx);
/**
* Enter a parse tree produced by the {@code SchemaExp_Destination}
* labeled alternative in {@link AqlParser#schemaExp}.
* @param ctx the parse tree
*/
void enterSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx);
/**
* Exit a parse tree produced by the {@code SchemaExp_Destination}
* labeled alternative in {@link AqlParser#schemaExp}.
* @param ctx the parse tree
*/
void exitSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx);
/**
* Enter a parse tree produced by the {@code SchemaExp_GetSchemaColimit}
* labeled alternative in {@link AqlParser#schemaExp}.
......@@ -3787,6 +3775,26 @@ public interface AqlParserListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitSchemaColimitQuotientSection(AqlParser.SchemaColimitQuotientSectionContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scQuotientEqu}.
* @param ctx the parse tree
*/
void enterScQuotientEqu(AqlParser.ScQuotientEquContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#scQuotientEqu}.
* @param ctx the parse tree
*/
void exitScQuotientEqu(AqlParser.ScQuotientEquContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scQuotientFkEqu}.
* @param ctx the parse tree
*/
void enterScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#scQuotientFkEqu}.
* @param ctx the parse tree
*/
void exitScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scObsEquation}.
* @param ctx the parse tree
......@@ -3808,35 +3816,39 @@ public interface AqlParserListener extends ParseTreeListener {
*/
void exitScGen(AqlParser.ScGenContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scEntityPath}.
* Enter a parse tree produced by {@link AqlParser#scGenType}.
* @param ctx the parse tree
*/
void enterScEntityPath(AqlParser.ScEntityPathContext ctx);
void enterScGenType(AqlParser.ScGenTypeContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#scEntityPath}.
* Exit a parse tree produced by {@link AqlParser#scGenType}.
* @param ctx the parse tree
*/
void exitScEntityPath(AqlParser.ScEntityPathContext ctx);
void exitScGenType(AqlParser.ScGenTypeContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scFkPath}.
* Enter a parse tree produced by the {@code ScTermPath_Dotted}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
*/
void enterScFkPath(AqlParser.ScFkPathContext ctx);
void enterScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#scFkPath}.
* Exit a parse tree produced by the {@code ScTermPath_Dotted}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
*/
void exitScFkPath(AqlParser.ScFkPathContext ctx);
void exitScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#scAttrPath}.
* Enter a parse tree produced by the {@code ScTermPath_Singular}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
*/
void enterScAttrPath(AqlParser.ScAttrPathContext ctx);
void enterScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx);
/**
* Exit a parse tree produced by {@link AqlParser#scAttrPath}.
* Exit a parse tree produced by the {@code ScTermPath_Singular}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
*/
void exitScAttrPath(AqlParser.ScAttrPathContext ctx);
void exitScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx);
/**
* Enter a parse tree produced by {@link AqlParser#schemaColimitModifySection}.
* @param ctx the parse tree
......
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql2/gen_src/catdata/aql/grammar/5sg/-ru88jt/AqlParser.g4 by ANTLR 4.7
// Generated from /home/fred/.boot/cache/tmp/home/fred/github/fql1/gen_src/catdata/aql/grammar/gg1/-ru88jt/AqlParser.g4 by ANTLR 4.7
package catdata.aql.grammar;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
......@@ -620,13 +620,6 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitSchemaExp_OfInstance(AqlParser.SchemaExp_OfInstanceContext ctx);
/**
* Visit a parse tree produced by the {@code SchemaExp_Destination}
* labeled alternative in {@link AqlParser#schemaExp}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaExp_Destination(AqlParser.SchemaExp_DestinationContext ctx);
/**
* Visit a parse tree produced by the {@code SchemaExp_GetSchemaColimit}
* labeled alternative in {@link AqlParser#schemaExp}.
......@@ -2248,6 +2241,18 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitSchemaColimitQuotientSection(AqlParser.SchemaColimitQuotientSectionContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scQuotientEqu}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScQuotientEqu(AqlParser.ScQuotientEquContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scQuotientFkEqu}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScQuotientFkEqu(AqlParser.ScQuotientFkEquContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scObsEquation}.
* @param ctx the parse tree
......@@ -2261,23 +2266,25 @@ public interface AqlParserVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitScGen(AqlParser.ScGenContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scEntityPath}.
* Visit a parse tree produced by {@link AqlParser#scGenType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScEntityPath(AqlParser.ScEntityPathContext ctx);
T visitScGenType(AqlParser.ScGenTypeContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scFkPath}.
* Visit a parse tree produced by the {@code ScTermPath_Dotted}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScFkPath(AqlParser.ScFkPathContext ctx);
T visitScTermPath_Dotted(AqlParser.ScTermPath_DottedContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#scAttrPath}.
* Visit a parse tree produced by the {@code ScTermPath_Singular}
* labeled alternative in {@link AqlParser#scTermPath}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScAttrPath(AqlParser.ScAttrPathContext ctx);
T visitScTermPath_Singular(AqlParser.ScTermPath_SingularContext ctx);
/**
* Visit a parse tree produced by {@link AqlParser#schemaColimitModifySection}.
* @param ctx the parse tree
......
......@@ -19,9 +19,6 @@ schemaExp
| SCHEMA_OF instanceKind
# SchemaExp_OfInstance
| DST queryRef
# SchemaExp_Destination
| GET_SCHEMA schemaColimitRef
# SchemaExp_GetSchemaColimit
......
......@@ -28,36 +28,31 @@ schemaColimitKind
;
schemaColimitQuotientSection
: (ENTITY_EQUATIONS (scEntityPath EQUAL scEntityPath)*)?
(PATH_EQUATIONS (scFkPath EQUAL scFkPath)*)?
: (ENTITY_EQUATIONS scQuotientEqu*)?
(PATH_EQUATIONS scQuotientFkEqu*)?
(OBSERVATION_EQUATIONS scObsEquation* )?
allOptions
;
scObsEquation
: FORALL scGen (COMMA scGen)* DOT scEntityPath EQUAL scEntityPath
;
scGen : symbol ;
scQuotientEqu : scTermPath EQUAL scTermPath ;
scQuotientFkEqu : scTermPath EQUAL scTermPath ;
scEntityPath
: schemaRef DOT schemaTermId
| schemaTermId
scObsEquation
: FORALL scGen DOT scTermPath EQUAL scTermPath
;
scFkPath
: schemaRef DOT schemaTermId
| schemaTermId
;
scGen : symbol (COLON scGenType)? ;
scGenType : symbol ;
scAttrPath
: schemaRef DOT schemaTermId
| schemaTermId
scTermPath
: schemaRef DOT schemaTermId # ScTermPath_Dotted
| schemaTermId # ScTermPath_Singular
;
schemaColimitModifySection
: (RENAME ENTITIES (scEntityPath RARROW scEntityPath)*)?
(RENAME FOREIGN_KEYS (scFkPath RARROW scFkPath)*)?
(RENAME ATTRIBUTES (scAttrPath RARROW scAttrPath)*)?
(REMOVE FOREIGN_KEYS (scFkPath RARROW scFkPath)*)?
(REMOVE ATTRIBUTES (scAttrPath RARROW scAttrPath)*)?
: (RENAME ENTITIES (scTermPath RARROW scTermPath)*)?
(RENAME FOREIGN_KEYS (scTermPath RARROW scTermPath)*)?
(RENAME ATTRIBUTES (scTermPath RARROW scTermPath)*)?
(REMOVE FOREIGN_KEYS (scTermPath RARROW scTermPath)*)?
(REMOVE ATTRIBUTES (scTermPath RARROW scTermPath)*)?
;
......@@ -73,6 +73,21 @@ public final class RawTerm {
return ls;
}
/**
* Grab the element from the RawTerm.
* @param primary the depth into the term
* @param secondary the width to the node
* @return a String representing the value of the node. null if not present.
*/
public String byIndex(final int ...ixs) {
RawTerm term = this;
for (int ix : ixs) {
if (ix >= term.args.size()) return null;
term = term.args.get(ix);
}
return term.head;
}
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,
Map<Var, Chc<Ty, En>> vars) {
......
This diff is collapsed.
......@@ -130,62 +130,38 @@ public abstract class ColimSchExp<N> extends Exp<ColimitSchema<N>> {
return RawTerm.fold(l, "_v0");
}
private String toString;
@Override
public synchronized String toString() {
if (toString != null) {
return toString;
}
toString = "";
List<String> temp = new LinkedList<>();
final StringBuilder sb = new StringBuilder();
if (!eqEn.isEmpty()) {
toString += "\tentity_equations";
for (Quad<N, En, N, En> x : eqEn) {
temp.add(x.first + "." + x.second + " = " + x.third + "." + x.fourth);
sb.append("\tentity_equations")
.append(this.eqEn.stream()
.map(x -> x.first + "." + x.second + " = " + x.third + "." + x.fourth)
.collect(Collectors.joining("\n\t\t","\n\t\t","\n")));
}
toString += "\n\t\t" + Util.sep(temp, "\n\t\t") + "\n";
}
if (!eqTerms2.isEmpty()) {
toString += "\tpath_equations";
for (Pair<List<String>, List<String>> x : eqTerms2) {
temp.add(Util.sep(x.first, ".") + " = " + Util.sep(x.second, "."));
sb.append("\tpath_equations")
.append(this.eqTerms2.stream()
.map(x -> Util.sep(x.first, ".") + " = " + Util.sep(x.second, "."))
.collect(Collectors.joining("\n\t\t","\n\t\t","\n")));
}
toString += "\n\t\t" + Util.sep(temp, "\n\t\t") + "\n";
}
if (!eqTerms.isEmpty()) {
toString += "\tobservation_equations";
for (Quad<String, String, RawTerm, RawTerm> x : eqTerms) {
temp.add("forall " + x.first + ". " + x.third + " = " + x.fourth);
sb.append("\tobservation_equations")
.append(this.eqTerms.stream()
.map(x -> "forall " + x.first + ". " + x.third + " = " + x.fourth)
.collect(Collectors.joining("\n\t\t","\n\t\t","\n")));
}
toString += "\n\t\t" + Util.sep(temp, "\n\t\t") + "\n";
}
if (!options.isEmpty()) {
toString += "\toptions";
temp = new LinkedList<>();
for (Entry<String, String> sym : options.entrySet()) {
temp.add(sym.getKey() + " = " + sym.getValue());
}
toString += "\n\t\t" + Util.sep(temp, "\n\t\t") + "\n";
sb.append("\toptions")
.append(this.options.entrySet().stream()
.map(sym -> sym.getKey() + " = " + sym.getValue())
.collect(Collectors.joining("\n\t\t","\n\t\t","\n")));
}
if (eqEn.isEmpty() && eqTerms.isEmpty() && eqTerms2.isEmpty()) {
toString = "coproduct " + Util.sep(nodes.keySet(), " + "); // + " {\n" + toString + "\n}";
return toString;
return "coproduct " + Util.sep(nodes.keySet(), " + ");
} else {
toString = "quotient " + Util.sep(nodes.keySet(), " + ") + " {\n" + toString + "\n}";
return toString;
return "quotient " + Util.sep(nodes.keySet(), " + ") + " {\n" + sb.toString() + "\n}";
}
}
......@@ -595,4 +571,4 @@ public abstract class ColimSchExp<N> extends Exp<ColimitSchema<N>> {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment