Class InfModelF

Description

A InfModelF extends the InfModel Class, with a forward chaining algorithm.

If a new statement is added, it is enferd at once and all the entailed statements are added too. When adding or removing a statement, that produced a new inference rule, all entailed statements are discarded and the whole base model is infered again. The InfModelF is safe for loops in Ontologies, that would cause infinite loops.

Located in /infModel/InfModelF.php (line 23)

Object
   |
   --Model
      |
      --MemModel
         |
         --InfModel
            |
            --InfModelF
Variable Summary
array $infPos
Method Summary
InfModelF InfModelF ([string $baseURI = NULL])
void add (object Statement $statement)
void addModel ( &$model, object Model $model)
boolean addWithoutDuplicates ( &$statement, object Statement $statement)
void applyInference ()
array entailStatement ( &$statement, object Statement $statement)
object MemModel getBaseMemModel ()
object MemModel &getMemModel ()
void load (string $filename, [string $type = NULL])
boolean remove (object Statement $statement)
void removeInfered ()
string toString ()
array _entailStatementRec (object Statement $statement,  &$infStatementsIndex, array $infStatementsIndex)
Variables
boolean $inferenceEnabled (line 42)

Variable that influences the habbit when adding statements.

Used by the loadModel method to increase performance.

  • access: private
array $infPos (line 32)

Array that holds the position of the infered statements in the model.

  • access: private

Inherited Variables

Inherited from InfModel

InfModel::$infRules
InfModel::$infRulesEntailIndex
InfModel::$infRulesTriggerIndex
InfModel::$statementRuleIndex
InfModel::$supportedInference

Inherited from MemModel

MemModel::$indexArr
MemModel::$indexed
MemModel::$parsedNamespaces
MemModel::$triples

Inherited from Model

Model::$baseURI
Model::$bNodeCount
Methods
Constructor InfModelF (line 52)

Constructor You can supply a base_uri.

  • access: public
InfModelF InfModelF ([string $baseURI = NULL])
  • string $baseURI
add (line 70)

Adds a new triple to the MemModel without checking if the statement is already in the MemModel.

So if you want a duplicate free MemModel use the addWithoutDuplicates() function (which is slower then add()) The statement is infered and all entailed statements are added.

  • throws: PhpError
  • access: public
void add (object Statement $statement)
  • object Statement $statement

Redefinition of:
InfModel::add()
Adds a new triple to the Model without checking if the statement is already in the Model.
addModel (line 395)

Adds another model to this MemModel.

Duplicate statements are not removed. If you don't want duplicates, use unite(). If any statement of the model to be added to this model contains a blankNode with an identifier already existing in this model, a new blankNode is generated.

  • throws: phpErrpr
  • access: public
void addModel ( &$model, object Model $model)
  • object Model $model
  • &$model

Redefinition of:
MemModel::addModel()
Adds another model to this MemModel.
addWithoutDuplicates (line 107)

Checks if a new statement is already in the MemModel and adds the statement, if it is not in the MemModel.

addWithoutDuplicates() is significantly slower then add(). Retruns TRUE if the statement is added. FALSE otherwise. The statement is infered and all entailed statements are added.

  • throws: PhpError
  • access: public
boolean addWithoutDuplicates ( &$statement, object Statement $statement)
  • object Statement $statement
  • &$statement

Redefinition of:
MemModel::addWithoutDuplicates()
Checks if a new statement is already in the MemModel and adds the statement, if it is not in the MemModel.
applyInference (line 140)

Entails every statement and adds the entailments if not already in the model.

  • access: private
void applyInference ()
entailStatement (line 168)

Entails a statement by recursively using the _entailStatementRec method.

  • return: of statements
  • access: public
array entailStatement ( &$statement, object Statement $statement)
  • object Statement $statement
  • &$statement
getBaseMemModel (line 305)

Create a MemModel containing only the base triples (without inferred statements) of the current InfModelF.

  • access: public
object MemModel getBaseMemModel ()
getMemModel (line 287)

