[ Expand All ] [ Collapse All ] - [ Properties (1) ] [ Methods (10) ] - [ Legend ]

RdqlMemEngine Class v. V0.9.1

Object
RdqlEngine
RdqlMemEngine

Class: RdqlMemEngine ----------------------------------------------------------------------------------

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.

<BR><BR>History:<UL> <LI>09-08-2004 : findTriplesMatchingPattern() rewritten to only use the $model->find() function for accessing the model. Changed the method of comparing literals to literals->equals according to actual specification <LI>05-12-2004 : Bug in the handling of empty Literals fixed.</LI> <LI>03-17-2004 : Function findTuplesMatchingOnePattern() pass-by-reference bug fixed</LI> <LI>08-29-2003 : Function filterTuples(): some bugs fixed:

  • strEqExpr with NE operator
  • regExExpr combined with other expr. and negation (!) e.g. !(?x ~~ "/sth/" && ?x > 5)

AuthorRadoslaw Oldakowski
Properties implemented by RdqlMemEngine
private method parsedQuery

Parsed query variables and constraints.

Methods implemented by RdqlMemEngine
private method _checkIntBindings

PHPboolean _checkIntBindings(unknown $triple, unknown $intBindings)

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

Arguments

private method _equalsLangDtype

PHPboolean _equalsLangDtype(unknown $literal, unknown $lang, unknown $dtype)

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.

Arguments

private method filterTuples

PHParray filterTuples(unknown $finalRes)

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

Arguments

Return

[][?VARNAME] = object Node

private method findTriplesMatchingPattern

PHPobject findTriplesMatchingPattern(unknown $memModel, string $subjLabel, string $predLabel, string $obj_is, string $objLabel, unknown $objLang, string $objDtype, array $intBindings)

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.

Arguments

Return

MemModel

private method findTuplesMatchingAllPatterns

PHParray findTuplesMatchingAllPatterns(unknown $memModel)

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.

Arguments

Return

[][?VARNAME] = object Node

private method findTuplesMatchingOnePattern

PHParray findTuplesMatchingOnePattern(unknown $memModel, unknown $pattern)

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

Arguments

Return

[][?VARNAME] = object Node

private method joinTuples

PHParray joinTuples(unknown $finalRes, unknown $res)

Perform an SQL-like inner join on two resultSets.

Arguments

Return

[][?VARNAME] = object Node

public method queryModel

PHParray queryModel(unknown $memModel, unknown $parsedQuery, boolean $returnNodes)

Perform an RDQL Query on the given MemModel.

Arguments

Return

[][?VARNAME] = object Node (if $returnNodes = TRUE) OR array [][?VARNAME] = string

private method selectVariables

PHParray selectVariables(unknown $finalRes)

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

Arguments

Return

[][?VARNAME] = object Node

private method toString

PHParray toString(unknown $finalRes)

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

Arguments

Return

[][?VARNAME] = string

Generated by PHPEdit - Copyright © 1999-2004 - Sébastien Hordeaux - WaterProof SARL