Added control constructs to expression language.

Fixed bugs in multi-value cell split/join operations.
Condensed movies-condensed.tsv test data further.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@45 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-02-05 08:39:10 +00:00
parent 937d91ab1d
commit 8444136be1
15 changed files with 302 additions and 79 deletions

View File

@ -0,0 +1,7 @@
package com.metaweb.gridworks.expr;
import java.util.Properties;
public interface Control {
public Object call(Properties bindings, Evaluable[] args);
}

View File

@ -0,0 +1,32 @@
package com.metaweb.gridworks.expr;
import java.util.Properties;
public class ControlCallExpr implements Evaluable {
final protected Evaluable[] _args;
final protected Control _control;
public ControlCallExpr(Evaluable[] args, Control c) {
_args = args;
_control = c;
}
@Override
public Object evaluate(Properties bindings) {
return _control.call(bindings, _args);
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
for (Evaluable ev : _args) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(ev.toString());
}
return _control.getClass().getSimpleName() + "(" + sb.toString() + ")";
}
}

View File

@ -25,4 +25,15 @@ public class ExpressionUtils {
bindings.put("cell", cell); bindings.put("cell", cell);
bindings.put("value", cell.value); bindings.put("value", cell.value);
} }
static public boolean isBlank(Object o) {
return o == null || (o instanceof String && ((String) o).isEmpty());
}
static public boolean isTrue(Object o) {
return o != null &&
(o instanceof Boolean ?
((Boolean) o).booleanValue() :
Boolean.parseBoolean(o.toString()));
}
} }

View File

