Objects and Paths
All queries on this page assume the following schema.
module default {type Person {required property name -> str;}abstract type Content {required property title -> str {constraint exclusive};multi link actors -> Person {property character_name -> str;};}type Movie extending Content {property release_year -> int64;}type TVShow extending Content {property num_seasons -> int64;}}
Object types
All object types in your schema are reflected into the query builder, properly namespaced by module.
e.default.Person;e.default.Movie;e.default.TVShow;e.my_module.SomeType;
For convenience, the contents of the default module are also available at the top-level of e.
e.Person;e.Movie;e.TVShow;
Paths
EdgeQL-style paths are supported on object type references.
e.Person.name; // Person.namee.Movie.title; // Movie.titlee.TVShow.actors.name; // Movie.actors.name
Paths can be constructed from any object expression, not just the root types.
e.select(e.Person).name;// (select Person).namee.op(e.Movie, 'union', e.TVShow).actors;// (Movie union TVShow).actorsconst ironMan = e.insert(e.Movie, {title: "Iron Man"});ironMan.title;// (insert Movie { title := "Iron Man" }).title
Type intersections
Use the type intersection operator to narrow the type of a set of objects. For instance, to represent the elements of an Account’s watchlist that are of type TVShow:
e.Person.acted_in.is(e.TVShow);// Person.acted_in[is TVShow]
Backlinks
All possible backlinks are auto-generated and can be auto-completed by TypeScript. They behave just like forward links. However, because they contain special characters, you must use bracket syntax instead of simple dot notation.
e.Person["<director[is Movie]"]// Person.<director[is Movie]
For convenience, these backlinks automatically combine the backlink operator and type intersection into a single key. However, the query builder also provides “naked” backlinks; these can be refined with the .is type intersection method.
e.Person['<director'].is(e.Movie);// Person.<director[is Movie]