Class: RdqlDbEngine ---------------------------------------------------------------------------------- This class performs as RDQL query on a DbModel. Provided an rdql query parsed into an array of php variables and constraints at first the engine generates an sql statement and queries the database for tuples matching all patterns from the WHERE clause of the given RDQL query. Subsequently the result set is is filtered with evaluated boolean expressions from the AND clause of the given RDQL query. <BR><BR>History:<UL> <LI>09-27-2004 : Multiple queries bug fixed</LI> <LI>05-12-2004 : Bug in the handling of empty Literals fixed.</LI> <LI>08-29-2003 : Function filterTuples(): some bugs fixed:
|
rsIndexesWhen an RDQL query is performed on a DbModel, in first step the engine searches in database for triples matching the Rdql-WHERE clause. A recordSet is returned. $rsIndexes maps select and filter variables to their corresponding indexes in the returned recordSet.
_convertRsRowToQueryResultRow| PHP | array _convertRsRowToQueryResultRow(unknown $record) |
|---|
Converts a single row of ADORecordSet->fields array to the format of $queryResult array using pointers to indexes ($this->rsIndexes) in RecordSet->fields.
Arguments
Return
[?VARNAME]['value'] = string ['nType'] = string ['l_lang'] = string ['l_dtype'] = string
_generateSql_SelectVar| PHP | string _generateSql_SelectVar(string $varName, unknown $index) |
|---|
Generate a piece of an sql select statement for a variable. Look first if the given variable is defined as a pattern object. (So you can select the node type, literal lang and dtype) If not found - look for subjects and select node label and type. If there is no result either go to predicates. Predicates are always resources therefore select only the node label.
Arguments
filterQueryResult| PHP | array filterQueryResult(unknown $recordSet) |
|---|
Filter tuples containing variables matching all patterns from the WHERE clause of an RDQL query. As a result of a database query using ADOdb these tuples are returned as an ADORecordSet object, which is then passed to this function.
Arguments
Return
[][?VARNAME]['value'] = string ['nType'] = string ['l_lang'] = string ['l_dtype'] = string
generateSql| PHP | string generateSql(integer $modelID) |
|---|
Generate an SQL string to query the database for tuples matching all patterns of $parsedQuery.
Arguments
generateSql_WhereClause| PHP | string generateSql_WhereClause(integer $modelID) |
|---|
Generate an SQL WHERE clause
Arguments
queryModel| PHP | array queryModel(unknown $dbModel, unknown $parsedQuery, boolean $returnNodes) |
|---|
Perform an RDQL Query on the given DbModel.
Arguments
Return
[][?VARNAME] = object Node (if $returnNodes = TRUE) OR array [][?VARNAME] = string
toNodes| PHP | array toNodes(unknown $queryResult) |
|---|
Convert variable values of $queryResult to objects (Node).
Arguments
Return
[][?VARNAME] = object Node
toString| PHP | array toString(unknown $queryResult) |
|---|
Serialize variable values of $queryResult to string.
Arguments
Return
[][?VARNAME] = string