Public Member Functions | |
| __construct (SMWStore $store) | |
| Constructor. | |
| getCountQueryResult (SMWQuery $query) | |
| Get the output number for a query in counting mode. | |
| getInstanceQueryResult (SMWQuery $query) | |
| Get the results for a query in instance retrieval mode. | |
| getDebugQueryResult (SMWQuery $query) | |
| Get the output string for a query in debugging mode. | |
Public Attributes | |
| const | RESULT_VARIABLE = 'result' |
| The name of the SPARQL variable that represents the query result. | |
Protected Member Functions | |
| getSparqlConditionString (SMWSparqlCondition &$sparqlCondition) | |
| Build the condition (WHERE) string for a given SMWSparqlCondition. | |
| getQueryResultFromSparqlResult (SMWSparqlResultWrapper $sparqlResultWrapper, SMWQuery $query) | |
| Build an SMWQueryResult object from a SMWSparqlResultWrapper. | |
| getSparqlCondition (SMWDescription $description) | |
| Get a SMWSparqlCondition object for an SMWDescription. | |
| buildSparqlCondition (SMWDescription $description, $joinVariable, $orderByProperty) | |
| Recursively create an SMWSparqlCondition from an SMWDescription. | |
| buildConjunctionCondition (SMWConjunction $description, $joinVariable, $orderByProperty) | |
| Recursively create an SMWSparqlCondition from an SMWConjunction. | |
| buildDisjunctionCondition (SMWDisjunction $description, $joinVariable, $orderByProperty) | |
| Recursively create an SMWSparqlCondition from an SMWDisjunction. | |
| buildPropertyCondition (SMWSomeProperty $description, $joinVariable, $orderByProperty) | |
| Recursively create an SMWSparqlCondition from an SMWSomeProperty. | |
| buildClassCondition (SMWClassDescription $description, $joinVariable, $orderByProperty) | |
| Create an SMWSparqlCondition from an SMWClassDescription. | |
| buildNamespaceCondition (SMWNamespaceDescription $description, $joinVariable, $orderByProperty) | |
| Create an SMWSparqlCondition from an SMWNamespaceDescription. | |
| buildValueCondition (SMWValueDescription $description, $joinVariable, $orderByProperty) | |
| Create an SMWSparqlCondition from an SMWValueDescription. | |
| buildTrueCondition ($joinVariable, $orderByProperty) | |
| Create an SMWSparqlCondition from an empty (true) description. | |
| getNextVariable () | |
| Get a fresh unused variable name for building SPARQL conditions. | |
| addOrderByDataForProperty (SMWSparqlCondition &$sparqlCondition, $mainVariable, $orderByProperty, $diType=SMWDataItem::TYPE_NOTYPE) | |
| Extend the given SPARQL condition by a suitable order by variable, if an order by property is set. | |
| addOrderByData (SMWSparqlCondition &$sparqlCondition, $mainVariable, $diType) | |
| Extend the given SPARQL condition by a suitable order by variable, possibly adding conditions if required for the type of data. | |
| addMissingOrderByConditions (SMWSparqlCondition &$sparqlCondition) | |
| Extend the given SMWSparqlCondition with additional conditions to ensure that it can be ordered by all requested properties. | |
| getSparqlOptions (SMWQuery $query, SMWSparqlCondition $sparqlCondition) | |
| Get a SPARQL option array for the given query. | |
Protected Attributes | |
| $m_variableCounter = 0 | |
| $m_sortkeys | |
| $m_store | |
Definition at line 237 of file SMW_SparqlStoreQueryEngine.php.
| SMWSparqlStoreQueryEngine::__construct | ( | SMWStore $ | store | ) |
Constructor.
| $store | SMWStore that this object will use |
Definition at line 266 of file SMW_SparqlStoreQueryEngine.php.
| SMWSparqlStoreQueryEngine::getCountQueryResult | ( | SMWQuery $ | query | ) |
Get the output number for a query in counting mode.
| $query | SMWQuery |
Definition at line 276 of file SMW_SparqlStoreQueryEngine.php.
References SMWSparqlResultWrapper::ERROR_NOERROR, getSparqlCondition(), getSparqlConditionString(), getSparqlOptions(), and smwfGetSparqlDatabase().
| SMWSparqlStoreQueryEngine::getInstanceQueryResult | ( | SMWQuery $ | query | ) |
Get the results for a query in instance retrieval mode.
| $query | SMWQuery |
Definition at line 315 of file SMW_SparqlStoreQueryEngine.php.
References getQueryResultFromSparqlResult(), getSparqlCondition(), getSparqlConditionString(), getSparqlOptions(), and smwfGetSparqlDatabase().
| SMWSparqlStoreQueryEngine::getDebugQueryResult | ( | SMWQuery $ | query | ) |
Get the output string for a query in debugging mode.
| $query | SMWQuery |
Definition at line 353 of file SMW_SparqlStoreQueryEngine.php.
References SMWStore::formatDebugOutput(), getSparqlCondition(), getSparqlConditionString(), getSparqlOptions(), and smwfGetSparqlDatabase().
| SMWSparqlStoreQueryEngine::getSparqlConditionString | ( | SMWSparqlCondition &$ | sparqlCondition | ) | [protected] |
Build the condition (WHERE) string for a given SMWSparqlCondition.
The function also expresses the single value of SMWSparqlSingletonCondition objects in the condition, which may lead to additional namespaces for serializing its URI.
| $sparqlCondition | SMWSparqlCondition |
Definition at line 392 of file SMW_SparqlStoreQueryEngine.php.
References SMWSparqlCondition::getCondition(), SMWExporter::getSpecialNsResource(), SMWTurtleSerializer::getTurtleNameForExpElement(), and SMWSparqlCondition::getWeakConditionString().
Referenced by getCountQueryResult(), getDebugQueryResult(), and getInstanceQueryResult().
| SMWSparqlStoreQueryEngine::getQueryResultFromSparqlResult | ( | SMWSparqlResultWrapper $ | sparqlResultWrapper, | |
| SMWQuery $ | query | |||
| ) | [protected] |
Build an SMWQueryResult object from a SMWSparqlResultWrapper.
This function is used to generate instance query results, and the given result wrapper must have an according format (one result column that contains URIs of wiki pages).
| $sparqlResultWrapper | SMWSparqlResultWrapper | |
| $query | SMWQuery, SMWQueryResults hold a reference to original query |
Definition at line 422 of file SMW_SparqlStoreQueryEngine.php.
References SMWSparqlResultWrapper::ERROR_INCOMPLETE, SMWSparqlResultWrapper::ERROR_NOERROR, and SMWExporter::findDataItemForExpElement().
Referenced by getInstanceQueryResult().
| SMWSparqlStoreQueryEngine::getSparqlCondition | ( | SMWDescription $ | description | ) | [protected] |
Get a SMWSparqlCondition object for an SMWDescription.
This conversion is implemented by a number of recursive functions, and this is the main entry point for this recursion. In particular, it resets global variables that are used for the construction.
If property value variables should be recorded for ordering results later on, the keys of the respective properties need to be given in m_sortkeys earlier.
| $description | SMWDescription |
Definition at line 470 of file SMW_SparqlStoreQueryEngine.php.
References addMissingOrderByConditions(), and buildSparqlCondition().
Referenced by getCountQueryResult(), getDebugQueryResult(), and getInstanceQueryResult().
| SMWSparqlStoreQueryEngine::buildSparqlCondition | ( | SMWDescription $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Recursively create an SMWSparqlCondition from an SMWDescription.
| $description | SMWDescription | |
| $joinVariable | string name of the variable that conditions will refer to | |
| $orderByProperty | mixed SMWDIProperty or null, if given then this is the property the values of which this condition will refer to, and the condition should also enable ordering by this value |
TODO Implement concept queries
Definition at line 488 of file SMW_SparqlStoreQueryEngine.php.
References buildClassCondition(), buildConjunctionCondition(), buildDisjunctionCondition(), buildNamespaceCondition(), buildPropertyCondition(), buildTrueCondition(), and buildValueCondition().
Referenced by addMissingOrderByConditions(), buildConjunctionCondition(), buildDisjunctionCondition(), buildPropertyCondition(), and getSparqlCondition().
| SMWSparqlStoreQueryEngine::buildConjunctionCondition | ( | SMWConjunction $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Recursively create an SMWSparqlCondition from an SMWConjunction.
| $description | SMWConjunction | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 516 of file SMW_SparqlStoreQueryEngine.php.
References $filter, addOrderByDataForProperty(), buildSparqlCondition(), buildTrueCondition(), SMWConjunction::getDescriptions(), and SMWTurtleSerializer::getTurtleNameForExpElement().
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildDisjunctionCondition | ( | SMWDisjunction $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Recursively create an SMWSparqlCondition from an SMWDisjunction.
| $description | SMWDisjunction | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 593 of file SMW_SparqlStoreQueryEngine.php.
References $filter, addOrderByDataForProperty(), buildSparqlCondition(), buildTrueCondition(), SMWDisjunction::getDescriptions(), getNextVariable(), and SMWTurtleSerializer::getTurtleNameForExpElement().
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildPropertyCondition | ( | SMWSomeProperty $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Recursively create an SMWSparqlCondition from an SMWSomeProperty.
| $description | SMWSomeProperty | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 664 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByDataForProperty(), buildSparqlCondition(), SMWDataValueFactory::getDataItemId(), getNextVariable(), SMWSomeProperty::getProperty(), SMWExporter::getResourceElementForProperty(), SMWTurtleSerializer::getTurtleNameForExpElement(), SMWExporter::hasHelperExpElement(), and SMWDataItem::TYPE_WIKIPAGE.
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildClassCondition | ( | SMWClassDescription $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Create an SMWSparqlCondition from an SMWClassDescription.
| $description | SMWClassDescription | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 744 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByDataForProperty(), SMWExporter::getResourceElementForWikiPage(), SMWExporter::getSpecialPropertyResource(), SMWTurtleSerializer::getTurtleNameForExpElement(), and SMWDataItem::TYPE_WIKIPAGE.
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildNamespaceCondition | ( | SMWNamespaceDescription $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Create an SMWSparqlCondition from an SMWNamespaceDescription.
| $description | SMWNamespaceDescription | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 779 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByDataForProperty(), SMWExporter::getSpecialNsResource(), SMWTurtleSerializer::getTurtleNameForExpElement(), and SMWDataItem::TYPE_WIKIPAGE.
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildValueCondition | ( | SMWValueDescription $ | description, | |
| $ | joinVariable, | |||
| $ | orderByProperty | |||
| ) | [protected] |
Create an SMWSparqlCondition from an SMWValueDescription.
| $description | SMWValueDescription | |
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 800 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByData(), addOrderByDataForProperty(), buildTrueCondition(), SMWValueDescription::getDataItem(), SMWExporter::getDataItemExpElement(), SMWExporter::getDataItemHelperExpElement(), and SMWTurtleSerializer::getTurtleNameForExpElement().
Referenced by buildSparqlCondition().
| SMWSparqlStoreQueryEngine::buildTrueCondition | ( | $ | joinVariable, | |
| $ | orderByProperty | |||
| ) | [protected] |
Create an SMWSparqlCondition from an empty (true) description.
May still require helper conditions for ordering.
| $joinVariable | string name, see buildSparqlCondition() | |
| $orderByProperty | mixed SMWDIProperty or null, see buildSparqlCondition() |
Definition at line 866 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByDataForProperty().
Referenced by buildConjunctionCondition(), buildDisjunctionCondition(), buildSparqlCondition(), and buildValueCondition().
| SMWSparqlStoreQueryEngine::getNextVariable | ( | ) | [protected] |
Get a fresh unused variable name for building SPARQL conditions.
Definition at line 877 of file SMW_SparqlStoreQueryEngine.php.
Referenced by buildDisjunctionCondition(), and buildPropertyCondition().
| SMWSparqlStoreQueryEngine::addOrderByDataForProperty | ( | SMWSparqlCondition &$ | sparqlCondition, | |
| $ | mainVariable, | |||
| $ | orderByProperty, | |||
| $ | diType = SMWDataItem::TYPE_NOTYPE | |||
| ) | [protected] |
Extend the given SPARQL condition by a suitable order by variable, if an order by property is set.
| SMWSparqlCondition | $sparqlCondition condition to modify | |
| string | $mainVariable the variable that represents the value to be ordered | |
| mixed | $orderByProperty SMWDIProperty or null | |
| integer | $diType DataItem type id if known, or SMWDataItem::TYPE_NOTYPE to determine it from the property |
Definition at line 890 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByData(), SMWDataValueFactory::getDataItemId(), and SMWDataItem::TYPE_NOTYPE.
Referenced by buildClassCondition(), buildConjunctionCondition(), buildDisjunctionCondition(), buildNamespaceCondition(), buildPropertyCondition(), buildTrueCondition(), and buildValueCondition().
| SMWSparqlStoreQueryEngine::addOrderByData | ( | SMWSparqlCondition &$ | sparqlCondition, | |
| $ | mainVariable, | |||
| $ | diType | |||
| ) | [protected] |
Extend the given SPARQL condition by a suitable order by variable, possibly adding conditions if required for the type of data.
| SMWSparqlCondition | $sparqlCondition condition to modify | |
| string | $mainVariable the variable that represents the value to be ordered | |
| integer | $diType DataItem type id |
Definition at line 911 of file SMW_SparqlStoreQueryEngine.php.
References SMWExporter::getSpecialPropertyResource(), and SMWDataItem::TYPE_WIKIPAGE.
Referenced by addMissingOrderByConditions(), addOrderByDataForProperty(), and buildValueCondition().
| SMWSparqlStoreQueryEngine::addMissingOrderByConditions | ( | SMWSparqlCondition &$ | sparqlCondition | ) | [protected] |
Extend the given SMWSparqlCondition with additional conditions to ensure that it can be ordered by all requested properties.
After this operation, every key in m_sortkeys is assigned to a query variable by $sparqlCondition->orderVariables.
| SMWSparqlCondition | $sparqlCondition condition to modify |
Definition at line 930 of file SMW_SparqlStoreQueryEngine.php.
References addOrderByData(), buildSparqlCondition(), SMWSparqlCondition::getWeakConditionString(), and SMWDataItem::TYPE_WIKIPAGE.
Referenced by getSparqlCondition().
| SMWSparqlStoreQueryEngine::getSparqlOptions | ( | SMWQuery $ | query, | |
| SMWSparqlCondition $ | sparqlCondition | |||
| ) | [protected] |
Get a SPARQL option array for the given query.
| SMWQuery | $query | |
| SMWSparqlCondition | $sparqlCondition (storing order by variable names) |
Definition at line 955 of file SMW_SparqlStoreQueryEngine.php.
References $smwgQRandSortingSupport, and $smwgQSortingSupport.
Referenced by getCountQueryResult(), getDebugQueryResult(), and getInstanceQueryResult().
| const SMWSparqlStoreQueryEngine::RESULT_VARIABLE = 'result' |
The name of the SPARQL variable that represents the query result.
Definition at line 240 of file SMW_SparqlStoreQueryEngine.php.
SMWSparqlStoreQueryEngine::$m_variableCounter = 0 [protected] |
Definition at line 246 of file SMW_SparqlStoreQueryEngine.php.
SMWSparqlStoreQueryEngine::$m_sortkeys [protected] |
Definition at line 253 of file SMW_SparqlStoreQueryEngine.php.
SMWSparqlStoreQueryEngine::$m_store [protected] |
Definition at line 259 of file SMW_SparqlStoreQueryEngine.php.
1.5.6