A little bit of background: a friend of mine (Nick Grandy) and I are working on a user-editable database site, built around Semantic MediaWiki. Also, we're making some customizations to the Semantic MediaWiki codebase for this purpose: most importantly, in our version, the "ask" tag can take in a user-created format name, to let users dictate how inline query results are displayed on the page. So, for instance, if a user enters text like
then the parser looks for a page called "Template:MyFormat"; if it finds it, it uses that template to display the results. Currenly, only HTML formatting, not MediaWiki formatting, gets parsed in these "query templates". We hope to contribute this feature into the Semantic MediaWiki codebase, after discussion with Markus and others (we can see, via Markus' last update, that this a feature that there's already some demand for).
Alright... it seems odd to first supply those two pieces of information as part of a technical help question, but that's the way it's worked out. So, the question is: without getting into the details of what kinds of information the site will hold, we would like some pages to be, basically, "summary" pages, giving a high-level overview of all the data in the site. This will involve getting more information than what can be retrieved in a single inline query: it involves not just relations to one entity, but also relations and attributes of those relations, etc. In short, we're trying to replicate a "join" query in Semantic MediaWiki; apparently other people on this list have wondered about this same issue.
We can think of four ways to implement it:
- Embedding of new <ask> tags within query templates - using the custom-format feature we created, it might be possible to embed queries within one another, to give the desired results. There are possible problems with this approach: it might not be technically feasible (we haven't been able to get it working yet), it could result in infinite loops, and it could cause a performance problem if users create a chain of too many queries.
- Using SPARQL - use non-wiki pages that contain SPARQL queries to get the site's information via RDF export.
- Using SQL in the PHP - we could hard-code SQL queries into any page labeled as a "summary" page, the same way "category" pages have a special hard-coded query to give an alphabetical list of all pages with that category.
- Custom inline queries - we could add a new parameter into <ask> tags, called "query". That way a user could just use <ask query="queryname">, that would basically call a pre-defined, complex SQL query, with whatever parameters are passed in, and return HTML output.
Any thoughts are welcomed.