Add tests for related variables
denismaier opened this issue · comments
We will need tests that test for related variables. I think there are two possible ways:
- add
@related
to the test:if variable="title" related="original"
- add new test-conditions for each relation:
if original-variable="title"
2 has the advantage that you can test for variables that are on different levels in the same test: if original-variable="title" variable="translator"
. And it's more concise than 1. Of course, this means one attribute fore each relation, and this will be slightly more messy when we add new relations. If we use the first approach we can just add new options to @related
. (OTOH, there won't be 100 relations; maybe three to five or so.)
Yes. If a more complex test is needed, the element condition syntax can be used.
The only thing that neither option currently has is an ability to test for a specific relation itself. We could skip that (e.g., instead testing for one of various related variables) or also add a related-item="original"
condition.
The only thing that neither option currently has is an ability to test for a specific relation itself. We could skip that (e.g., instead testing for one of various related variables) or also add a
related-item="original"
condition.
Yes, we should add something like this.
When would related-item="original"
test true?
a) If the current item has an variables with related="original
"
b) If the current item is an original item?
Or should we add tests for both?
Ok. It's now possible to test for related variables. (see the PR)
I think we always orient ourselves around the base item. So, related-item="original"
tests for the presence of an original relation.
The question of is a related item is handled by specifying @relation
on the rendering element.
So,
related-item="original"
tests for the presence of an original relation.
Good. Technically, this tests true if there is any related variable? Or a certain number of them?
It tests true if there is an "original" related item. It would test false if there is a "reviewed" related item but no "original" related item.
Not sure I understand. How will that look like in the data?
Anyway, I've updated the PR with a test to cover this (if has-relation
)
I'm not sure what the confusion is, so forgive me if I am on a tangent.
So, if an item looks like this:
id: base-item
title: Base item title
original:
id: original-item
title: Orginal item title
Then, has-relation="original"
tests true but has-relation="reviewed"
tests false. The text value of the has-relation
test specifies the type of relation to look for.