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

Adding new parameters: AllowOnlyLinksToPages and AllowLinkExpansion #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pwolny
Copy link

@pwolny pwolny commented Aug 4, 2022

Additional options that allow for example to cleanly graph relations between page list results generated by inline queries of Semantic Mediawiki.
The normal behavior from SMW example provided in readme makes graph hard to read:
Standard_behaviour

AllowOnlyLinksToPages restricts the graph to nodes from page list, for example when set to true:
AllowOnlyLinksToPages

AllowLinkExpansion allows or suppresses adding new nodes to graph by holding nodes:
AllowOnlyLinksToPages_with_manualy_expanded_nodes

All images above were generated by following code and by changing the new parameters

{{#network:
{{#ask: [[NextPage::+]]
| format=list
| headers=show
| link=none
| order=ascending
| merge=true
|limit=50
|searchlabel=|
|sep={{!}}
|template=ReturnTemplatesFirstArgument
|outro={{!}}
|intro={{!}}
}}
| class = col-lg-3 mt-0
|AllowOnlyLinksToPages = true
|AllowLinkExpansion = false
|enableDisplayTitle = true
}}

Some translation files and readme with an example were updated.

Probably needs code review and maybe new variable names could be made more consistent with the rest of the code.

Modifications were tested and were working on a debian system with:
MediaWiki 1.37.4
PHP 7.4.30 (apache2handler)
MariaDB 10.5.15-MariaDB-0+deb11u1
ICU 67.1
LuaSandbox 3.0.3
Lua 5.1.5
Pygments 2.10.0
Semantic Forms Select 4.0.0-alpha
Semantic MediaWiki 4.0.2
Semantic Result Formats 4.0.1

@TUDTom
Copy link

TUDTom commented Aug 8, 2022

Hey, thanks a lot for the development. This is exactly what I was looking for. Unfortunately, I was not able to reproduce this example. When I use AllowOnlyLinksToPages = true, no links (pages+external) appear in the graph. If I use AllowOnlyLinksToPages = false, all links appear. I have replaced the Network folder in extensions with your files and restarted everything. Is anything else required?

@pwolny
Copy link
Author

pwolny commented Aug 8, 2022

Nothing comes to mind, except the template for the SMW ask query (Template:ReturnTemplatesFirstArgument). Basically it contains just {{{1|}}} and returns first parameter as text.
In the example the query part

{{#ask: [[NextPage::+]]
| format=list
| headers=show
| link=none
| order=ascending
| merge=true
|limit=50
|searchlabel=|
|sep={{!}}
|template=ReturnTemplatesFirstArgument
|outro={{!}}
|intro={{!}}
}}

returns:
|Test8|Test1|Test10|Test11|Test12|Test13|Test14|Test15|Test16|Test2|Test3|Test4|Test5|Test6|Test7|Test9|

Did you try maybe something simpler like this:

{{#network:Test1|Test2|Test3|Test4|Test5
| class = col-lg-3 mt-0
|AllowOnlyLinksToPages = true
|AllowLinkExpansion = false
|enableDisplayTitle = true
}}

Are there any differences between Preview and saved page?

Also the comparison between page list and page name check seems to be case sensitive (check if page list contains exact page titles).

@TUDTom
Copy link

TUDTom commented Aug 10, 2022

Hey there, thanks a lot for the fast reply! Now it works fine. After restarting the VM and resolving a copy-mistake (without error message) it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants