Class RdqlMemEngine

Description

This class performes as RDQL query on a MemModel.

Provided an rdql query parsed into an array of php variables and constraints at first the engine searches for tuples matching all patterns from the WHERE clause of the given RDQL query. Then the query result set is filtered with evaluated boolean expressions from the AND clause of the given RDQL query.

  • access: public
  • author: Radoslaw Oldakowski <radol@gmx.de>
  • version: $Id: RdqlMemEngine.html,v 1.15 2006/06/26 12:34:21 tgauss Exp $

Located in /rdql/RdqlMemEngine.php (line 22)

Object
   |
   --RdqlEngine
      |
      --RdqlMemEngine
Variable Summary
array $parsedQuery
Method Summary
array filterTuples (array &$finalRes)
object MemModel findTriplesMatchingPattern ( &$memModel, string $subjLabel, string $predLabel, string $obj_is, string $objLabel,  $objLang, string $objDtype,  &$intBindings, object MemModel $memModel, string $objLanguage, array $intBindings)
array findTuplesMatchingAllPatterns (object MemModel &$memModel)
array findTuplesMatchingOnePattern (object MemModel &$memModel, array &$pattern)
array joinTuples (array &$finalRes, array &$res)
array &queryModel (object MemModel &$memModel, array &$parsedQuery, [boolean $returnNodes = TRUE])
array selectVariables (array &$finalRes)
array toString (array &$finalRes)
boolean _checkIntBindings (object statement &$triple, array &$intBindings)
boolean _equalsLangDtype (object Literal $literal,  $lang,  $dtype, string $dtype1, string $dtype2)
Variables
array $parsedQuery (line 51)

Parsed query variables and constraints.

  • var: ['selectVars'][] = ?VARNAME ['sources'][] = URI ['patterns'][]['subject']['value'] = VARorURI ['predicate']['value'] = VARorURI ['object']['value'] = VARorURIorLiterl ['is_literal'] = boolean ['l_lang'] = string ['l_dtype'] = string ['filters'][]['string'] = string ['evalFilterStr'] = string ['reqexEqExprs'][]['var'] = ?VARNAME ['operator'] = (eq | ne) ['regex'] = string ['strEqExprs'][]['var'] = ?VARNAME ['operator'] = (eq | ne) ['value'] = string ['value_type'] = ('variable' | 'URI' | 'Literal') ['value_lang'] = string ['value_dtype'] = string ['numExpr']['vars'][] = ?VARNAME ( [] stands for an integer index - 0..N )
  • access: private
Methods
filterTuples (line 335)

Filter the result-set of query variables by evaluating each filter from the AND clause of the RDQL query.

  • return: [][?VARNAME] = object Node
  • access: private
array filterTuples (array &$finalRes)
  • array &$finalRes: [][?VARNAME] = object Node
findTriplesMatchingPattern (line 210)

Search in $memModel for triples matching one pattern from the WHERE clause.

'ANY' input for $subjLabel..$objLabel, $obj_is will match anything. NULL input for $objDtype will only match obj->dtype = NULL NULL input for $objLanguage will match obj->lang = NULL or anything if a literal is datatyped (except for XMLLiterals and plain literals) This method also checks internal bindings if provided.

  • access: private
object MemModel findTriplesMatchingPattern ( &$memModel, string $subjLabel, string $predLabel, string $obj_is, string $objLabel,  $objLang, string $objDtype,  &$intBindings, object MemModel $memModel, string $objLanguage, array $intBindings)
  • object MemModel $memModel
  • string $subjLabel
  • string $predLabel
  • string $objLabel
  • string $obj_is
  • string $objLanguage
  • string $objDtype
  • array $intBindings: [] = string
  • &$memModel
  • $objLang
  • &$intBindings
findTuplesMatchingAllPatterns (line 96)

Find triples matching all patterns of an RDQL query and return an array with variables from all patterns and their corresponding values.

The variable values returned are instances of object Node.

  • return: [][?VARNAME] = object Node
  • access: private
array findTuplesMatchingAllPatterns (object MemModel &$memModel)
  • object MemModel &$memModel
findTuplesMatchingOnePattern (line 122)

Find tuples matching one pattern and return an array with pattern variables and their corresponding values (instances of object Node).

  • return: [][?VARNAME] = object Node
  • access: private
array findTuplesMatchingOnePattern (object MemModel &$memModel, array &$pattern)
  • object MemModel &$memModel
  • array &$pattern: ['subject']['value'] = VARorURI ['predicate']['value'] = VARorURI ['object']['value'] = VARorURIorLiterl ['is_literal'] = boolean ['l_lang'] = string ['l_dtype'] = string
joinTuples (line 272)

Perform an SQL-like inner join on two resultSets.

  • return: [][?VARNAME] = object Node
  • access: private
array joinTuples (array &$finalRes, array &$res)
  • array &$finalRes: [][?VARNAME] = object Node
  • array &$res: [][?VARNAME] = object Node
queryModel (line 65)

Perform an RDQL Query on the given MemModel.

  • return: [][?VARNAME] = object Node (if $returnNodes = TRUE) OR array [][?VARNAME] = string
  • access: public
array &queryModel (object MemModel &$memModel, array &$parsedQuery, [boolean $returnNodes = TRUE])
  • object MemModel &$memModel
  • array &$parsedQuery: (the same format as $this->parsedQuery)
  • boolean $returnNodes
selectVariables (line 445)

Remove all conditional variables from the result-set and leave only variables specified in the SELECT clause of the RDQL query.

  • return: [][?VARNAME] = object Node
  • access: private
array selectVariables (array &$finalRes)
  • array &$finalRes: [][?VARNAME] = object Node
toString (line 476)

Convert the variable values of $finalRes from objects to their string serialization.

  • return: [][?VARNAME] = string
  • access: private
array toString (array &$finalRes)
  • array &$finalRes: [][?VARNAME] = object Node

Redefinition of:
Object::toString()
Serializes a object into a string
_checkIntBindings (line 504)

Check if the given triple meets pattern internal bindings e.g. (?x, ?z, ?x) ==> statement subject must be identical with the statement object

  • access: private
boolean _checkIntBindings (object statement &$triple, array &$intBindings)
  • object statement &$triple
  • array &$intBindings: [] = string
_equalsLangDtype (line 539)

Check if the lang and dtype of the passed object Literal are equal $lang and $dtype !!! Language only differentiates literals in rdf:XMLLiterals and plain literals (xsd:string).

!!! Therefore if a literal is datatyped ignore the language.

  • access: private
boolean _equalsLangDtype (object Literal $literal,  $lang,  $dtype, string $dtype1, string $dtype2)
  • object Literal $literal
  • string $dtype1
  • string $dtype2
  • $lang
  • $dtype

Inherited Methods

Inherited From RdqlEngine

RdqlEngine::writeQueryResultAsHtmlTable()

Inherited From Object

Object::toString()

Documentation generated on Mon, 26 Jun 2006 14:26:00 +0200 by phpDocumentor 1.3.0RC6