With the Logical Studio, you setup a branch in your data product for saved and reusable logic blocks.
The guide helps you create the following:
The Logical Studio allows you to create two types of stored logic: one with parameters and one without. However, please note that in the initial version, parameters are not yet enabled.
The stored logic is crafted using WOQL, a datalog language integrated into the TerminusDB data products you build with the data product builder for logical twins. All of your stored logic is securely stored in the _logic_main branch and can be effortlessly executed through the user-friendly interface.
Here's an example of stored logic that you can use to retrieve all documents in a data product branch and their respective types. Additionally, this query includes filters to exclude subdocuments and lists from the results.
select(
"v:object",
"v:type",
and(
triple("v:object", "rdf:type", "v:type"),
not(quad("v:type", "sys:subdocument", "v:nil", "schema")),
not(eq("v:type", "rdf:List")),
),
)
The v:
prefixes indicate that they are variables (think of them as lists of values). If they are not constrained, they will try to match as widely as possible amongst the subject, predicate and object parts of a triple. Each variable will be returned as a column in the tabular response, unless select is used to only select the specific variables to return.
The rdf:type
predicate connects the type of a triple to the subject.
To delve deeper into the details of writing WOQL, please consult the comprehensive TerminusDB documentation.
Here are some good pointers to start with:
WOQL.
prefixtrue
and eval
terms need to be prefixed as _true and _eval to workv:
prefix. A variable would be referenced as "v:object above".Good luck!