Create a MemModel containing all the triples (including inferred statements) of the current InfModelF.

  • access: public
object MemModel &getMemModel ()
load (line 258)

Load a model from a file containing RDF, N3 or N-Triples.

This function recognizes the suffix of the filename (.n3 or .rdf) and calls a suitable parser, if no $type is given as string ("rdf" "n3" "nt"); If the model is not empty, the contents of the file is added to this DbModel.

While loading the model, the inference entailing is disabled, but new inference rules are added to increase performance.

  • access: public
void load (string $filename, [string $type = NULL])
  • string $filename
  • string $type

Redefinition of:
Model::load()
Load a model from a file containing RDF, N3, N-Triples or a xhtml document containing RDF.
remove (line 330)

Removes the triple from the MemModel.

TRUE if the triple is removed. FALSE otherwise.

Checks, if it touches any statements, that added inference rules to the model

  • throws: PhpError
  • access: public
boolean remove (object Statement $statement)
  • object Statement $statement

Redefinition of:
MemModel::remove()
Removes the triple from the MemModel.
removeInfered (line 230)

Removes all infered statements from the model but keeps the infernece rules.

  • access: public
void removeInfered ()
toString (line 275)

Short Dump of the InfModelF.

  • access: public
string toString ()

Redefinition of:
MemModel::toString()
Short Dump of the MemModel.
_entailStatementRec (line 187)

Recursive method, that checks the statement with the trigger of every rule. If the trigger matches and entails new statements, those statements are recursively infered too.

The $infStatementsIndex array holds lready infered statements to prevent infinite loops.

  • return: of statements
  • access: private
array _entailStatementRec (object Statement $statement,  &$infStatementsIndex, array $infStatementsIndex)
  • object Statement $statement
  • array $infStatementsIndex
  • &$infStatementsIndex

Inherited Methods

Inherited From InfModel

InfModel::InfModel()
InfModel::add()
InfModel::findRegex()
InfModel::findVocabulary()
InfModel::getSchema()
InfModel::replace()
InfModel::_addInfRule()
InfModel::_addInfruleToIndex()
InfModel::_addToInference()
InfModel::_findRuleEntailmentInIndex()
InfModel::_findRuleTriggerInIndex()
InfModel::_removeFromInference()

Inherited From MemModel

MemModel::MemModel()
MemModel::add()
MemModel::addModel()
MemModel::addNamespace()
MemModel::addParsedNamespaces()
MemModel::addWithoutDuplicates()
MemModel::close()
MemModel::contains()
MemModel::containsAll()
MemModel::containsAny()
MemModel::equals()
MemModel::find()
MemModel::findAsIterator()
MemModel::findCount()
MemModel::findFirstMatchingStatement()
MemModel::findFirstMatchOff()
MemModel::findRegex()
MemModel::findVocabulary()
MemModel::getIndexType()
MemModel::getParsedNamespaces()
MemModel::getStatementIterator()
MemModel::index()
MemModel::intersect()
MemModel::isEmpty()
MemModel::isIndexed()
MemModel::iterFind()
MemModel::matchStatement()
MemModel::rdqlQuery()
MemModel::rdqlQueryAsIterator()
MemModel::reify()
MemModel::remove()
MemModel::removeNamespace()
MemModel::replace()
MemModel::saveAs()
MemModel::setBaseURI()
MemModel::size()
MemModel::subtract()
MemModel::toString()
MemModel::toStringIncludingTriples()
MemModel::unite()
MemModel::writeAsHtml()
MemModel::writeAsHtmlTable()
MemModel::writeRdfToString()
MemModel::_containsIndex()
MemModel::_findInIndex()
MemModel::_findMatchIndex()
MemModel::_indexOpr()

Inherited From Model

Model::Model()
Model::findForward()
Model::getBaseURI()
Model::getMemModelByRDQL()
Model::getOntModel()
Model::getResModel()
Model::getUniqueResourceURI()
Model::load()
Model::sparqlQuery()
Model::visualize()
Model::_addStatementFromAnotherModel()

Inherited From Object

Object::toString()

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