Skip to content

Commit 900ec78

Browse files
Replace trait with interface in new docs
1 parent f0b287a commit 900ec78

File tree

11 files changed

+59
-61
lines changed

11 files changed

+59
-61
lines changed

new_home/modules/ROOT/pages/get_started/schema.adoc

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,12 @@ Finally, commit the transaction by typing:
130130
commit
131131
----
132132
133-
Alternatively, you could use the command `close` to discard your changes and close the transaction.
134-
--
135-
====
136-
137133
[NOTE]
138-
====
134+
=====
139135
A quick *tip* if you are using Console for this course. Queries on this page can be turned into runnable *Console scripts* by clicking the "`hidden lines`" button (image:{page-version}@new_home::/svg/eye.svg[width=24]).
140136
These scripts can then be *pasted* directly into the server-level interface of Console, and run end-to-end simply by pressing kbd[Enter].
137+
=====
138+
--
141139
====
142140

143141
== Defining your schema
@@ -201,10 +199,10 @@ Finally, commit the transaction by typing `commit` and press kbd[Enter]. You hav
201199

202200
Let us dissect the second query in a bit more detail.
203201

204-
* In the first line of the query we introduce the relation type `friendship` with a `friend` *role* (in _programmer lingo_: think of a role as a *trait* that other types can implement). In the same line, we also declare that each friendship requires _exactly two friends_ when created (`card` is short for "`cardinality`", and is a first example of an *annotation*. Annotations make schema statements much more specific - but more on that in a moment).
205-
* In the second line, we then define that users *can play* the role of friends in friendships (in _programmer lingo_: the type `user` *implements* the "`friend-role`" trait).
202+
* In the first line of the query we introduce the relation type `friendship` with a `friend` *role* (in _programmer lingo_: think of a role as a *interface* that other types can implement). In the same line, we also declare that each friendship requires _exactly two friends_ when created (`card` is short for "`cardinality`", and is a first example of an *annotation*. Annotations make schema statements much more specific - but more on that in a moment).
203+
* In the second line, we then define that users *can play* the role of friends in friendships (in _programmer lingo_: the type `user` *implements* the "`friend-role`" interface).
206204

207-
It's worth pointing out that roles are only one of two kinds of traits that types may implement, the other being *ownership*: for example, in our first query above we defined that the `user` type "`implements the username owner trait`". These traits make our life very easy as we'll see, especially when dealing with type hierarchies!
205+
It's worth pointing out that roles are only one of two kinds of interfaces that types may implement, the other being *ownership*: for example, in our first query above we defined that the `user` type "`implements the username owner interface`". These interfaces make our life very easy as we'll see, especially when dealing with type hierarchies!
208206

209207
Let's write a few more definition queries to get a feel of database schemas in TypeDB.
210208