@ -8,8 +8,13 @@ import java.util.Map;
import com.metaweb.gridworks.expr.Scanner.NumberToken; import com.metaweb.gridworks.expr.Scanner.NumberToken;
import com.metaweb.gridworks.expr.Scanner.Token; import com.metaweb.gridworks.expr.Scanner.Token;
import com.metaweb.gridworks.expr.Scanner.TokenType; import com.metaweb.gridworks.expr.Scanner.TokenType;
import com.metaweb.gridworks.expr.controls.ForEach;
import com.metaweb.gridworks.expr.controls.ForNonBlank;
import com.metaweb.gridworks.expr.controls.If;
import com.metaweb.gridworks.expr.functions.And; import com.metaweb.gridworks.expr.functions.And;
import com.metaweb.gridworks.expr.functions.Get; import com.metaweb.gridworks.expr.functions.Get;
import com.metaweb.gridworks.expr.functions.IsBlank;
import com.metaweb.gridworks.expr.functions.IsNotBlank;
import com.metaweb.gridworks.expr.functions.IsNotNull; import com.metaweb.gridworks.expr.functions.IsNotNull;
import com.metaweb.gridworks.expr.functions.IsNull; import com.metaweb.gridworks.expr.functions.IsNull;
import com.metaweb.gridworks.expr.functions.Not; import com.metaweb.gridworks.expr.functions.Not;
@ -27,6 +32,8 @@ public class Parser {
protected Evaluable _root; protected Evaluable _root;
static public Map<String, Function> functionTable = new HashMap<String, Function>(); static public Map<String, Function> functionTable = new HashMap<String, Function>();
static public Map<String, Control> controlTable = new HashMap<String, Control>();
static { static {
functionTable.put("toUppercase", new ToUppercase()); functionTable.put("toUppercase", new ToUppercase());
functionTable.put("toLowercase", new ToLowercase()); functionTable.put("toLowercase", new ToLowercase());
@ -43,7 +50,13 @@ public class Parser {
functionTable.put("not", new Not()); functionTable.put("not", new Not());
functionTable.put("isNull", new IsNull()); functionTable.put("isNull", new IsNull());
functionTable.put("isNotNull", new IsNotNull()); functionTable.put("isNotNull", new IsNotNull());
} functionTable.put("isBlank", new IsBlank());
functionTable.put("isNotBlank", new IsNotBlank());
controlTable.put("if", new If());
controlTable.put("forEach", new ForEach());
controlTable.put("forNonBlank", new ForNonBlank());
}
public Parser(String s) throws Exception { public Parser(String s) throws Exception {
this(s, 0, s.length()); this(s, 0, s.length());
@ -157,15 +170,20 @@ public class Parser {
eval = new VariableExpr(text); eval = new VariableExpr(text);
} else { } else {
Function f = functionTable.get(text); Function f = functionTable.get(text);
if (f == null) { Control c = controlTable.get(text);
throw makeException("Unknown function " + text); if (f == null && c == null) {
throw makeException("Unknown function or control named " + text);
} }
next(); // swallow ( next(); // swallow (
List<Evaluable> args = parseExpressionList(")"); List<Evaluable> args = parseExpressionList(")");
eval = new FunctionCallExpr(makeArray(args), f); if (c != null) {
eval = new ControlCallExpr(makeArray(args), c);
} else {
eval = new FunctionCallExpr(makeArray(args), f);
}
} }
} else if (_token.type == TokenType.Delimiter && _token.text.equals("(")) { } else if (_token.type == TokenType.Delimiter && _token.text.equals("(")) {
next(); next();

View File

@ -18,4 +18,8 @@ public class VariableExpr implements Evaluable {
public String toString() { public String toString() {
return _name; return _name;
} }
public String getName() {
return _name;
}
} }

View File

@ -0,0 +1,50 @@
package com.metaweb.gridworks.expr.controls;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import com.metaweb.gridworks.expr.Control;
import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.VariableExpr;
public class ForEach implements Control {
@Override
public Object call(Properties bindings, Evaluable[] args) {
if (args.length >= 3) {
Object o = args[0].evaluate(bindings);
Evaluable var = args[1];
String name = (var instanceof VariableExpr) ? ((VariableExpr) var).getName() :
((String) var.evaluate(bindings));
if (o != null) {
Object oldValue = bindings.get(name);
try {
Object[] values;
if (o.getClass().isArray()) {
values = (Object[]) o;
} else {
values = new Object[] { o };
}
List<Object> results = new ArrayList<Object>(values.length);
for (Object v : values) {
bindings.put(name, v);
Object r = args[2].evaluate(bindings);
if (r != null) {
results.add(r);
}
}
return results.toArray();
} finally {
bindings.put(name, oldValue);
}
}
}
return null;
}
}

View File

@ -0,0 +1,40 @@
package com.metaweb.gridworks.expr.controls;
import java.util.Properties;
import com.metaweb.gridworks.expr.Control;
import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.expr.VariableExpr;
public class ForNonBlank implements Control {
@Override
public Object call(Properties bindings, Evaluable[] args) {
if (args.length >= 3) {
Object o = args[0].evaluate(bindings);
Evaluable var = args[1];
String name = (var instanceof VariableExpr) ? ((VariableExpr) var).getName() :
((String) var.evaluate(bindings));
if (!ExpressionUtils.isBlank(o)) {
Object oldValue = bindings.containsKey(name) ? bindings.get(name) : null;
bindings.put(name, o);
try {
return args[2].evaluate(bindings);
} finally {
if (oldValue != null) {
bindings.put(name, oldValue);
} else {
bindings.remove(name);
}
}
} else if (args.length >= 4) {
return args[3].evaluate(bindings);
}
}
return null;
}
}

View File

@ -0,0 +1,25 @@
package com.metaweb.gridworks.expr.controls;
import java.util.Properties;
import com.metaweb.gridworks.expr.Control;
import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils;
public class If implements Control {
@Override
public Object call(Properties bindings, Evaluable[] args) {
if (args.length >= 3) {
Object o = args[0].evaluate(bindings);
if (ExpressionUtils.isTrue(o)) {
return args[1].evaluate(bindings);
} else if (args.length >= 3) {
return args[2].evaluate(bindings);
}
}
return null;
}
}

View File

@ -3,6 +3,7 @@ package com.metaweb.gridworks.expr.functions;
import java.util.Properties; import java.util.Properties;
import com.metaweb.gridworks.expr.Function; import com.metaweb.gridworks.expr.Function;
import com.metaweb.gridworks.expr.HasFields;
public class Get implements Function { public class Get implements Function {
@ -13,52 +14,60 @@ public class Get implements Function {
Object from = args[1]; Object from = args[1];
Object to = args.length == 3 ? args[2] : null; Object to = args.length == 3 ? args[2] : null;
if (v != null && from != null && from instanceof Number && (to == null || to instanceof Number)) { if (v != null && from != null) {
if (v.getClass().isArray()) { if (v instanceof HasFields) {
Object[] a = (Object[]) v; if (from instanceof String) {
int start = ((Number) from).intValue(); return ((HasFields) v).getField((String) from, bindings);
if (start < 0) { }
start = a.length + start; } else {
} if (from instanceof Number && (to == null || to instanceof Number)) {
start = Math.min(a.length, Math.max(0, start)); if (v.getClass().isArray()) {
Object[] a = (Object[]) v;
int start = ((Number) from).intValue();
if (start < 0) {
start = a.length + start;
}
start = Math.min(a.length, Math.max(0, start));
if (to == null) { if (to == null) {
return a[start]; return a[start];
} else { } else {
int end = to != null && to instanceof Number ? int end = to != null && to instanceof Number ?
((Number) to).intValue() : a.length; ((Number) to).intValue() : a.length;
if (end < 0) { if (end < 0) {
end = a.length - end; end = a.length - end;
} }
end = Math.min(a.length, Math.max(start, end)); end = Math.min(a.length, Math.max(start, end));
Object[] a2 = new Object[end - start]; Object[] a2 = new Object[end - start];
System.arraycopy(a, start, a2, 0, end - start); System.arraycopy(a, start, a2, 0, end - start);
return a2; return a2;
} }
} else { } else {
String s = (v instanceof String ? (String) v : v.toString()); String s = (v instanceof String ? (String) v : v.toString());
int start = ((Number) from).intValue(); int start = ((Number) from).intValue();
if (start < 0) { if (start < 0) {
start = s.length() + start; start = s.length() + start;
} }
start = Math.min(s.length(), Math.max(0, start)); start = Math.min(s.length(), Math.max(0, start));
if (to != null && to instanceof Number) { if (to != null && to instanceof Number) {
int end = ((Number) to).intValue(); int end = ((Number) to).intValue();
if (end < 0) { if (end < 0) {
end = s.length() - end; end = s.length() - end;
} }
end = Math.min(s.length(), Math.max(start, end)); end = Math.min(s.length(), Math.max(start, end));
return s.substring(start, end); return s.substring(start, end);
} else { } else {
return s.substring(start, start + 1); return s.substring(start, start + 1);
} }
} }
}
}
} }
} }
return null; return null;

View File

@ -0,0 +1,15 @@
package com.metaweb.gridworks.expr.functions;
import java.util.Properties;
import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.expr.Function;
public class IsBlank implements Function {
@Override
public Object call(Properties bindings, Object[] args) {
return args.length == 0 || ExpressionUtils.isBlank(args[0]);
}
}

View File

@ -0,0 +1,15 @@
package com.metaweb.gridworks.expr.functions;
import java.util.Properties;
import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.expr.Function;
public class IsNotBlank implements Function {
@Override
public Object call(Properties bindings, Object[] args) {
return args.length > 0 && !ExpressionUtils.isBlank(args[0]);
}
}

View File

@ -99,7 +99,8 @@ public class Row implements Serializable, HasFields, Jsonizable {
Project project = (Project) bindings.get("project"); Project project = (Project) bindings.get("project");
Column column = project.columnModel.getColumnByName(name); Column column = project.columnModel.getColumnByName(name);
if (column != null) { if (column != null) {
return cells.get(column.getCellIndex()); int cellIndex = column.getCellIndex();
return getCell(cellIndex);
} }
return null; return null;
} }

View File

@ -39,7 +39,7 @@ public class MultiValueCellJoinOperation implements AbstractOperation {
public Process createProcess(Project project, Properties options) public Process createProcess(Project project, Properties options)
throws Exception { throws Exception {
Column column = project.columnModel.columns.get(_cellIndex); Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
if (column == null) { if (column == null) {
throw new Exception("No column corresponding to cell index " + _cellIndex); throw new Exception("No column corresponding to cell index " + _cellIndex);
} }

View File

@ -43,7 +43,7 @@ public class MultiValueCellSplitOperation implements AbstractOperation {
public Process createProcess(Project project, Properties options) public Process createProcess(Project project, Properties options)
throws Exception { throws Exception {
Column column = project.columnModel.columns.get(_cellIndex); Column column = project.columnModel.getColumnByCellIndex(_cellIndex);
if (column == null) { if (column == null) {
throw new Exception("No column corresponding to cell index " + _cellIndex); throw new Exception("No column corresponding to cell index " + _cellIndex);
} }

View File

@ -1,25 +1,21 @@
name Directed by Performances - Actor Performances - Character Estimated budget - Currency Estimated budget - Amount Genres Initial release date Languages name Directed by Performances Estimated budget - Currency Estimated budget - Amount Genres Initial release date Languages
Wayne's World Penelope Spheeris Mike Myers, Dana Carvey, Rob Lowe, Tia Carrere, Lara Flynn Boyle, Chris Farley, Ed O'Neill, Robert Patrick, Alice Cooper Wayne Campbell, Garth Algar, Stacy US$ 20000000 Comedy, Satire, Buddy film 2/14/1992 English Language Wayne's World Penelope Spheeris Mike Myers (Wayne Campbell), Dana Carvey (Garth Algar), Rob Lowe, Tia Carrere, Lara Flynn Boyle (Stacy), Chris Farley, Ed O'Neill, Robert Patrick, Alice Cooper US$ 20000000 Comedy, Satire, Buddy film 2/14/1992 English Language
Wayne's World 2 Stephen Surjik Mike Myers, Dana Carvey, Christopher Walken, Tia Carrere, Chris Farley, Ted McGinley, Olivia d'Abo, Kevin Pollak, Ed O'Neill, Kim Basinger, Heather Locklear Wayne Campbell, Garth Algar Comedy, Buddy film 12/10/1993 English Language Wayne's World 2 Stephen Surjik Mike Myers (Wayne Campbell), Dana Carvey (Garth Algar), Christopher Walken, Tia Carrere, Chris Farley, Ted McGinley, Olivia d'Abo, Kevin Pollak, Ed O'Neill, Kim Basinger, Heather Locklear Comedy, Buddy film 12/10/1993 English Language
Austin Powers: Goldmember Jay Roach Mike Myers, BeyoncÈ, Seth Green, Michael York, Robert Wagner, Michael Caine, Verne Troyer, Gwyneth Paltrow, Fred Savage, Aaron Himelstein, Mindy Sterling, Josh Zuckerman, Greg Grunberg, Tommy 'Tiny' Lister, Rob Lowe, Masi Oka, Nikki Schieler Ziering, Britney Spears, Tom Cruise, John Travolta, Danny DeVito, Katie Couric, Steven Spielberg Austin Powers, Foxxy Cleopatra, Scott Evil, Dixie Normous, Him/Herself, Prison Guard Parody, Time travel, Comedy 7/26/2002 English Language Austin Powers: Goldmember Jay Roach Mike Myers (Austin Powers), BeyoncÈ (Foxxy Cleopatra), Seth Green (Scott Evil), Michael York, Robert Wagner, Michael Caine, Verne Troyer, Gwyneth Paltrow (Dixie Normous), Fred Savage, Aaron Himelstein, Mindy Sterling, Josh Zuckerman, Greg Grunberg, Tommy 'Tiny' Lister, Rob Lowe, Masi Oka, Nikki Schieler Ziering, Britney Spears, Tom Cruise (Him/Herself), John Travolta, Danny DeVito, Katie Couric (Prison Guard), Steven Spielberg Parody, Time travel, Comedy 7/26/2002 English Language
Austin Powers: International Man of Mystery Jay Roach Mike Myers, Elizabeth Hurley, Michael York, Mimi Rogers, Robert Wagner, Patrick Bristow, Fabiana Udenio, Elya Baskin, Paul Dillon, Lois Chiles, Christian Slater, Brian George, Cynthia Lamontagne, Cindy Margolis, Mindy Sterling, Joe Son Austin Powers, Fembot Parody, Time travel, Comedy 5/2/1997 English Language Austin Powers: International Man of Mystery Jay Roach Mike Myers (Austin Powers), Elizabeth Hurley, Michael York, Mimi Rogers, Robert Wagner, Patrick Bristow, Fabiana Udenio, Elya Baskin, Paul Dillon, Lois Chiles, Christian Slater, Brian George, Cynthia Lamontagne, Cindy Margolis (Fembot), Mindy Sterling, Joe Son Parody, Time travel, Comedy 5/2/1997 English Language
So I Married an Axe Murderer Thomas Schlamme Mike Myers, Nancy Travis, Anthony LaPaglia, Amanda Plummer, Brenda Fricker, Michael G. Hagerty, Luenell, Debi Mazar, Matt Doherty, Steven Wright, Charles Grodin, Patrick Bristow, Phil Hartman, Cintra Wilson, Michael Richards, Sheila Kelley, Alan Arkin, M. C. Brennan, Holly Lewis Police Records Officer Comedy 7/30/1993 English Language So I Married an Axe Murderer Thomas Schlamme Mike Myers, Nancy Travis, Anthony LaPaglia, Amanda Plummer, Brenda Fricker, Michael G. Hagerty, Luenell (Police Records Officer), Debi Mazar, Matt Doherty, Steven Wright, Charles Grodin, Patrick Bristow, Phil Hartman, Cintra Wilson, Michael Richards, Sheila Kelley, Alan Arkin, M. C. Brennan, Holly Lewis Comedy 7/30/1993 English Language
Austin Powers: The Spy Who Shagged Me Jay Roach, Mike Myers, Heather Graham, Robert Wagner, Rob Lowe, Michael York, Verne Troyer, David Koechner, Muse Watson, Michael G. Hagerty, Kristen Johnston, Mindy Sterling, Gia Carides, Will Ferrell, Bree Turner, Scott Cooper Austin Powers, Parody, Comedy, Time travel 6/11/1999 English Language Austin Powers: The Spy Who Shagged Me Jay Roach Mike Myers (Austin Powers), Heather Graham, Robert Wagner, Rob Lowe, Michael York, Verne Troyer, David Koechner, Muse Watson, Michael G. Hagerty, Kristen Johnston, Mindy Sterling, Gia Carides, Will Ferrell, Bree Turner, Scott Cooper Parody, Comedy, Time travel 6/11/1999 English Language, German Language
German Language Shrek 2 Andrew Adamson, Kelly Asbury, Conrad Vernon John Lithgow (Lord Farquaad), Mike Myers (Shrek), Eddie Murphy (Donkey), Cameron Diaz (Princess Fiona), Julie Andrews (Queen), Antonio Banderas (Puss in Boots), John Cleese (King), Rupert Everett (Prince Charming), Jennifer Saunders (Fairy Godmother), Aron Warner (Wolf), Kelly Asbury (Page), Cody Cameron (Pinocchio), Conrad Vernon (Gingerbread Man), Christopher Knights (Blind Mouse), Mark Moseley (Mirror) US$ 125000000 Comedy, Computer animation, Fantasy 5/19/2004 English Language
Shrek 2 Andrew Adamson, Kelly Asbury, Conrad Vernon John Lithgow, Mike Myers, Eddie Murphy, Cameron Diaz, Julie Andrews, Antonio Banderas, John Cleese, Rupert Everett, Jennifer Saunders, Aron Warner, Kelly Asbury, Cody Cameron, Conrad Vernon, Christopher Knights, Mark Moseley Lord Farquaad, Shrek, Donkey, Princess Fiona, Queen, Puss in Boots, King, Prince Charming, Fairy Godmother, Wolf, Page, Pinocchio, Gingerbread Man, Blind Mouse, Mirror US$ 125000000 Comedy, Computer animation, Fantasy 5/19/2004 English Language Inglourious Basterds Quentin Tarantino, Mark Christopher Brad Pitt (Lt. Aldo Raine), Mike Myers (General Ed French), Diane Kruger (Bridget von Hammersmark), Daniel Br¸hl (Frederick Zoller), Til Schweiger (Sgt. Hugo Stiglitz), B. J. Novak (PFC Utivich), Michael Fassbender (Lt. Archie Hicox), Julie Dreyfus (Francesca Mondino), Maggie Cheung (Madame Mimieux), Rod Taylor (Winston Churchhill), Gedeon Burkhard, Christian Berkel (Eric the Barkeeper), Samuel L. Jackson, Samm Levine (PFC Hirschberg), Cloris Leachman (Mrs. Himmelstein), Christoph Waltz (Colonel Hans Landa), Ludger Pistor, Omar Doom (PFC Omar Ulmer), Jana Pallaske, Enzo G. Castellari, Jacky Ido, Eli Roth, MÈlanie Laurent, Ryan Phillippe (Shane O'Shea), Salma Hayek (Anita Randazzo), Neve Campbell (Julie Black), Mike Myers (Steve Rubell), Sela Ward (Billie Auster), Breckin Meyer (Greg Randazzo), Sherry Stringfield (Viv), Ellen Albertini Dow (Disco Dottie), Cameron Mathison (Atlanta), Noam Jenkins (Romeo), Jay Goede (Buck), Patrick Taylor (Tarzan), Heather Matarazzo (Grace O'Shea), Heidi Klum (VIP Patron), Mark Ruffalo, Lauren Hutton, Skipp Sudduth, Michael York US$ 70000000 War, Adventure, Action, Black comedy, LGBT, Drama 8/21/2009 English Language, German Language, French Language, Italian Language, English Language
Inglourious Basterds Quentin Tarantino, , , , Mark Christopher Brad Pitt, Mike Myers, Diane Kruger, Daniel Br¸hl, Til Schweiger, B. J. Novak, Michael Fassbender, Julie Dreyfus, Maggie Cheung, Rod Taylor, Gedeon Burkhard, Christian Berkel, Samuel L. Jackson, Samm Levine, Cloris Leachman, Christoph Waltz, Ludger Pistor, Omar Doom, Jana Pallaske, Enzo G. Castellari, Jacky Ido, Eli Roth, MÈlanie Laurent, Ryan Phillippe, Salma Hayek, Neve Campbell, Mike Myers, Sela Ward, Breckin Meyer, Sherry Stringfield, Ellen Albertini Dow, Cameron Mathison, Noam Jenkins, Jay Goede, Patrick Taylor, Heather Matarazzo, Heidi Klum, Mark Ruffalo, Lauren Hutton, Skipp Sudduth, Michael York Lt. Aldo Raine, General Ed French, Bridget von Hammersmark, Frederick Zoller, Sgt. Hugo Stiglitz, PFC Utivich, Lt. Archie Hicox, Francesca Mondino, Madame Mimieux, Winston Churchhill, Eric the Barkeeper, PFC Hirschberg, Mrs. Himmelstein, Colonel Hans Landa, PFC Omar Ulmer, Shane O'Shea, Anita Randazzo, Julie Black, Steve Rubell, Billie Auster, Greg Randazzo, Viv, Disco Dottie, Atlanta, Romeo, Buck, Tarzan, Grace O'Shea, VIP Patron US$ 70000000 War, Adventure, Action, Black comedy, LGBT, Drama 8/21/2009 English Language 54 US$ 18000000 8/28/1998
German Language Shrek the Third Raman Hui, Chris Miller, Raman Hui Mike Myers (Shrek), Cameron Diaz (Princess Fiona), Eddie Murphy, Antonio Banderas, Julie Andrews, John Cleese, Rupert Everett, Justin Timberlake (Artie), Regis Philbin, Seth Rogen (Ship Captain), Eric Idle, Cheri Oteri, Edison Chen Comedy, Computer animation, Fantasy 5/18/2007 English Language
French Language View from the Top Bruno Barreto Gwyneth Paltrow (Donna Jensen), Christina Applegate, Mark Ruffalo, Candice Bergen, Joshua Malina, Kelly Preston, Mike Myers, Rob Lowe, Marc Blucas Romantic comedy, Comedy 3/21/2003 English Language
Italian Language Pete's Meteor Brenda Fricker, Mike Myers Drama 1998
54 US$ 18000000 8/28/1998 English Language The Cat in the Hat Bo Welch Mike Myers (The Cat in the Hat), Alec Baldwin (Larry Quinn), Kelly Preston (Joan Walden), Dakota Fanning (Sally Walden), Spencer Breslin (Conrad Walden), Amy Hill, Sean Hayes (The Fish) US$ 109000000 Musical, Fantasy 11/21/2003 English Language
Shrek the Third Raman Hui, Chris Miller, Raman Hui Mike Myers, Cameron Diaz, Eddie Murphy, Antonio Banderas, Julie Andrews, John Cleese, Rupert Everett, Justin Timberlake, Regis Philbin, Seth Rogen, Eric Idle, Cheri Oteri, Edison Chen Shrek, Princess Fiona, , Artie, Ship Captain Comedy, Computer animation, Fantasy 5/18/2007 English Language Shrek Andrew Adamson, Vicky Jenson Mike Myers (Shrek), Eddie Murphy (Donkey), Cameron Diaz (Princess Fiona), John Lithgow (Lord Farquaad), Chris Farley, Conrad Vernon, Vincent Cassel, Val Bettin, Christopher Knights US$ 60000000 Parody, Computer animation, Comedy, Fantasy 5/18/2001 English Language
View from the Top Bruno Barreto Gwyneth Paltrow, Christina Applegate, Mark Ruffalo, Candice Bergen, Joshua Malina, Kelly Preston, Mike Myers, Rob Lowe, Marc Blucas Donna Jensen Romantic comedy, Comedy 3/21/2003 English Language The Thin Pink Line Joe Dietl, Michael Irpino Laura Kightlinger, Janeane Garofalo (Joyce Wintergarden-Dingle), Margaret Cho, Jennifer Aniston (Clove), David Schwimmer, Mike Myers, Will Ferrell Satire, Indie, Comedy 1998 English Language
Pete's Meteor Brenda Fricker, Mike Myers Drama 1998 Shrek the Halls Gary Trousdale Eddie Murphy, Antonio Banderas, Cameron Diaz (Princess Fiona), Mike Myers, Aron Warner, Conrad Vernon, Christopher Knights, Marissa Jaret Winokur Animation, Fantasy, Short film, Adventure, Comedy 11/28/2007 English Language
The Cat in the Hat Bo Welch Mike Myers, Alec Baldwin, Kelly Preston, Dakota Fanning, Spencer Breslin, Amy Hill, Sean Hayes The Cat in the Hat, Larry Quinn, Joan Walden, Sally Walden, Conrad Walden, The Fish US$ 109000000 Musical, Fantasy 11/21/2003 English Language Shrek Ever After Mike Mitchell, Mike Mitchell Cameron Diaz (Princess Fiona), Eric Idle (Merlin), Antonio Banderas (Puss in Boots), Eddie Murphy (Donkey), Justin Timberlake (Arthur Pendragon), Julie Andrews (Queen Lillian), Mike Myers (Shrek), Paul McCartney (Rumpelstiltskin), Larry King (Doris the Ugly Stepsister) Comedy, Computer animation, Fantasy 5/21/2010 English Language
Shrek Andrew Adamson, Vicky Jenson Mike Myers, Eddie Murphy, Cameron Diaz, John Lithgow, Chris Farley, Conrad Vernon, Vincent Cassel, Val Bettin, Christopher Knights Shrek, Donkey, Princess Fiona, Lord Farquaad US$ 60000000 Parody, Computer animation, Comedy, Fantasy 5/18/2001 English Language The Love Guru Mike Myers (Maurice Pitka), Jessica Alba (Jane Bullard), Justin Timberlake (Jacques Grande), Romany Malco (Darren Roanoke), Jessica Simpson, Ben Kingsley, Verne Troyer US$ 62000000 Comedy 6/20/2008 English Language
The Thin Pink Line Joe Dietl, Michael Irpino Laura Kightlinger, Janeane Garofalo, Margaret Cho, Jennifer Aniston, David Schwimmer, Mike Myers, Will Ferrell Joyce Wintergarden-Dingle, Clove Satire, Indie, Comedy 1998 English Language Shrek Goes Fourth Cameron Diaz (Princess Fiona), Antonio Banderas (Puss in Boots), Eddie Murphy (Donkey), Mike Myers (Shrek) Computer animation
Shrek the Halls Gary Trousdale Eddie Murphy, Antonio Banderas, Cameron Diaz, Mike Myers, Aron Warner, Conrad Vernon, Christopher Knights, Marissa Jaret Winokur Princess Fiona Animation, Fantasy, Short film, Adventure, Comedy 11/28/2007 English Language View from the top Bruno Barreto Gwyneth Paltrow, Mike Myers, Rob Lowe, Christina Applegate, Kelly Preston, Candice Bergen, Mark Ruffalo, Joshua Malina Romantic comedy 3/21/2003 English Language
Shrek Ever After Mike Mitchell, Mike Mitchell Cameron Diaz, Eric Idle, Antonio Banderas, Eddie Murphy, Justin Timberlake, Julie Andrews, Mike Myers, Paul McCartney, Larry King Princess Fiona, Merlin, Puss in Boots, Donkey, Arthur Pendragon, Queen Lillian, Shrek, Rumpelstiltskin, Doris the Ugly Stepsister Comedy, Computer animation, Fantasy 5/21/2010 English Language
The Love Guru Mike Myers, Jessica Alba, Justin Timberlake, Romany Malco, Jessica Simpson, Ben Kingsley, Verne Troyer Maurice Pitka, Jane Bullard, Jacques Grande, Darren Roanoke US$ 62000000 Comedy 6/20/2008 English Language
Shrek Goes Fourth Cameron Diaz, Antonio Banderas, Eddie Murphy, Mike Myers Princess Fiona, Puss in Boots, Donkey, Shrek Computer animation
View from the top Bruno Barreto Gwyneth Paltrow, Mike Myers, Rob Lowe, Christina Applegate, Kelly Preston, Candice Bergen, Mark Ruffalo, Joshua Malina Romantic comedy 3/21/2003 English Language

1 name Directed by Performances - Actor Performances Performances - Character Estimated budget - Currency Estimated budget - Amount Genres Initial release date Languages
2 Wayne's World Penelope Spheeris Mike Myers, Dana Carvey, Rob Lowe, Tia Carrere, Lara Flynn Boyle, Chris Farley, Ed O'Neill, Robert Patrick, Alice Cooper Mike Myers (Wayne Campbell), Dana Carvey (Garth Algar), Rob Lowe, Tia Carrere, Lara Flynn Boyle (Stacy), Chris Farley, Ed O'Neill, Robert Patrick, Alice Cooper Wayne Campbell, Garth Algar, Stacy US$ 20000000 Comedy, Satire, Buddy film 2/14/1992 English Language
3 Wayne's World 2 Stephen Surjik Mike Myers, Dana Carvey, Christopher Walken, Tia Carrere, Chris Farley, Ted McGinley, Olivia d'Abo, Kevin Pollak, Ed O'Neill, Kim Basinger, Heather Locklear Mike Myers (Wayne Campbell), Dana Carvey (Garth Algar), Christopher Walken, Tia Carrere, Chris Farley, Ted McGinley, Olivia d'Abo, Kevin Pollak, Ed O'Neill, Kim Basinger, Heather Locklear Wayne Campbell, Garth Algar Comedy, Buddy film 12/10/1993 English Language
4 Austin Powers: Goldmember Jay Roach Mike Myers, BeyoncÈ, Seth Green, Michael York, Robert Wagner, Michael Caine, Verne Troyer, Gwyneth Paltrow, Fred Savage, Aaron Himelstein, Mindy Sterling, Josh Zuckerman, Greg Grunberg, Tommy 'Tiny' Lister, Rob Lowe, Masi Oka, Nikki Schieler Ziering, Britney Spears, Tom Cruise, John Travolta, Danny DeVito, Katie Couric, Steven Spielberg Mike Myers (Austin Powers), BeyoncÈ (Foxxy Cleopatra), Seth Green (Scott Evil), Michael York, Robert Wagner, Michael Caine, Verne Troyer, Gwyneth Paltrow (Dixie Normous), Fred Savage, Aaron Himelstein, Mindy Sterling, Josh Zuckerman, Greg Grunberg, Tommy 'Tiny' Lister, Rob Lowe, Masi Oka, Nikki Schieler Ziering, Britney Spears, Tom Cruise (Him/Herself), John Travolta, Danny DeVito, Katie Couric (Prison Guard), Steven Spielberg Austin Powers, Foxxy Cleopatra, Scott Evil, Dixie Normous, Him/Herself, Prison Guard Parody, Time travel, Comedy 7/26/2002 English Language
5 Austin Powers: International Man of Mystery Jay Roach Mike Myers, Elizabeth Hurley, Michael York, Mimi Rogers, Robert Wagner, Patrick Bristow, Fabiana Udenio, Elya Baskin, Paul Dillon, Lois Chiles, Christian Slater, Brian George, Cynthia Lamontagne, Cindy Margolis, Mindy Sterling, Joe Son Mike Myers (Austin Powers), Elizabeth Hurley, Michael York, Mimi Rogers, Robert Wagner, Patrick Bristow, Fabiana Udenio, Elya Baskin, Paul Dillon, Lois Chiles, Christian Slater, Brian George, Cynthia Lamontagne, Cindy Margolis (Fembot), Mindy Sterling, Joe Son Austin Powers, Fembot Parody, Time travel, Comedy 5/2/1997 English Language
6 So I Married an Axe Murderer Thomas Schlamme Mike Myers, Nancy Travis, Anthony LaPaglia, Amanda Plummer, Brenda Fricker, Michael G. Hagerty, Luenell, Debi Mazar, Matt Doherty, Steven Wright, Charles Grodin, Patrick Bristow, Phil Hartman, Cintra Wilson, Michael Richards, Sheila Kelley, Alan Arkin, M. C. Brennan, Holly Lewis Mike Myers, Nancy Travis, Anthony LaPaglia, Amanda Plummer, Brenda Fricker, Michael G. Hagerty, Luenell (Police Records Officer), Debi Mazar, Matt Doherty, Steven Wright, Charles Grodin, Patrick Bristow, Phil Hartman, Cintra Wilson, Michael Richards, Sheila Kelley, Alan Arkin, M. C. Brennan, Holly Lewis Police Records Officer Comedy 7/30/1993 English Language
7 Austin Powers: The Spy Who Shagged Me Jay Roach, Jay Roach Mike Myers, Heather Graham, Robert Wagner, Rob Lowe, Michael York, Verne Troyer, David Koechner, Muse Watson, Michael G. Hagerty, Kristen Johnston, Mindy Sterling, Gia Carides, Will Ferrell, Bree Turner, Scott Cooper Mike Myers (Austin Powers), Heather Graham, Robert Wagner, Rob Lowe, Michael York, Verne Troyer, David Koechner, Muse Watson, Michael G. Hagerty, Kristen Johnston, Mindy Sterling, Gia Carides, Will Ferrell, Bree Turner, Scott Cooper Austin Powers, Parody, Comedy, Time travel 6/11/1999 English Language English Language, German Language
8 Shrek 2 Andrew Adamson, Kelly Asbury, Conrad Vernon John Lithgow (Lord Farquaad), Mike Myers (Shrek), Eddie Murphy (Donkey), Cameron Diaz (Princess Fiona), Julie Andrews (Queen), Antonio Banderas (Puss in Boots), John Cleese (King), Rupert Everett (Prince Charming), Jennifer Saunders (Fairy Godmother), Aron Warner (Wolf), Kelly Asbury (Page), Cody Cameron (Pinocchio), Conrad Vernon (Gingerbread Man), Christopher Knights (Blind Mouse), Mark Moseley (Mirror) US$ 125000000 Comedy, Computer animation, Fantasy 5/19/2004 German Language English Language
9 Shrek 2 Inglourious Basterds Andrew Adamson, Kelly Asbury, Conrad Vernon Quentin Tarantino, Mark Christopher John Lithgow, Mike Myers, Eddie Murphy, Cameron Diaz, Julie Andrews, Antonio Banderas, John Cleese, Rupert Everett, Jennifer Saunders, Aron Warner, Kelly Asbury, Cody Cameron, Conrad Vernon, Christopher Knights, Mark Moseley Brad Pitt (Lt. Aldo Raine), Mike Myers (General Ed French), Diane Kruger (Bridget von Hammersmark), Daniel Br¸hl (Frederick Zoller), Til Schweiger (Sgt. Hugo Stiglitz), B. J. Novak (PFC Utivich), Michael Fassbender (Lt. Archie Hicox), Julie Dreyfus (Francesca Mondino), Maggie Cheung (Madame Mimieux), Rod Taylor (Winston Churchhill), Gedeon Burkhard, Christian Berkel (Eric the Barkeeper), Samuel L. Jackson, Samm Levine (PFC Hirschberg), Cloris Leachman (Mrs. Himmelstein), Christoph Waltz (Colonel Hans Landa), Ludger Pistor, Omar Doom (PFC Omar Ulmer), Jana Pallaske, Enzo G. Castellari, Jacky Ido, Eli Roth, MÈlanie Laurent, Ryan Phillippe (Shane O'Shea), Salma Hayek (Anita Randazzo), Neve Campbell (Julie Black), Mike Myers (Steve Rubell), Sela Ward (Billie Auster), Breckin Meyer (Greg Randazzo), Sherry Stringfield (Viv), Ellen Albertini Dow (Disco Dottie), Cameron Mathison (Atlanta), Noam Jenkins (Romeo), Jay Goede (Buck), Patrick Taylor (Tarzan), Heather Matarazzo (Grace O'Shea), Heidi Klum (VIP Patron), Mark Ruffalo, Lauren Hutton, Skipp Sudduth, Michael York Lord Farquaad, Shrek, Donkey, Princess Fiona, Queen, Puss in Boots, King, Prince Charming, Fairy Godmother, Wolf, Page, Pinocchio, Gingerbread Man, Blind Mouse, Mirror US$ 125000000 70000000 Comedy, Computer animation, Fantasy War, Adventure, Action, Black comedy, LGBT, Drama 5/19/2004 8/21/2009 English Language English Language, German Language, French Language, Italian Language, English Language
10 Inglourious Basterds 54 Quentin Tarantino, , , , Mark Christopher Brad Pitt, Mike Myers, Diane Kruger, Daniel Br¸hl, Til Schweiger, B. J. Novak, Michael Fassbender, Julie Dreyfus, Maggie Cheung, Rod Taylor, Gedeon Burkhard, Christian Berkel, Samuel L. Jackson, Samm Levine, Cloris Leachman, Christoph Waltz, Ludger Pistor, Omar Doom, Jana Pallaske, Enzo G. Castellari, Jacky Ido, Eli Roth, MÈlanie Laurent, Ryan Phillippe, Salma Hayek, Neve Campbell, Mike Myers, Sela Ward, Breckin Meyer, Sherry Stringfield, Ellen Albertini Dow, Cameron Mathison, Noam Jenkins, Jay Goede, Patrick Taylor, Heather Matarazzo, Heidi Klum, Mark Ruffalo, Lauren Hutton, Skipp Sudduth, Michael York Lt. Aldo Raine, General Ed French, Bridget von Hammersmark, Frederick Zoller, Sgt. Hugo Stiglitz, PFC Utivich, Lt. Archie Hicox, Francesca Mondino, Madame Mimieux, Winston Churchhill, Eric the Barkeeper, PFC Hirschberg, Mrs. Himmelstein, Colonel Hans Landa, PFC Omar Ulmer, Shane O'Shea, Anita Randazzo, Julie Black, Steve Rubell, Billie Auster, Greg Randazzo, Viv, Disco Dottie, Atlanta, Romeo, Buck, Tarzan, Grace O'Shea, VIP Patron US$ 70000000 18000000 War, Adventure, Action, Black comedy, LGBT, Drama 8/21/2009 8/28/1998 English Language
11 Shrek the Third Raman Hui, Chris Miller, Raman Hui Mike Myers (Shrek), Cameron Diaz (Princess Fiona), Eddie Murphy, Antonio Banderas, Julie Andrews, John Cleese, Rupert Everett, Justin Timberlake (Artie), Regis Philbin, Seth Rogen (Ship Captain), Eric Idle, Cheri Oteri, Edison Chen Comedy, Computer animation, Fantasy 5/18/2007 German Language English Language
12 View from the Top Bruno Barreto Gwyneth Paltrow (Donna Jensen), Christina Applegate, Mark Ruffalo, Candice Bergen, Joshua Malina, Kelly Preston, Mike Myers, Rob Lowe, Marc Blucas Romantic comedy, Comedy 3/21/2003 French Language English Language
13 Pete's Meteor Brenda Fricker, Mike Myers Drama 1998 Italian Language
14 54 The Cat in the Hat Bo Welch Mike Myers (The Cat in the Hat), Alec Baldwin (Larry Quinn), Kelly Preston (Joan Walden), Dakota Fanning (Sally Walden), Spencer Breslin (Conrad Walden), Amy Hill, Sean Hayes (The Fish) US$ 18000000 109000000 Musical, Fantasy 8/28/1998 11/21/2003 English Language
15 Shrek the Third Shrek Raman Hui, Chris Miller, Raman Hui Andrew Adamson, Vicky Jenson Mike Myers, Cameron Diaz, Eddie Murphy, Antonio Banderas, Julie Andrews, John Cleese, Rupert Everett, Justin Timberlake, Regis Philbin, Seth Rogen, Eric Idle, Cheri Oteri, Edison Chen Mike Myers (Shrek), Eddie Murphy (Donkey), Cameron Diaz (Princess Fiona), John Lithgow (Lord Farquaad), Chris Farley, Conrad Vernon, Vincent Cassel, Val Bettin, Christopher Knights Shrek, Princess Fiona, , Artie, Ship Captain US$ 60000000 Comedy, Computer animation, Fantasy Parody, Computer animation, Comedy, Fantasy 5/18/2007 5/18/2001 English Language
16 View from the Top The Thin Pink Line Bruno Barreto Joe Dietl, Michael Irpino Gwyneth Paltrow, Christina Applegate, Mark Ruffalo, Candice Bergen, Joshua Malina, Kelly Preston, Mike Myers, Rob Lowe, Marc Blucas Laura Kightlinger, Janeane Garofalo (Joyce Wintergarden-Dingle), Margaret Cho, Jennifer Aniston (Clove), David Schwimmer, Mike Myers, Will Ferrell Donna Jensen Romantic comedy, Comedy Satire, Indie, Comedy 3/21/2003 1998 English Language
17 Pete's Meteor Shrek the Halls Gary Trousdale Brenda Fricker, Mike Myers Eddie Murphy, Antonio Banderas, Cameron Diaz (Princess Fiona), Mike Myers, Aron Warner, Conrad Vernon, Christopher Knights, Marissa Jaret Winokur Drama Animation, Fantasy, Short film, Adventure, Comedy 1998 11/28/2007 English Language
18 The Cat in the Hat Shrek Ever After Bo Welch Mike Mitchell, Mike Mitchell Mike Myers, Alec Baldwin, Kelly Preston, Dakota Fanning, Spencer Breslin, Amy Hill, Sean Hayes Cameron Diaz (Princess Fiona), Eric Idle (Merlin), Antonio Banderas (Puss in Boots), Eddie Murphy (Donkey), Justin Timberlake (Arthur Pendragon), Julie Andrews (Queen Lillian), Mike Myers (Shrek), Paul McCartney (Rumpelstiltskin), Larry King (Doris the Ugly Stepsister) The Cat in the Hat, Larry Quinn, Joan Walden, Sally Walden, Conrad Walden, The Fish US$ 109000000 Musical, Fantasy Comedy, Computer animation, Fantasy 11/21/2003 5/21/2010 English Language
19 Shrek The Love Guru Andrew Adamson, Vicky Jenson Mike Myers, Eddie Murphy, Cameron Diaz, John Lithgow, Chris Farley, Conrad Vernon, Vincent Cassel, Val Bettin, Christopher Knights Mike Myers (Maurice Pitka), Jessica Alba (Jane Bullard), Justin Timberlake (Jacques Grande), Romany Malco (Darren Roanoke), Jessica Simpson, Ben Kingsley, Verne Troyer Shrek, Donkey, Princess Fiona, Lord Farquaad US$ 60000000 62000000 Parody, Computer animation, Comedy, Fantasy Comedy 5/18/2001 6/20/2008 English Language
20 The Thin Pink Line Shrek Goes Fourth Joe Dietl, Michael Irpino Laura Kightlinger, Janeane Garofalo, Margaret Cho, Jennifer Aniston, David Schwimmer, Mike Myers, Will Ferrell Cameron Diaz (Princess Fiona), Antonio Banderas (Puss in Boots), Eddie Murphy (Donkey), Mike Myers (Shrek) Joyce Wintergarden-Dingle, Clove Satire, Indie, Comedy Computer animation 1998 English Language
21 Shrek the Halls View from the top Gary Trousdale Bruno Barreto Eddie Murphy, Antonio Banderas, Cameron Diaz, Mike Myers, Aron Warner, Conrad Vernon, Christopher Knights, Marissa Jaret Winokur Gwyneth Paltrow, Mike Myers, Rob Lowe, Christina Applegate, Kelly Preston, Candice Bergen, Mark Ruffalo, Joshua Malina Princess Fiona Animation, Fantasy, Short film, Adventure, Comedy Romantic comedy 11/28/2007 3/21/2003 English Language
Shrek Ever After Mike Mitchell, Mike Mitchell Cameron Diaz, Eric Idle, Antonio Banderas, Eddie Murphy, Justin Timberlake, Julie Andrews, Mike Myers, Paul McCartney, Larry King Princess Fiona, Merlin, Puss in Boots, Donkey, Arthur Pendragon, Queen Lillian, Shrek, Rumpelstiltskin, Doris the Ugly Stepsister Comedy, Computer animation, Fantasy 5/21/2010 English Language
The Love Guru Mike Myers, Jessica Alba, Justin Timberlake, Romany Malco, Jessica Simpson, Ben Kingsley, Verne Troyer Maurice Pitka, Jane Bullard, Jacques Grande, Darren Roanoke US$ 62000000 Comedy 6/20/2008 English Language
Shrek Goes Fourth Cameron Diaz, Antonio Banderas, Eddie Murphy, Mike Myers Princess Fiona, Puss in Boots, Donkey, Shrek Computer animation
View from the top Bruno Barreto Gwyneth Paltrow, Mike Myers, Rob Lowe, Christina Applegate, Kelly Preston, Candice Bergen, Mark Ruffalo, Joshua Malina Romantic comedy 3/21/2003 English Language