Page MenuHomePhabricator

parsing, db query and rendering should be separated
Closed, ResolvedPublic

Description

Author: ittayd

Description:
I want to use inline queries programmatically. the problem is there's no way to
separate the steps of parsing, querying and rendering. i'd like to be able to
get the query results and then render them myself.


Version: unspecified
Severity: enhancement

Details

Reference
bz8517

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 9:34 PM
bzimport set Reference to bz8517.

This modification is under way. I am about to implement a new storage
abstraction layer that will also provide a nicer query API. The time frame for
this being finished are the next one or two months, depending on our progress in
other tasks.

This change is now complete. Queries have an internal object-representation based on the classes in ./includes/storage/SMW_Query.php. One can programmatically create such a query and forward it to the semantic store for getting the answer. Get a store object (./includes/storage/SMW_Store.php) via smwfGetStore() and execute getQueryResult. The result will be another object, as described in ./includes/storage/SMW_QueryResult.php. You can read-out this result directly, or format it into HTML using one of the query printers in ./includes/SMW_QueryPrinters.php (maybe these will be seperated into single files in the future). Finally, you can generate SMWQuery objects from user-given query strings (wikitext) using the class in ./includes/SMW_QueryProcessor.php.