Comments (2)
You are correct that the results will seem a bit funny (especially when one is used to SQL queries): all results in strata act like sets in that only unique results are reckoned. In this case, what happens is that the table
query projects ?who
and ?beans
, which leads to the following result set:
(?who=peter, ?beans=1)
(?who=peter, ?beans=2)
Note that both the tuesday and wednesday entries result in the same (peter, 2)
result, and are therefore not both present in the result set. While somewhat unexpected, this is the correct behaviour for strata --- there is a way to get the results you want though.
The solution is to add a ?when
variable to your query, and use the consider
block to force strata to consider a variable as relevant:
<table ?who ?beans@sum >
?b is a: beans
?b who: ?who
?b when: ?when
?b beans: ?beans
group {
?who
}
consider {
?when
}
</table>
The consider
block informs strata that a variable is relevant for the uniqueness of the results, even though it is not part of the displayed fields.
Let me know if this helps!
P.S.: In your example you have three entries with names. I'm assuming they are on different pages. If not, note that if you put multiple entries in a single page Strata will merge them unless you give them unique names. A quick example of this can be seen in issue #41.
from dokuwiki-strata.
Thank you, this explains the funny results perfectly well. I did not understand before the use for the consider block. Now I do.
The example is, of course, contrived and I put all the data on one page in order to simplify the documentation of the issue. The result of the query appears to be the same when I add names to the entries.
Instead of the field when, I can also use the entry title to disambiguate the rows.
All's well, the issue is solved, strata is an astonishingly flexible beast. Thank you.
from dokuwiki-strata.
Related Issues (20)
- Preventing display of input data HOT 3
- How to get data to refresh? HOT 1
- Improved parsing/error messages
- link style and image sizes HOT 7
- hard limit results HOT 3
- Output a single value into another plugin's syntax HOT 1
- Multiple entries on one page HOT 2
- <table> tag not working properly HOT 5
- References with namespace don't work HOT 5
- Multiple values for expressions with * can't be used HOT 2
- ODT export issue HOT 1
- Effect of the "useheading" configuration setting HOT 2
- ~~INFO:stratatypes~~ crashes wiki HOT 4
- Table gives correct result only when predicate not correctly written HOT 4
- Suggestion: Include a query from another page HOT 4
- Type "wiki" does not work HOT 4
- SQLite Access can not access strata tables HOT 2
- Scoped mode HOT 2
- Page title [[]] as part of Fragment HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokuwiki-strata.