@@ -224,7 +222,7 @@ For example:
224222
include::./schema.adoc[tag=define3]
225223
----
226224
227-
This defines a `start-date` attribute and then declares each friendship may own a `start_date` (i.e., the type `friendship` implements the "`start-date owner`" trait). The definition is followed by a `@card` annotation, which specifies that friendships own _between_ zero or one start dates. In fact, this is the default cardinality, so you don't actually need `@card` here at all.
225+
This defines a `start-date` attribute and then declares each friendship may own a `start_date` (i.e., the type `friendship` implements the "`start-date owner`" interface). The definition is followed by a `@card` annotation, which specifies that friendships own _between_ zero or one start dates. In fact, this is the default cardinality, so you don't actually need `@card` here at all.
228226
229227
The next query illustrates usage of "`unbounded`" cardinality together with another useful annotation, `@key`. This specifies that the `username` of a `user` should uniquely identify a user, i.e., it is a _key attribute_.
230228
@@ -233,7 +231,7 @@ The next query illustrates usage of "`unbounded`" cardinality together with anot
233231
include::./schema.adoc[tag=define4]
234232
----
235233
236-
Importantly, different types may own the same attributes; and, similarly, different types may play the same role of a relation type. This flexibility of connecting types is a central feature of data modeling with TypeDB. Run the next query to define an `organization` type which shares many of the traits of `user`:
234+
Importantly, different types may own the same attributes; and, similarly, different types may play the same role of a relation type. This flexibility of connecting types is a central feature of data modeling with TypeDB. Run the next query to define an `organization` type which shares many of the interfaces of `user`:
237235
238236
[,typeql]
239237
----
@@ -268,7 +266,7 @@ friendship owns start-date @card(0..1);
268266
include::./schema.adoc[tag=define3]
269267
----
270268
271-
This defines a `start-date` attribute and then declares each friendship may own a `start_date` (i.e., the type `friendship` implements the "`start-date owner`" trait). The definition is followed by a `@card` annotation, which specifies that friendships own _between_ zero or one start dates. In fact, this is the default cardinality, so you don't actually need `@card` here at all.
269+
This defines a `start-date` attribute and then declares each friendship may own a `start_date` (i.e., the type `friendship` implements the "`start-date owner`" interface). The definition is followed by a `@card` annotation, which specifies that friendships own _between_ zero or one start dates. In fact, this is the default cardinality, so you don't actually need `@card` here at all.
272270
273271
The next query illustrates usage of "`unbounded`" cardinality together with another useful annotation, `@key`. This specifies that the `username` of a `user` should uniquely identify a user, i.e., it is a _key attribute_.
274272
@@ -289,7 +287,7 @@ user owns username @key;
289287
include::./schema.adoc[tag=define4]
290288
----
291289
292-
Importantly, different types may own the same attributes; and, similarly, different types may play the same role of a relation type. This flexibility of connecting types is a central feature of data modeling with TypeDB. Run the next query to define an `organization` type which shares many of the traits of `user`:
290+
Importantly, different types may own the same attributes; and, similarly, different types may play the same role of a relation type. This flexibility of connecting types is a central feature of data modeling with TypeDB. Run the next query to define an `organization` type which shares many of the interfaces of `user`:
293291
294292
////
295293
[,typeql]
@@ -325,14 +323,14 @@ Let's define two types that specialize our earlier `organization` type: namely,
325323
----
326324
include::./schema.adoc[tag=define6]
327325
----
328-
Note that we haven't defined any traits for companies and universities; indeed, all traits of the supertype `organization` are automatically *inherited*! That doesn't stop from defining new traits for our subtypes, of course:
326+
Note that we haven't defined any interfaces for companies and universities; indeed, all interfaces of the supertype `organization` are automatically *inherited*! That doesn't stop from defining new interfaces for our subtypes, of course:
329327
330328
[,typeql]
331329
----
332330
include::./schema.adoc[tag=define7]
333331
----
334332
335-
Of course, you would be able to give the new subtypes additional traits that are not inherited from the supertype as well!
333+
Of course, you would be able to give the new subtypes additional interfaces that are not inherited from the supertype as well!
336334
337335
--
338336
@@ -355,7 +353,7 @@ entity university sub organization;
355353
#!test[schema]
356354
include::./schema.adoc[tag=define6]
357355
----
358-
Note that we haven't defined any traits for companies and universities; indeed, all traits of the supertype `organization` are automatically *inherited*! That doesn't stop from defining new traits for our subtypes, of course:
356+
Note that we haven't defined any interfaces for companies and universities; indeed, all interfaces of the supertype `organization` are automatically *inherited*! That doesn't stop from defining new interfaces for our subtypes, of course:
359357
////
360358
[,typeql]
361359
----
@@ -374,7 +372,7 @@ user plays enrolment:student;
374372
include::./schema.adoc[tag=define7]
375373
----
376374
377-
Of course, you would be able to give the new subtypes additional traits that are not inherited from the supertype as well!
375+
Of course, you would be able to give the new subtypes additional interfaces that are not inherited from the supertype as well!
378376
379377
Don't forget to commit the transaction by typing `commit` and pressing kbd[Enter].
380378

new_reference/modules/ROOT/pages/typeql/annotations/card.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ to specify cardinality ranges for roles and ownerships.
1010
.Range Argument Syntax
1111
[,typeql]
1212
----
13-
<type label> <trait> <type label 2> @card(N..M);
14-
<type label> <trait> <type label 2> @card(N..);
13+
<type label> <interface> <type label 2> @card(N..M);
14+
<type label> <interface> <type label 2> @card(N..);
1515
----
1616

1717
.Single Scalar Argument Syntax
1818
[,typeql]
1919
----
20-
<type label> <trait> <type label 2> @card(N);
20+
<type label> <interface> <type label 2> @card(N);
2121
----
2222

23-
The `@card` annotation can be defined for any `<trait>` of: `owns`, `relates`, or `plays`.
23+
The `@card` annotation can be defined for any `<interface>` of: `owns`, `relates`, or `plays`.
2424

2525
It accepts either a range argument or a single scalar argument.
2626
Arguments must be integers.
@@ -32,7 +32,7 @@ Arguments must be integers.
3232
== Usage
3333

