Closed ghost closed 8 years ago
Hi @ubibene, the best way to do this is by taking advantage of Strata's ref
type.
For this to work, you need to know that the data you enter in a <data>
block is actually associated with the page that the data block is on. For example, if you have a wiki page called first_app
with the following on it:
====== First App ======
<data it_application>
app_id: 864
name: first app
</data>
This means that you will have four defined fields that are now associated with the first_app
page:
app_id
is 864
as defined by youname
is first app
as defined by youentry title
is First App
as determined by the first header of the pageis a
is it_application
as taken from the data block
Because this data is associated with a wiki page, you can actually refer to it.Note that it is not necessary to manually declare an app_id
field as the wiki page ID is already a unique identifier.
Now I want to declare flows of data between "it applications" : for example "first app" sends customer information to "second app"
You can do this by creating, on a separate page, a flow description like so (assuming that we have two apps defined on pages first_app
and second_app
:
<data flow>
flow_id:123
source [ref]: first_app
target [ref]: second_app
data:customer
type:batch
</data>
The ref
type with the source
and target
fields will make sure that the data is linked together through this flow description. Unless you want to keep flow_id
around because it refers to some external ID, you do not need it, the wiki page ID is the unique identifier for this flow.
If you want to put more than one data block on a single page (and if you have many data flows to describe, this might be useful), you can define multiple blocks on the same page if you make them data fragments:
<data flow #Unique name for flow 1>
...
</data>
<data flow #Unique name for flow 2>
...
</data>
And the system will understand that they are separate data flows.
I can query and get all flows for a given app ?
Querying all flows and their data is done as follows:
<table ?f ?from ?to>
?f is a: flow
?f source[ref]: ?from
?f target[ref]: ?to
ui {
filter: text
}
</table>
This will get you a table with all flows and their source and target apps. The ui
block tells Strata that you want to have a filter box where you type the name of a specific app to quickly filter the table.
The way you query strata is by describing the pattern of data that you are looking for. Here, ?f
is a variable that will be filled in by Strata with matching data. You are looking for all ?f
that describe data moving from some ?from
to some ?to
. By hinting (with the ref
type in the square brackets) that these variables are filled with references, Strata will automatically display them as links to the apps.
source and target in a flow object correspond to existing apps ?
It is currently not possible to force Strata to only allow specific classes of data. What you could do is make query that gives you a list of all flow objects that violate the constraint of "only link to existing apps":
<list ?flow>
?flow is a: flow
minus {
?flow target[ref]: ?to
?to is a: it_application
}
minus {
?flow source[ref]: ?from
?from is a: it_application
}
</list>
This query lists all flows that have a source or target that is not an it_application
.
Some of these things can be seen in the examples in the overview at https://www.dokuwiki.org/plugin:strata, with a reference document describing all options (but unfortunately not in a very understandable style at https://www.dokuwiki.org/plugin:strata:reference_guide).
Hope this helps! If something is still not clear, do not hesitate to ask.
if this helps you out, feel free to close this issue.
@bwanders : thanks for the detailed explanations.
As a matter of fact, strata is a powerful plugin, but is sometimes hard to understand. By reading your comments I have finally understood what is the purpose of data fragments , and that "data [...] as named values attached to the page" means that dowuki page is the id for non-fragment strata data.
Thanks for your work and providing us with that wonderful tool !
I'd like to do the following with strata, but I'm not sure if this is possible, and if it is, how to do it.
I'd like to create, modify and query on dokuwiki :
Let's say I have a class named "it application"
Now I want to declare flows of data between "it applications" : for example "first app" sends customer information to "second app"
a flow could be described as
or maybe
How could I set up this with strata so that :