Comments (9)
My other question is ...is there a way to format a string with some of the variables?
eg: create a tmp variable and output something like the "Refer to :r for further info."
Again...Great plugin. Really really helping me get organized...
Cheers.
from dokuwiki-strata.
Glad to hear that you find the plugin useful!
As to the first question "How do I combine search clauses to search by Foo or Bar?"
In the search UI displayed with tables one can only do simple searches, so things like "Foo" or "Bar" are not possible there. In the query format, you can combine search patterns through the use of the union construct:
?s is a: example
union {
{
?s Foo: 10
}
{
?s Bar: 20
}
}
Any variables that match inside the union
get carried out, so you could have an additional ?s Description: ?desc
statement with the Foo
and the ?desc
would be available to show in the resulting table.
As to the second question "Is there a way to format a string with some of the variables?"
The query system does not allow the construction of temporary variables. That being said, you can do complex formatting by using the bwanders/dokuwiki-plugin-templatery and bwanders/dokuwiki-plugin-stratatemplatery plugins.
The Templatery plugin offers generic templating, and the second combines the data handling of Strata with the templating from Templatery. Their README's should get you going with that.
from dokuwiki-strata.
(Blegh; hit Close and Comment.)
Do these answers help you out?
from dokuwiki-strata.
Hi,
First off, apologies for the tardy thanks -- end of year madness at work...
Unfortunately, no :-(
Still can't get union to work.
I've tried
union {
{
?tg: [Usability]
}
{
?tg: [UI]
}
And
union {
{
?tg ~ [Usability]
}
{
?tg ~ [UI]
}
And
union {
{
?tg: [Usability]
}
{
?tg: [UI]
}
And without reusing the var I already created
union {
{
?r Tags ~ [Usability]
}
{
?r Tags ~ [UI]
}
...but keep on getting the following.
Unknown triple pattern or filter pattern '?r Tags ~ [Usability]'.
What's the obvious part that I am missing?
As for the templates, can't say I've wrapped my mind around them yet.
Thanks!
from dokuwiki-strata.
Let's focus on the query first, before getting to the whole template thing.
You are nearly there with the last attempt:
<table ?r>
union {
{
?r Tags: [Usability]
}
{
?r Tags: [UI]
}
}
</table>
That nets you all ?r
that are tagged with [Usability]
or [UI]
. The trick is that a Union most contain actual triple patterns, and not only filters:
- A triple pattern is a pattern of
?subject ?predicate: ?object
, where you are free to replace any number of the variables with constants...?r Tags: ?tag
is a good pattern, and so is?r Tags: Usability
, or?r ?relation: UI
. - A filter is anything like
?var1 <operation> ?var2
or?var1 <operation> Constant
. With<operation>
replaced with one of the Comparison Operators section from the manual.
(This additional information is possibly overkill, but wanted to clarify the difference to be sure.)
Hope that helps!
from dokuwiki-strata.
from dokuwiki-strata.
You can't place a pattern and a filter on a single line, but you can add both a pattern and a filter:
<list ?r "Id" ?re [wiki] "Requirement">
?r is a: requirement
optional {
?r Tags : ?tg
}
optional {
?r Requirement [wiki] : ?re
}
union {
{
?r Tags : ?temp1
?temp1 ~ [UI]
}
{
?r Tags : ?temp2
?temp2 ~ [Usability]
}
}
sort {
?r (asc)
}
</list>
I admit that this isn't the nicest way to express a "match this or that" kind of filter, but there's currently not better way to do it.
You could also ask yourself if it really is the best plan to do "tags contains some string" matching on sets of tags. Maybe we can find a way that better represents the data you are trying to model. Can you give an example of a data block that adds this data?
from dokuwiki-strata.
from dokuwiki-strata.
(First a short note: If you put your code examples between hedges of ``` they will be set in monospace font, and overall look a tad nicer.)
Ahhh... Now I get it! You want to AND the conditions, instead of having them ORed. Right.
Well, that's brutality simple then. Simply filter on both terms:
<list ?r "Id" ?re [wiki] "Requirement">
?r is a: requirement
?r Tags : ?tg
?tg ~ [UI]
?tg ~ [Usability]
optional {
?r Requirement [wiki] : ?re
}
sort {
?r (asc)
}
</list>
I dropped the optional from the ?r Tags: ?tg
pattern, since any requirements that have a [UI]
and [Usability]
tag by necessity have data for the Tags
field. Then it's a simple matter of declaring that the matched tags should contain both the tags you want.
The best way to understand these queries is by not thinking of them as database queries (in the relational sense), but as describing the pattern you want to match. In this case you want to match all ?r
that have some Tags
that match two different filters.
Hope this helps!
PS. I'm interested in what you think is a less bizarre syntax for describing the pattern you want to match -- I don't have time to implement it right now, but feel free to open another issue so we can discuss! (I modeled this syntax roughly after SPARQL which is a query language for RDF, which is a very good fit for the data model of Strata)
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
- Incorrect output for @sum aggregate HOT 2
- 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.