Last modified: 2014-02-12 23:38:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24737, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22737 - format=graph Graphviz attributes from Pages and Categories
format=graph Graphviz attributes from Pages and Categories
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
SemanticResultFormats (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: denny vrandecic
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-05 20:47 UTC by Bob MacCallum
Modified: 2014-02-12 23:38 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bob MacCallum 2010-03-05 20:47:39 UTC
I submitted a half-baked patch here to allow styling of graphviz nodes from Page and Category properties ([[has graphviz node attribute::fillcolor=red]])

http://www.mediawiki.org/wiki/Extension_talk:Semantic_Result_Formats#Feature_request:_node_background_color_from_category

However, I did not do a proper job in at least 2 ways:

1. I did not create a special SMW property (I just look through all properties until I find one with a suitable name)

2. I don't handle the Category hierarchy properly (at all, to be honest).  The talk page has a suggestion of how best to handle Categories.

It was my first attempt at MW programming and I am not a native PHP speaker, as you can probably tell.  It would be great if you could provide this functionality robustly for the community.  It's low priority though, because I have my patch working fine for our needs.

Thanks for the excellent extension.

cheers,
Bob.
Comment 1 Bob MacCallum 2010-03-08 12:30:28 UTC
SRF graph is currently rendering non-Page type nodes with URLs to nonexistent pages (if graphlink=yes).  I guess this is a bug.

It also suggests another feature to me:

A page might have a string or boolean property.  You might want to color or style those nodes differently on the graph.  Therefore if the property had a "graphviz node attribute" property, and the property's value was non-empty (and not false if boolean) you could apply the attributes to the node (*after* applying the category and page-based attributes).

Even cooler (but open to injection-based attacks?) would be to enable the display of property values.  I envisage something like this

Property:Has supervisor
[[Has type::string]]
[[Has graphviz node attribute::label="\N (supervisor \P)"]]

As described here
http://www.graphviz.org/doc/info/attrs.html#k:escString
\N is an existing graphviz escape sequence to insert the node name.

\P could be intercepted by the SRF extension and be replaced with the property value.

One problem with this approach is that I can't see how you would add text from more than one property to a node's label.

An alternative might be to use my existing patch something like this:

[[Has graphviz node attribute::label="{{PAGENAME}} (Supervisor {{#show:{{PAGENAME}}|?has supervisor|link=none}})"]]

This works (but comes out all lowercase for some reason).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links