The example from https://www.jonmsterling.com/jms-00WV.xml shows
below
\scope{
\open\query
\compl{\taxon{theorem}}
}
forester reports
12 | \compl{\taxon{theorem}}
^ tried to compile query constructor to XML
What did I miss?
On 16 Jul 2024, at 14:35, Lîm Tsú-thuàn wrote:
> The example from https://www.jonmsterling.com/jms-00WV.xml shows> below>> \scope{> \open\query> \compl{\taxon{theorem}}> }>> forester reports>> 12 | \compl{\taxon{theorem}}> ^ tried to compile query constructor to XML>> What did I miss?
Ah, perhaps I should make this more clear, thanks for pointing it out.
Just like in previous versions of Forester, a query expression needs to
be wrapped in a \query command to be run. So the quoted code specifies
the query, but executing it is another thing. To do that, you would
need:
\query{
\open\query
\compl{\taxon{theorem}}
}
Best,
Jon
Thanks for bringing this up, I had the same confusion. Thanks to Jon's
explanation, I managed to use the new query language to do something I
wanted to do for a long time: querying all potentially lost notes
(i.e. that are not transcluded by any root notes, and not marked as
draft (because I have queries by topic for drafts) ):
```
\scope{
\open\query
\open\rel
\def\query/root{
\union{\tag{root}}{\tag{notes}}
}
\def\query/root/transcluded{
\union-fam{\query/root}{\paths}{\outgoing}{\transclusion}
}
\def\query/has/home{
\union{\query/root}{\query/root/transcluded}
}
\def\query/normal{
\compl{
\union{\query/root}{\tag{draft}}{\tag{macro}}{\taxon{person}}{\taxon{reference}}
}
}
\def\query/lost{
\isect{\query/normal}{\compl{\query/has/home}}
}
\query{
\open\query
\lost
}
}
```
Besides the need to wrap the query in a `\query` block, there are some
other tiny issues in examples:
1. example jms-00X3 assumed `\open\rel`
2. example jms-00X3 called `\query/transclusion-coslice` with a
renamed `\tree-under`
3. if one places the definition of a query and another definition
using the first query together (e.g. jms-00X4 + jms-00X3), it won't
work, because a query `xyz` just defined can not be resolved with
`\xyz` in the same scope but need a full `\query/xyz`, this can be
reproduced by the example above by calling `\root` instead of
`\query/root`.
On 17 Jul 2024, at 14:29, Utensil Song wrote:
> Thanks for bringing this up, I had the same confusion. Thanks to Jon's> explanation, I managed to use the new query language to do something I> wanted to do for a long time: querying all potentially lost notes> (i.e. that are not transcluded by any root notes, and not marked as> draft (because I have queries by topic for drafts) ):>> ```> \scope{> \open\query> \open\rel> \def\query/root{> \union{\tag{root}}{\tag{notes}}> }> \def\query/root/transcluded{> \union-fam{\query/root}{\paths}{\outgoing}{\transclusion}> }> \def\query/has/home{> \union{\query/root}{\query/root/transcluded}> }> \def\query/normal{> \compl{> \union{\query/root}{\tag{draft}}{\tag{macro}}{\taxon{person}}{\taxon{reference}}> }> }> \def\query/lost{> \isect{\query/normal}{\compl{\query/has/home}}> }> \query{> \open\query> \lost> }> }> ```>
That's very cool, thanks for sharing!
> Besides the need to wrap the query in a `\query` block, there are some> other tiny issues in examples:>> 1. example jms-00X3 assumed `\open\rel`> 2. example jms-00X3 called `\query/transclusion-coslice` with a> renamed `\tree-under`> 3. if one places the definition of a query and another definition> using the first query together (e.g. jms-00X4 + jms-00X3), it won't> work, because a query `xyz` just defined can not be resolved with> `\xyz` in the same scope but need a full `\query/xyz`, this can be> reproduced by the example above by calling `\root` instead of> `\query/root`.
I've now updated the release notes to be a bit more clear about the need
to call \query, and I have fixed issues (1-3) mentioned by untensil
above.
Thanks to everyone for your feedback!
Best,
Jon
Thanks for the updates in the release notes!
I have a new issue regarding the previous shared query snippets. It
turns out to return more results than I expected, particularly, the
"unstable" trees that are introduced by `\subtree`, they should be
ruled out by the query as they have parents thus are not lost. Reading
https://www.jonmsterling.com/jms-00WS.xml, there seems to be no
built-in relation symbols for these unstable trees, whose signature
would be having a `<fr:parent>` in its XML, but this is not detectable
from the query language. In theory, this is also a type of relation,
not transclusion, but parent ship.
Wonder if there could be some support towards this direction.
Regards,
Utensil Song
On Fri, Jul 19, 2024 at 12:22 AM Jon Sterling <jon@jonmsterling.com> wrote:
>> On 17 Jul 2024, at 14:29, Utensil Song wrote:>> > Thanks for bringing this up, I had the same confusion. Thanks to Jon's> > explanation, I managed to use the new query language to do something I> > wanted to do for a long time: querying all potentially lost notes> > (i.e. that are not transcluded by any root notes, and not marked as> > draft (because I have queries by topic for drafts) ):> >> > ```> > \scope{> > \open\query> > \open\rel> > \def\query/root{> > \union{\tag{root}}{\tag{notes}}> > }> > \def\query/root/transcluded{> > \union-fam{\query/root}{\paths}{\outgoing}{\transclusion}> > }> > \def\query/has/home{> > \union{\query/root}{\query/root/transcluded}> > }> > \def\query/normal{> > \compl{> > \union{\query/root}{\tag{draft}}{\tag{macro}}{\taxon{person}}{\taxon{reference}}> > }> > }> > \def\query/lost{> > \isect{\query/normal}{\compl{\query/has/home}}> > }> > \query{> > \open\query> > \lost> > }> > }> > ```> >>> That's very cool, thanks for sharing!>> > Besides the need to wrap the query in a `\query` block, there are some> > other tiny issues in examples:> >> > 1. example jms-00X3 assumed `\open\rel`> > 2. example jms-00X3 called `\query/transclusion-coslice` with a> > renamed `\tree-under`> > 3. if one places the definition of a query and another definition> > using the first query together (e.g. jms-00X4 + jms-00X3), it won't> > work, because a query `xyz` just defined can not be resolved with> > `\xyz` in the same scope but need a full `\query/xyz`, this can be> > reproduced by the example above by calling `\root` instead of> > `\query/root`.>> I've now updated the release notes to be a bit more clear about the need> to call \query, and I have fixed issues (1-3) mentioned by untensil> above.>> Thanks to everyone for your feedback!>> Best,> Jon
--
In fascination of creating worlds by words,and in pursuit of words
behind the world.