/** * 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. * * @param object Statement $statement * @return boolean * @access public * @throws PhpError */ function remove($statement) { if (parent::contains($statement)) { if (in_array($statement->getLabelPredicate(), $this->supportedInference)) { } while (count($this->_removeFromInference($statement)) > 0) { } $this->findDeadEnds = array(); return parent::remove($statement); } else { return false; } }
/** * 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 * * @param object Statement $statement * @return boolean * @access public * @throws PhpError */ function remove($statement) { //If the statement is in the model if ($this->contains($statement)) { $inferenceRulesWereTouched = false; //If the statement was able to add inference rules if (in_array($statement->getLabelPredicate(), $this->supportedInference)) { $statementPositions = $this->_removeFromInference($statement); $inferenceRulesWereTouched = true; } else { $statementPositions = array(); //find the positions of the statements $statementPosition = -1; do { $statementPosition = $this->findFirstMatchOff($statement->getSubject(), $statement->getPredicate(), $statement->getObject(), $statementPosition + 1); if ($statementPosition != -1) { $statementPositions[] = $statementPosition; } } while ($statementPosition != -1); } //remove matching statements parent::remove($statement); foreach ($statementPositions as $statementPosition) { //if the statement was infered, remove it from the index of the infered statements. if (in_array($statementPosition, $this->infPos)) { unset($this->infPos[$statementPosition]); } } if ($inferenceRulesWereTouched) { //remove the statement and re-entail the model $this->removeInfered(); $this->applyInference(); } return true; } else { return false; } }