Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section-aware annotations for query/display #3961

Closed
brettz9 opened this issue Apr 25, 2019 · 6 comments
Closed

Section-aware annotations for query/display #3961

brettz9 opened this issue Apr 25, 2019 · 6 comments
Labels

Comments

@brettz9
Copy link
Contributor

brettz9 commented Apr 25, 2019

As a possible enhancement (assuming it is not already possible), I'm wondering if it may be possible for annotations to store information, accessible upon query and result formatting, about the particular subsection within which they occur (or possibly relative to the nearest ID on the page, e.g., as added by the likes of a page-marker template preceding the annotation).

@mwjames
Copy link
Contributor

mwjames commented Apr 27, 2019

formatting, about the particular subsection within which they occur (or possibly relative to the nearest ID on the page, e.g., as added by the likes of a page-marker template preceding the annotation).

I have to admit I'm not fully able to grasp what this request is about. Given the reference to "... particular subsection within which they occur ..." I would assume you mean the context in which a query is embedded such as in the following example where the #ask is part of Section 1. A parser function {{#...}} is not aware about it surroundings meaning where it is placed and there is no method (as I'm aware of) to determine its context unless you explicitly give that information manually to the parser function. Also, you cannot search for the parser function within the text to find out where it is relative to some section because the parser will process those functions first and replace them with a placeholder.

some text

== Section 1 ==

{{#ask: ... }}

== Section 2 ==

Aside from the technical issues, what is the use case, why would someone need that information?

@brettz9
Copy link
Contributor Author

brettz9 commented Apr 28, 2019

I was thinking along the lines of properties:

=Animals=

== Domestication ==

...
[[Has topic::wild dogs| ]]

== Breeding ==

[[Has topic::domestic dogs| ]]
[[Has topic::cats| ]]

So that an ask query could turn up something like:

Title Topic
Animals#Domestication wild dogs
Animals#Breeding domestic dogs
Animals#Breeding cats

Even better would be this (e.g., as part of a book):

<div id="chapter6"></div>
<div id="page321"></div>
...
[[Has topic::wild dogs| ]]
<div id="chapter7"></div>
...
<div id="chapter8"></div>
<div id="page451"></div>
[[Has topic::domestic dogs| ]]
<div id="page452"></div>
[[Has topic::cats| ]]
Title Chapter Page Topic
Book of animals 6 321 wild dogs
Book of animals 8 451 domestic dogs
Book of animals 8 452 cats

I know the <div id> could not be reliably parsed with the above info only. One could conceive an implementation based on custom markup (e.g., <section val="chapter=6" priority=1> and <section val="page=321" priority=2>) or by queries enabled to define a pattern:

{{#ask:
 [[Has topic::*]]
|mainlabel=Title
|?prefix="chapter",type=numeric;label=Chapter
|?prefix="page";type=numeric;label=Page
|?Has topic
}}

@mwjames
Copy link
Contributor

mwjames commented Apr 28, 2019

I understand the request but unless you codify the position at the time of the input there is no way an annotation knows its embedding context (i.e. meaning knows which part of #Domestication or #Breeding it to be).

Furthermore, I wouldn't know a method to make such information available and besides the technical issue of finding the context, each such annotation would have to be stored as "subobject" to record the value and its context (aka. position) because a simple [[Foo::Bar]] doesn't allow to store that information.

@brettz9
Copy link
Contributor Author

brettz9 commented Apr 28, 2019

Ok, sure... Well, maybe as just a enhancement request if it becomes more technically feasible in the future?

@mwjames
Copy link
Contributor

mwjames commented Apr 28, 2019

Well, maybe as just a enhancement request if it becomes more technically feasible in the future?

Unlikely, but I suggest you have a look at [0, 1] which uses named subobjects and can be used to identify a section context.

[0] https://sandbox.semantic-mediawiki.org/wiki/Issue/3961
[1] https://sandbox.semantic-mediawiki.org/wiki/Issue/3961/Q

@brettz9
Copy link
Contributor Author

brettz9 commented Apr 28, 2019

A helpful demo, thank you, and I guess with templates, one could more easily add subobjects for the pages or chapters along with topics, and if #3702 were implemented, I suppose pages could be nested inside chapters.

@kghbln kghbln added the question label May 4, 2019
@kghbln kghbln closed this as completed May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants