STxT Tutorial
What is STxT?
It is a purely semantic language, with very basic rules, that allows the creation of documents with structured content and easy to interpret, both by humans (without computer knowledge) and by machines. You can be reading a document in STxT without actually realizing that it is.
Documents without namespace
Here is an example of a cooking recipe:
Recipe: Macaroni Recipe :Description: This is the description of the macaroni recipe. Bla, bla, bla Bla, bla, bla Servings: 3 Difficulty: easy Ingredients: Ingredient: (100g) Tomato Ingredient: (240g) Macaroni Steps: Step: Make the sofrito Step: Boil macaroni Step: Mix macaroni with sofrito and serve
This is a STxT document without namespace. This type of document
is structured, but we do not know what form the nodes have. In any case, you can
already see that they have structure, with a main node Recipe
, which has
a Description
node, Ingredients
, etc. In turn, these nodes have others, and so on
until forming a hierarchical structure.
It is worth mentioning the Description
node, which is a node that allows multilines.
As there is no prior structure, they are distinguished because the node name
is in the form :node name:
Documents with namespace
Now an example of the same recipe with a namespace:
Recipe (com.kocinando.receta): Macaroni Recipe Description: This is the description of the macaroni recipe. Bla, bla, bla Bla, bla, bla Servings: 3 Difficulty: easy Ingredients: Ingredient: (100g) Tomato Ingredient: (240g) Macaroni Steps: Step: Make the sofrito Step: Boil macaroni Step: Mix macaroni with sofrito and serve
Now we show the namespace. The definition of the namespace is found in a document without namespace:
Namespace: com.kocinando.receta Recipe: Description: (?) TEXT Servings: (?) NUMBER :Difficulty: (?) ENUM easy medium hard Ingredients: (1) Ingredient: (+) Steps: (1) Step: (+)
Comments
It is possible to insert comments in the documents to express unfinished parts, thoughts of the author, etc. Comments will not be used but allow enriching the document.
Recipe (com.kocinando.receta): Macaroni Recipe # This recipe was given to me by XX and I have made it a lot of times # You will love it!! Description: This is the description of the macaroni recipe. Bla, bla, bla Bla, bla, bla Servings: 3 Difficulty: easy Ingredients: Ingredient: (100g) Tomato Ingredient: (240g) Macaroni Steps: Step: Make the sofrito Step: Boil macaroni Step: Mix macaroni with sofrito and serve
Different namespaces in a document
A namespace can refer to another, to indicate that a part of the document has the structure in another namespace. Better to see an example:
Namespace:com.kocinando.recetario RecipeBook: Recipe: (+) (com.kocinando.receta)
Here we see that Recipe
is from another namespace and we see that
instead of putting the structure, it refers to another namespace.
It is NOT necessary to specify the inner namespace, only the main node.
Thus, an example of a recipe book would be:
RecipeBook (com.kocinando.recetario): Mom's Recipes Recipe: Macaroni Recipe Description: This is the description of the macaroni recipe. Bla, bla, bla Bla, bla, bla Servings: 3 Difficulty: easy Ingredients: Ingredient: (100g) Tomato Ingredient: (240g) Macaroni Steps: Step: Make the sofrito Step: Boil macaroni Step: Mix macaroni with sofrito and serve Recipe: Pizza Recipe Ingredients: Ingredient: (1u) Pizza dough Ingredient: (100g) Tomato Ingredient: (50g) Cheese Steps: Step: Put tomato and cheese on pizza Step: Bake for 15'