Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rely on exceptions

  • Loading branch information...
commit e7ce013432bfc529954cfc76614bb5e11134911e 1 parent 2d12294
@CloCkWeRX CloCkWeRX authored
Showing with 3 additions and 63 deletions.
  1. +3 −63 RDF/Statement.php
View
66 RDF/Statement.php
@@ -50,18 +50,9 @@ function factory($subj, $pred, $obj)
{
$statement =& new RDF_Statement;
- $return = $statement->setSubject($subj);
- if (PEAR::isError($return)) {
- return $return;
- }
- $return = $statement->setPredicate($pred);
- if (PEAR::isError($return)) {
- return $return;
- }
- $return = $statement->setObject($obj);
- if (PEAR::isError($return)) {
- return $return;
- }
+ $statement->setSubject($subj);
+ $statement->setPredicate($pred);
+ $statement->setObject($obj);
return $statement;
}
@@ -252,25 +243,16 @@ function equals($that)
}
$result = $this->subj->equals($that->getSubject());
- if (PEAR::isError($result)) {
- return $result;
- }
if (!$result) {
return false;
}
$result = $this->pred->equals($that->getPredicate());
- if (PEAR::isError($result)) {
- return $result;
- }
if (!$result) {
return false;
}
$result = $this->obj->equals($that->getObject());
- if (PEAR::isError($result)) {
- return $result;
- }
if (!$result) {
return false;
}
@@ -313,63 +295,21 @@ function &reify(&$model_or_bNodeID)
$statementModel =& new RDF_Model_Memory();
$thisStatement =& RDF_BlankNode::factory($model_or_bNodeID);
}
- if (PEAR::isError($thisStatement)) {
- return $thisStatement;
- }
$RDFstatement =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_STATEMENT);
- if (PEAR::isError($RDFstatement)) {
- return $RDFstatement;
- }
$RDFtype =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_TYPE);
- if (PEAR::isError($RDFtype)) {
- return $RDFtype;
- }
$RDFsubject =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_SUBJECT);
- if (PEAR::isError($RDFsubject)) {
- return $RDFsubject;
- }
$RDFpredicate =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_PREDICATE);
- if (PEAR::isError($RDFpredicate)) {
- return $RDFpredicate;
- }
$RDFobject =& RDF_Resource::factory(RDF_NAMESPACE_URI . RDF_OBJECT);
- if (PEAR::isError($RDFobject )) {
- return $RDFobject ;
- }
$statement =& RDF_Statement::factory($thisStatement, $RDFtype, $RDFstatement);
- if (PEAR::isError($statement)) {
- return $statement;
- }
$result = $statementModel->add($statement);
- if (PEAR::isError($result)) {
- return $result;
- }
$statement =& RDF_Statement::factory($thisStatement, $RDFsubject, $this->getSubject());
- if (PEAR::isError($statement)) {
- return $statement;
- }
$result = $statementModel->add($statement);
- if (PEAR::isError($result)) {
- return $result;
- }
$statement =& RDF_Statement::factory($thisStatement, $RDFpredicate, $this->getPredicate());
- if (PEAR::isError($statement)) {
- return $statement;
- }
$result = $statementModel->add($statement);
- if (PEAR::isError($result)) {
- return $result;
- }
$statement =& RDF_Statement::factory($thisStatement, $RDFobject, $this->getObject());
- if (PEAR::isError($statement)) {
- return $statement;
- }
$result = $statementModel->add($statement);
- if (PEAR::isError($result)) {
- return $result;
- }
return $statementModel;
}
Please sign in to comment.
Something went wrong with that request. Please try again.