- Mar 2024
-
typedb.com typedb.com
-
cadinality
typo
-
-
-
selection in SQL.
(expressed, e.g., using
WHERE
andFROM
clauses) -
projection in SQL.
(expressed using
SELECT
clauses) -
should
will
-
n retrieved.
comment on how the JSON has changed structurally? "list of attributes" became "dictionary of specific attributes".
-
Exercise
this exercise might be a bit too trivial?
-
-
-
f"insert $p isa person, has full-name $fn, has email $e; $fn == '{name}'; $e =
same comment, also: line breaks!
-
"match $u isa user; fetch $u: full-name, email;"
make this a constant early in the query
-
f""" match $fn == '{name}'; $u isa user, has full-name $fn; $p($u, $pa) isa permission; $o isa object, has path $fp; $pa($o, $va) isa access; $va isa action, has name 'view_file'; get $fp; sort $fp asc; """
make this a constant early in the function
-
True
Same comment
-
.clone()
do you actually need
clone()
here? even though it's python and not rust :-D -
See the full schema listing
no need to hyperlink
Text: See full schema file
-
See the full Insert query listing
See full data file
-
connect_to_typedb
see above .. let's call this something like
initialize_db_driver
-
new_database
refactor to
database
-
create_new_database
refactor to something like
open_or_create_database
-
connect_to_typedb
A bit weird that
connect
returns adriver
. I'd say:- either
initialize_db_driver(...)
returnsdriver
- or
connect_to_db(...)
returns aconnection
In principle, I like the second option more, and would rename
driver
toconnection
. But this contradicts driver terminology hmmm so maybe first option. - either
-
Example
remove caption
-
pip install typedb-driver
where do I see the necessary imports?
-
Follow the steps below or see the full source code.
You can find the full source code [here].
Tags
Annotators
URL
-
-
typedb.com typedb.com
-
insert delete
Make a list
-
-
-
Only the first one will be successfully executed.
would be instructional to also include the error messages of the others!
-
Lesson 7.1 (coming soon).
an earlier reference to Lesson 8 did not have the "(coming soon)" ... should it be everywhere?
-
-
typedb.com typedb.com
-
You should complete Lesson 2 before starting this lesson.
add: Some basic familiarity with SQL will be helpful, but is not required
-
match fetch attribute isa has entity relation isa! sub sub! owns relates plays
make this comma separated
-
-
-
TypeQL is flexible enough that we could certainly do so if we wanted, but it is not particularly useful to and there are certain practical considerations that make the syntax tricky to use correctly. While learning the basics of TypeQL, it is best to avoid relates statements of this kind.
instead of saying it's dangerous, can you saying something more concrete? (and less dramatic sounding :-D )
-
Everything has a type, and so everything can be a variable.
attribute to
TypeDB Fundamentals, "Type Theoretic Foundations"
-
-
-
If you see this result, you’ve set up everything correctly and are ready to begin learning how to read data in Lesson 3.
I think it would be super useful to explain "Running a code selection" as well on this page (with screenshots). Otherwise, they'll have create a new file for each query.
-
ff, open a
reversed order of icon + button name?
-
-
-
Inferred data is only generated once, so results returned are never redundant.
unclear without further explanation
-
Rule inference functions on deductive reasoning,
unclear without further explanation
-
resolved
activated?
-
locating
AHHHHHHHHH
it doesn't read good haha. what did we have against
localization
again?
-
-
-
Parametric polymorphism
prob rewrite intro paragraph. see individual comments.
I'd rewrite this section which a focus on parametric statements. then "parametric query" can be a derived notation.
Examples of parametric statements:
$x sub relation; $y has $a; $b ($a) isa $T;
-
The defining feature of parametric statements is that they do not include any type names, except for the root type keywords entity, relation, and attribute
i would change this definition (I'm sure this won't impact the rest too much): the defining property is that they contain type variables that can potentially range over multiple inheritance hierarchies or interface implementations. Really, the feature to communicate is that we can have type variables! Of course, this is often implicitly, for example,
match $x isa book; book owns $T; $a isa $T; $x has $a;
could bematch $x isa book, has $a;
I'd rewrite this section which a focus on parametric statements. tbd -
While these queries are purely parametric, it is also possible to write non-parametric queries that include parametric statements, as we will see shortly.
this should be the default definition.
-
is particularly useful for parametric queries, but
omit
-
Parametric queries do not represent questions in the business domain, and are typically used to perform administrative procedures or database analytics.
this should come a bit later? after the examples?
-
Parametric queries are unique in that they are valid over any schema.
not true since queries can parametric in some type but not another. i see no need to interpret "parametric queries" this strictly.
-
hey match particular data by structure rather than by semantics.
sentence probably too vague/philosophical to be meaningful to the average user.
-
in the schema that
are you saying somewhere that we will leave the schema implicit for now? otherwise the user may wonder where "the schema" is that you are referring to.
(also structurally ambiguous usage of "that")
-
locating
still wavering on refactoring this to sth that reads better.
-
type of ISBN we are providing.
this could be: isbn13, isbn10, ....
-
querying their supertypes, as
i feel like the following is missing: subtype of a supertype is more special that then the supertype, conversely, a supertype is the generalization of (maybe many) subtypes.
-
all three of these types are subtypes of book, which was the type we specified for $book
where was this subtyping defined?
-
Polymorphism in TypeDB
each of the definitions below could do with a tiny bit more meat. Maybe 2 sentences per definition.
-
type hierarchies
still no mention of sub and supertypes?
-
Allows us to define interfaces that can be implemented independently in the schema and then query those interfaces declaratively.
a bit too vague. what are interfaces?
-
m. In the following query, we adjust the previous query to retrieve the titles and page counts of all books.
Explain the relation of
book
with the other types, don't to say "supertype" but sth is needed.
-
-
-
in Lesson 2.2.
in the next section. (+hyperlink next section)
-
- Feb 2024
-
typedb.com typedb.com
-
A data class has methods to traverse between data objects by retrieving all owned attributes, all relations played in and respective roles.
Could do with more context + explanation
-
Use type’s label to retrieve the type object. For example, to get a stateful object of the user entity type, use:
Needs updating
-
Full example
Textual explanation missing!
-
Traverse between data objects
Traverse data objects
-
Add data
Inserting data
-
Get data
Retrieving data
-
Query data
Get data by querying
This section needs more text to make it clear how it fits on this page. For example, it doesn't tell the reader at all about the fact that you can send queries with drivers. Make clear why this is here!
-
Data objects
Same comments apply as before: * Could link to other manuals for sending queries * Introduction of example goes before example * Some explanation of the code highlighting the specificities of individual drivers
-
let users = transaction.
this line is very long ... line wrap?
-
-
typedb.com typedb.com
-
Explanation objects ContentsExplainablesExplain queryExplanationFull exampleLearn more
This page is very sparse on code explanations!
-
-
typedb.com typedb.com
-
Add a type
Adding types
-
Get a type
Retrieving types
-
Get the type by its label
Get types by their label
-
Query for types
Get types by querying
This section needs more text to make it clear how it fits on this page. For example, it doesn't tell the reader at all about the fact that you can send queries with drivers. Make clear why this is here!
-
Send a Get query
This could also link to the Get Manual?
-
retrieving all rules, printing label, condition (when) and conclusion(then), adding a new rule, retrieving a rule by its label, and deleting a rule.
make more specific
-
Retrieve all rules in a schema:
make full sentence, and more specific
-
Retrieve a rule by its label:
make full sentence, and more specific
-
The above example set the user type as the supertype to the admin type, making admin a subtype of user.
GENERAL THOUGHT It might be worth, in general, to point out language specificities in example. E.g. why we need
drop(...)
etc. Overall, some parts of the code could do with more explanation. -
drop
why drop over { } blocks?
-
Type manipulation
description of next example missing
-
get/set label, get/set supertype, get subtypes, get ownerships, get roles played, etc.
make this a list
-
Send a Get query that returns type concept(s).
this section somehow lacks a discussion of "how to use the results returned by a get query". Add a sentence or two?
-
retrieving a type by its label, adding type, changing supertype, and retrieving all subtypes of a type.
could be more specific
-
Use type’s label to retrieve the type object. For example, to get a stateful object of the user entity type, use:
This is good! I now know what I'm going to be looking at.
-
To add a new
What does this example do
-
The above example retrieves all entity types in a database (as subtypes of the entity root type).
move before example
-
-
typedb.com typedb.com
-
See below an example of schema manipulation using driver API methods.
This is a bit too generic, and doesn't say what the example is about. You can move it up, and make it the last sentence before the Example section.
-
The above example adds an attribute type tag of a String value type and adds ownership over it for all non-abstract entity types that directly subtype the root entity type.
Put the description of the example BEFORE the example.
In general: Let's introduce the example before the actual example.
Then, any special observations come after the example.
See, e.g., the rust book that follows this style: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
Here is how you would define and use a calculate_length function that has a reference to an object as a parameter instead of taking ownership of the value:
EXAMPLE
First, notice that ...
-
To delete a type, open the Type Editor window by double-clicking on the selected type in the Type Browser. At the very bottom, click the Delete button and then the Confirm button.
make this a three step list
-
To rename a type, open the Type Editor window by double-clicking on the selected type in the Type Browser. At the very top, click on the pencil icon immediately right from the type name. Edit the name in the Label field and press the Rename button to save the changes.
make this a three step list
-
Type Editor is a powerful instrument that combines easy to use GUI with API calls that can modify schema directly, without TypeQL queries. With Type Editor, it’s much easier to rename a type or change type hierarchy by changing a supertype of a type. And it works even for types that already have data inserted for them.
remove this (or integrate the most essential points into the first paragraph) as it's less informative
-
You can rename a type, change its supertype, change whether it’s an abstract type, add or remove owned attributes, related roles, played roles, as well as just delete a type or export its full definition.
make this a list!
-
-
typedb.com typedb.com
-
The easiest
subsection
-
How to send a query with inference
Sending queries with inference
-
How to define a rule
Defining rules
-
-
typedb.com typedb.com
-
See the respective
subsection: Operating on concept maps
would it be worth having the same section in the insert/update pages? (which also return concepts maps?)
-
There are modifiers
subsection: Modifiers and aggregation
-
The easiest way to send a
subsection
-
How to send a Get query
Sending a get query
-
-
typedb.com typedb.com
-
concept
some links explaining these terms will be useful in the future
-
How to send a Fetch query
subsection as before!
-
-
typedb.com typedb.com
-
The example above checks the response of an insert query and commits the changes only if the number of inserts is equal to the expected number (1). Otherwise, it closes the transaction without committing the changes.
For longer example (like this), I prefer some explanation/introduction of the example BEFORE the example
-
Estimate the number of inserts with a read query
Estimation of inserts
-
Estimation of operations
-
An insert clause is executed once per every result matched by the match clause of the same Insert query. If the match clause is omitted, then the insert clause is executed exactly once.
is this in the right section? it sounds like it should go in the intro of the page?
OR: tell the reader what this has to do with the structure of responses.
-
How to send an Insert query
Sending an insert query
-
Check the response
Remove this heading. Just write. Let's see an example of how this works. Consider the following insert query with a match clause.
-
To process the response
Section this
-
The easiest way to check
Section this
-
Alternatively, you can estimate the number of inserts in an Insert query with a match clause by running a dedicated Fetch or Get query with the same match clause in the same transaction. Read queries can be used in a write transaction, and write transactions are snapshoted, preventing data changes committed in other transactions from influencing the results.
Move this into the section about estimation
-
ConceptMap object
Link?
-
The easiest way to send an Insert query is to use Studio or Console:
Subsection as before
-
-
typedb.com typedb.com
-
Estimate the number of inserts with a read query
Estimation of updates
-
Alternatively, you can estimate the number of inserts in an Update query with a match clause by running a dedicated Fetch or Get query with the same match clause in the same transaction. Read queries can be used in a write transaction, and write transactions are snapshoted, providing isolation from changes made by other transactions.
move down into "Estimation" section
-
The delete clause of an Update query is executed the same number of times as the insert clause, but if a concept specified for deletion is no longer present in a database for any reason, that would not produce an error. The query will continue its execution.
this also sound like it belongs in "Behaviour"
-
Both delete and insert clauses are executed once per every result matched by the match clause of the same Update query.
same as before
-
Update query ContentsHow to send an Update queryResponse interpretationCheck the responseEstimate the number of inserts with a read queryLearn more
Same comments apply as on previous two pages
-
-
typedb.com typedb.com
-
Estimate the number of deletes with a read query
Estimation of deletes
-
How to send a Delete query
Sending a delete query
-
should
will (if the query is valid)
-
You can estimate the number of deletes in a Delete query by running a dedicated Fetch or Get query with the same match clause in the same transaction. Read queries can be used in a write transaction, and write transactions are snapshoted, preventing data changes committed in other transactions from influencing the results.
move into section below
-
A delete clause is executed once per every result matched by the match clause of the same Delete query.
Move this up!
-
-
typedb.com typedb.com
-
How to send a Define query
First: rename to Sending a define query
Also: add subsections!
-
This page assumes you’ve already followed instructions from the Connecting to TypeDB section pages. Here, you’ll see how to u
eventually I would make this a note
-
-
typedb.com typedb.com
-
How to send an Undefine query
Same comments as on previous page
-
-
typedb.com typedb.com
-
Query types and sessions/transactions
can potentially omit this at this point. TBD
-
Transaction management
subsection this even if its super short sections
-
Commit a transaction
Subheadings * Clients (or: Studio and console) * Drivers
-
A commit can fail if an inconsistency arises, like a concurrent modifications by another successful commit. A failed commit closes the transaction.
put this in subheading "Commit failure"
-
the variable
which variable is "the variable" ?
-
Closing transaction doesn’t save any changes made within the transaction.
mention here already that "committing" is what you need to do to save changes (and say "see next section")
-
Close a transaction
subheadings!
-
To open a transaction, you need to select a transaction type and use an open session. Optionally, you can set transaction options.
as before: quite a lot of duplication of material here (or potential for it).
Solution? Link from Studio manual to this specific content?
-
Open a new transaction
as before: subheadings!
-
-
typedb.com typedb.com
-
logically coherent
example of what "logically coherent" means?
-
Session management
could have subheading here * Session timeouts * Blocking sessions * Best practice
-
blocks
highlight
-
Open a new session
Add subsections: * Open a new session * Studio and Console * Drivers * Close sessions * Studio and Console * Drivers
-
To see how to close an open session, see below.
omit
-
most flexible
what added flexibility? important to point this out?
-
To open a session to a database, you need to have a connection to the server and know the name of the database.
Add one sentence about what session are/what they are for.
-
-
typedb.com typedb.com
-
A network connection to TypeDB Core requires the address and port of the server to connect to.
There is some duplication here... should we just refer to Console/Studio manual? hmm
One solution could be to link to these specific tasks from the TypeDB studio manual. I think that would be my preferred option.
E.g. have * TypeDB Studio (category) * Operations (page) * DB operations (heading) * you can create a database (link) * you can rename a database (link) * you can delete a database (link) * Type operations (heading) * ...
-
let driver = Connection::new_core("127.0.0.1:1729");
Should there be some mention of the necessary
use
statement?use typedb_driver::{ Connection, DatabaseManager, ... };
same for other drivers -
Learn more
Next articles
-
A network connection to a TypeDB Cloud cluster requires address and port of at least one server in the cluster, as well as username and password of a user.
same as above
-
-
typedb.com typedb.com
-
TypeDB Studio
Same comment as before. Could have:
TypeDB Studio * Set-up (Setup/Connection/Databases/Settings) * Querying (Querying/Inference) * Operating (Type Browser/Editor/Settings) * Compatibility
-
Prepare a query in a tab Run a query from a tab See the results of your query in all available output formats
there could be more topical pictures for each of the sections
-
Run a query
can we get captions for the figures? It's so small, it's unclear what the picture is for!
-
If the explain button is inactive, double-check that Studio is connected to TypeDB, a database is selected with a drop-down list in the toolbar, and the infer and snapshot buttons are on.
make this a Note, and move to bottom
-
it
"it" is ambiguous. replace with "the result"
-
It
Unclear what "It" references
-
Exporting rules is not supported by this button yet.
make Note
-
root types
link
-
Both ways require you to commit the changes by the Commit () button at the top toolbar.
avoid general behaviour in the table. just add that outside the table (i.e. the same is repeated below)
-
Type Editor is a powerful instrument that combines easy to use GUI with API calls that can modify schema directly, without TypeQL queries. With Type Editor, it’s much easier to rename a type or change type hierarchy by changing a supertype of a type. And it works even for types that already have data inserted for them.
this becomes the second paragraph
-
Given a schema session
What does "given" mean here? It's better explained below
-
You can rename a type, change its supertype, change whether it’s an abstract type, add or remove owned attributes, related roles, played roles, as well as just delete a type or export its full definition.
make a table below
-
green lining
highlight
-
Session type () switch — selects a session type to use for queries.
make this into a table if possible
-
()
style note: buttons don't look exactly the same. e.g. schema data has a black boundary around it.
-
-
typedb.com typedb.com
-
Learn more
Read next/Next articles
-
let databases = DatabaseManager::new(driver);
same as before (mention use statement somehow?)
-
To create a new database, follow the steps below:
again some duplication here :/
-
-
typedb.com typedb.com
-
CLoud
spelling
-
-
typedb.com typedb.com
-
TypeDB Console ContentsConnect to TypeDBInteractive modeServer levelTransaction levelExampleNon-interactive modeExampleScriptingExampleTroubleshootingNon-ASCII charactersReferencesConsole CLI argumentsServer level commandsTransaction level commandsTransaction optionsVersion Compatibility
Could the sections on this page be (short) individual pages? It could also be TypeDB Console
TypeDB Studio * Set-up (Connection/Troubleshooting) * Querying (Interactive Mode/Non-int Mode/Scripting) * Reference (... tables) * Compatibility (... table)
TBD
-
Address to which Console will connect to: IP address and IP port separated by colon. Default value: localhost:1729. (TypeDB Core only)
can we decrease the font size? make it look similar to https://www.mongodb.com/docs/manual/reference/method/db.collection.find/#behavior
-
section
"reference" or "reference section"
-
section
"reference" or "reference section"
-
script.txt is the path to the file.
where PATH is the path to the file script.txt
-
--script=script.txt
--script=PATH/script.txt
-
script.txt
is there another extension we could give to "typedb console script files" ? .tcs ? .tqs ?
-
The above example creates a database with the name typedb, defines a schema with the person type, then inserts an instance of the person type into the database.
move this into the example. Delete the enumeration in the example. Just text + code.
-
typedb console
start with
$
sign to indicate shell execution? -
Run Console in
Use text instead of numbering. i.e.
First, start typedb console by running the following command ...
-
You are now in TypeDB Wonderland!
the
in
is highlighted?
-