3434
// TODO: Update for ordered/unordered when lists are implemented
35-
Every trait has a default `cardinality` constraint, accessible in <<_default_cardinality>>.
35+
Every interface has a default `cardinality` constraint, accessible in <<_default_cardinality>>.
3636

3737
// tag::description[]
3838
When defined, the `@card` annotation overrides the default `cardinality` with the specified arguments.
@@ -66,7 +66,7 @@ include::{page-version}@new_reference::example$tql/schema_annotations.tql[tags=d
6666
=== Subtyping
6767

6868
// TODO: Put somewhere in a common place and reference it
69-
Similarly to inherited type constraints, trait constraints also affect subtypes from both sides.
69+
Similarly to inherited type constraints, interface constraints also affect subtypes from both sides.
7070
For example, the following query defines that:
7171

7272
- A `page` instance must have between 1 and 3 names.
@@ -93,14 +93,14 @@ Cannot be used with the xref:{page-version}@new_reference::typeql/annotations/ke
9393
== References
9494

9595
[#_default_cardinality]
96-
=== Default trait cardinalities
96+
=== Default interface cardinalities
9797

98-
The following `cardinality` constraints are set for traits by default if no `@card` annotations are declared:
98+
The following `cardinality` constraints are set for interfaces by default if no `@card` annotations are declared:
9999

100-
.Default Trait Cardinalities
100+
.Default interface Cardinalities
101101
[cols=".^1,^.^1"]
102102
|===
103-
^| Trait ^| Cardinality
103+
^| interface ^| Cardinality
104104
| `owns`
105105
| `card(0..1)`
106106

new_reference/modules/ROOT/pages/typeql/annotations/distinct.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ The `@distinct` annotation does not accept any arguments.
2323

2424
== Usage
2525

26-
The `@distinct` annotation enforces the `distinct` constraint for an ordered type trait.
26+
The `@distinct` annotation enforces the `distinct` constraint for an ordered type interface.
2727
This constraint ensures that lists contain only distinct values.
2828
// TODO: Add a reference to lists and their behavior
2929

3030
[NOTE]
3131
====
32-
Ordered traits, lists, and related annotations like `@distinct` are not yet available in TypeDB.
32+
Ordered interfaces, lists, and related annotations like `@distinct` are not yet available in TypeDB.
3333
Coming soon!
3434
====

new_reference/modules/ROOT/pages/typeql/data_model.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This page gives a brief technical overview of TypeDB's type system and query mod
55
In short, TypeDB's data model is based on a *type system* built from two key ingredients:
66

77
* a _single-inheritance_ subtyping system, allowing a type to specialize to zero or more subtypes.
8-
* a _trait-based_ reference system, allowing instances to refer to other instances.
8+
* a _interface-based_ reference system, allowing instances to refer to other instances.
99
1010
TypeDB's query model is tailored to this type system, directly expressing subtyping and references in its query statements, but also allowing users to chain together queries and data operations into powerful *multi-stage data pipelines* for all types of workloads.
1111

@@ -32,7 +32,7 @@ Instances of entity types, simply called entities, can be created _indepdently_,
3232
11. *Relation types*, specified using the keyword `relation`, and are required to have at least one *associated role type* specified with the keyword `relates`.
3333
+
3434
--
35-
Instances of relation types may reference (or "link") zero or more data instances for each associated role type, called their *players* of that role (these data instance must have types with corresponding *player trait*).
35+
Instances of relation types may reference (or "link") zero or more data instances for each associated role type, called their *players* of that role (these data instance must have types with corresponding *player interface*).
3636

3737
For example, a friendship relations may link two friends (implemented by, say, two user entities).
3838

@@ -41,7 +41,7 @@ Relations without role players will be removed (no "`dangling relations`").
4141
11. *Attribute types*, specified using the keyword `attribute`, and required to have an *associated value type* (either structured or primitive) specified with the keyword `value`.
4242
+
4343
--
44-
Instances of attribute types carry an *associated value* of the associated value type. They may also reference other data instances, called their *owners* (these data instances must have direct types with the corresponding *owner trait*). Two attributes are considered equal if they have the same associate value and have the same (origin) type.
44+
Instances of attribute types carry an *associated value* of the associated value type. They may also reference other data instances, called their *owners* (these data instances must have direct types with the corresponding *owner interface*). Two attributes are considered equal if they have the same associate value and have the same (origin) type.
4545

4646
Attributes without owners will be removed (no "`dangling attributes`", unless the attribute type is marked as independent).
4747
--
@@ -65,15 +65,15 @@ Two instances of a value type are equal exactly when their literal values are eq
6565
Coming soon.
6666
====
6767

68-
=== Type traits and "`objects vs attributes`"
68+
=== Type interfaces and "`objects vs attributes`"
6969

70-
Entity types can have traits, i.e. play roles or own attribute types. This allows us to create connections of entities with other data.
70+
Entity types can have interfaces, i.e. play roles or own attribute types. This allows us to create connections of entities with other data.
7171

72-
Relation types can also have traits, i.e. play roles or own attribute types. This, for example, allows the creation of nested relations (i.e., relations playing roles in other relations).
72+
Relation types can also have interfaces, i.e. play roles or own attribute types. This, for example, allows the creation of nested relations (i.e., relations playing roles in other relations).
7373

74-
Since entity and relation types together make up "`first-class`" types in TypeDB's type system (when it comes to type traits) they are, together, also referred to as *object types*, whose instances are data *objects*.
74+
Since entity and relation types together make up "`first-class`" types in TypeDB's type system (when it comes to type interfaces) they are, together, also referred to as *object types*, whose instances are data *objects*.
7575

76-
Attributes cannot have traits; they are merely typed associations of values to objects.
76+
Attributes cannot have interfaces; they are merely typed associations of values to objects.
7777

7878
=== Subtyping
7979

@@ -88,7 +88,7 @@ Data instances (i.e., entities, relation, are attributes) are stored using datab
8888

8989
== Definitions
9090

91-
User-defined types, their traits, and their subtyping structure, are created and modified through xref:{page-version}@new_reference::typeql/index.adoc#statements[definition statements] in xref:{page-version}@new_reference::typeql/index.adoc#queries[schema queries].
91+
User-defined types, their interfaces, and their subtyping structure, are created and modified through xref:{page-version}@new_reference::typeql/index.adoc#statements[definition statements] in xref:{page-version}@new_reference::typeql/index.adoc#queries[schema queries].
9292

9393
== Data pipelines
9494

new_reference/modules/ROOT/pages/typeql/index.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ The former query introduces types, while the latter will query for types. The ge
106106
Definitions in schema queries concern:
107107

108108
* *type* definitions, introducing new types via the appropriate keyword (`entity`, `relation` + `relates`, `attribute` + `value`). Types are referred to by a unique type *labels*; multiple aliases of the latter can be introduced (coming soon).
109-
* *trait* definitions, introducing player or owner traits (via `plays` and `owns` keywords). Player traits allow type instances to be referred to as players in roles of relations. Owner traits allow type instances to be referred to as
110-
* *subtyping* definitions, declare types to be subtypes of other types (via the keyword `sub`). Traits of supertypes are inherited by subtypes.
109+
* *interface* definitions, introducing player or owner interfaces (via `plays` and `owns` keywords). Player interfaces allow type instances to be referred to as players in roles of relations. Owner interfaces allow type instances to be referred to as
110+
* *subtyping* definitions, declare types to be subtypes of other types (via the keyword `sub`). interfaces of supertypes are inherited by subtypes.
111111

112112
=== Pattern statements
113113

114114
In contrast, in patterns we support a wide variety of syntax, including for:
115115

116-
* *Retrieving types* based on label, traits, and inheritance.
116+
* *Retrieving types* based on label, interfaces, and inheritance.
117117
* *Retrieving data* in types, e.g. based on references between data instance such as attribute ownerships and relation linkages (via keywords such as `has`, `links`, and anonymous versions thereof)
118118
* Function calls (`let $a, $b in <FUN-CALL>`)
119119
* Computation with values (`let $x = <EXPR>`)

new_reference/modules/ROOT/pages/typeql/keywords.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Denotes the return signature of a function. See xref:{page-version}@new_referenc
290290
Used to remove ownership of attributes and players of roles in xref:{page-version}@new_reference::typeql/pipelines/delete.adoc[Delete stages] of data pipelines.
291291

292292
`from`::
293-
Used to remove traits, role specialisation, and annotations in xref:{page-version}@new_reference::typeql/schema/undefine.adoc[Undefine queries].
293+
Used to remove interfaces, role specialisation, and annotations in xref:{page-version}@new_reference::typeql/schema/undefine.adoc[Undefine queries].
294294

295295
`in`::
296296
Used to access stream or list elements. See xref:{page-version}@new_reference::typeql/statements/let-in.adoc[] for more information.

0 commit comments

Comments
 (0)