Thread:Extension talk:SemanticTitle/Two suggestions and a question

This is a great extension that has already been very, very useful to us! Thank you! I have two suggestions based upon slight modifications that we have had to make to the extension in order to use it.

First, we use properties of type Text to name our pages. Therefore, we modified line 51 from

if ( $value->getDIType == SMWDataItem::TYPE_STRING ) {

to

if ( $value->getDIType == SMWDataItem::TYPE_STRING || $value->getDIType == SMWDataItem::TYPE_BLOB ) {

Second, we find that when links to pages that are not in the main namespace are returned from #ask queries, they have links that appear to be "customized" to the code. They do not contain the namespace in the link text. I'm not sure if this is the best solution, but we found that modifying line 79 from

if ( $title != null && $title->getPrefixedText == $target->getPrefixedText ) {

to

if ( $title != null && ($title->getPrefixedText == $target->getPrefixedText || $title->getText == $target->getText)) {

worked for us. Perhaps you can think of a better way to accomplish this. Maybe replacing getPrefixedText with getText in the original would suffice, but I'm not sure if that would adversely affect other situations.

We are wondering whether you might incorporate our modifications into the extension, as we would like to be able to use it without custom modifications. We believe these modifications may be helpful to others.

Finally, our question relates to one situation that the extension does address. In this case, we have a query that returns, in addition to other results, a link to the current page. For example, consider a page for an author. The page contains a query that lists citations to all of the works authored by that individual. These works may have co-authors. Each citation lists, among other things, its authors - one of which will always be the author of the page you are currently viewing. MediaWiki checks when rendering HTML from wikitext whether it contains a link to the current page and, if so, displays the name of the page in bold text with no hyperlink (the relevant code is in function makeSelfLinkObj of Linker.php). Because this text is not generated as a hyperlink, the SemanticTitle code does not get called, so the unmodified page title is displayed. Have you encountered this issue, and, if so, how did you address it?

Thank you for the extension and, in advance, for your assistance.