Using SMW to query Anchors

From semantic-mediawiki.org

Good day:

My Versions: MediaWiki: 1.25.1 | PHP: 5.6.8 | MySQL: 5.6.24 Semantic MediaWiki: 2.2.1 | Lingo: 1.2.0 | Semantic Glossary: 1.1.0

I searched the MediaWiki website for the phrase “Anchor”.

About 13 items down in the Search results I see an entry like the following:

Manual:PAGENAMEE encoding (section Whitespaces in page names and anchors (section headings))

The search returns a particular anchor inside an article.

Is there a way that I can use MSW to mark MediaWiki anchors so that I can get an SMW query to return anchors?

01:54, 29 July 2015

Looks like that you should use subobjects instead of or in addition to anchors.

03:05, 30 July 2015

Thank you Alexander:

Could you say a little more please? I use subobjects presently. They are very good for precisely querying articles.

Is there a way to arrange a subobject so that a query it returns a section of an article?

Perhaps there is some alternative way to create sections in an article?

12:43, 30 July 2015

I'm not quite sure I understand the issue/question but what if you create a page `ArtitlceWithSection` that contains:

{{#subobject:
 |Has page=ArticleWithSection
 |Has section=ArticleWithSection#abc
}}{{#subobject:
 |Has page=ArticleWithSection
 |Has section=ArticleWithSection#123
}}

{{#ask: [[Has page::+]][[Has section::+]]
 |?Has section
}}

== abc ==

== 123 ==

The query should display and link to the correct section.

16:29, 30 July 2015

Good morning:

Honestly; I saw that a search on Wikipedia or MediaWiki could return sections of articles as well as articles. I wanted that precious ring and was told it was accomplished using CirrusSearch. I failed to get CirrusSearch working and got lost trying to follow the detailed configuration advice. Is this because I am using the latest MediaWiki version? Is it because of some configuration I have not done on my wiki? Is it because of subtle CirrusSearch requirements?

The answer to these questions, clearly, was to see if I could have a search of my wiki return article sections by relying solely on SMW.

The solution you provide works neatly and is easy. Thank you Alexander.

I worry that a subobject per anchor adds some overhead per anchor in an article across the wiki. That is to say that it is more work.

In addition to a subobject per anchor; I see that I can shift to a larger number of shorter articles.

Shorter articles will leave me better able to zoom in on a very specific topic without being able to query sections of an article.

Then I will want to mitigate that my articles are become grains of sand on a beach.

I can give each short article a subobject. I can then query to organize related short articles to create a more inclusive article using the Embedded Format.

http://semantic-mediawiki.org/wiki/Help:Embedded_format

Sorry to be verbose. Thanks to the forum.

13:43, 7 August 2015