Skip to content
Browse files

- propagate PEAR errors to the user

git-svn-id: http://svn.php.net/repository/pear/packages/RDF/trunk@175810 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 18da9e6 commit b38ba3899714ce7e941343ff16e910a896c7b466 Lukas Smith committed Dec 28, 2004
Showing with 312 additions and 69 deletions.
  1. +1 −1 RDF/BlankNode.php
  2. +1 −1 RDF/FindIterator.php
  3. +1 −1 RDF/Literal.php
  4. +32 −8 RDF/Model.php
  5. +123 −33 RDF/Model/Memory.php
  6. +47 −9 RDF/Parser.php
  7. +1 −1 RDF/Resource.php
  8. +27 −5 RDF/Serializer.php
  9. +77 −8 RDF/Statement.php
  10. +2 −2 RDF/Store/MDB.php
View
2 RDF/BlankNode.php
@@ -30,7 +30,7 @@ class RDF_BlankNode extends RDF_Resource
*/
function factory($namespace_or_uri_or_model , $localName = null)
{
- $blanknode = new RDF_BlankNode;
+ $blanknode =& new RDF_BlankNode;
if (is_a($namespace_or_uri_or_model, 'RDF_Model')) {
// generate identifier
$id = $namespace_or_uri_or_model->getUniqueResourceURI(RDF_BNODE_PREFIX);
View
2 RDF/FindIterator.php
@@ -56,7 +56,7 @@ class RDF_FindIterator extends RDF_Object
*/
function RDF_FindIterator(&$model, &$sub, &$pred, &$obj)
{
- $this->model = &$model;
+ $this->model =& $model;
$this->subject =& $sub;
$this->predicate =& $pred;
$this->object =& $obj;
View
2 RDF/Literal.php
@@ -47,7 +47,7 @@ class RDF_Literal extends RDF_Node
*/
function factory($str, $language = null)
{
- $literal = new RDF_Literal;
+ $literal =& new RDF_Literal;
$literal->dtype = null;
$literal->label = $str;
View
40 RDF/Model.php
@@ -67,7 +67,13 @@ function load($filename, $type = null)
}
}
$temp =& $parser->generateModel($filename);
- $this->addModel($temp);
+ if (PEAR::isError($temp)) {
+ return $temp;
+ }
+ $result = $this->addModel($temp);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
if ($this->getBaseURI() == null) {
$this->setBaseURI($temp->getBaseURI());
}
@@ -89,10 +95,19 @@ function _addStatementFromAnotherModel($statement, &$blankNodes_tmp)
if (is_a($subject, 'RDF_BlankNode')) {
$label = $subject->getLabel();
if (!array_key_exists($label, $blankNodes_tmp)) {
- if ($this->findFirstMatchingStatement($subject, null, null)
- || $this->findFirstMatchingStatement(null, null, $subject)
- ) {
+ $res1 = $this->findFirstMatchingStatement($subject, null, null);
+ if (PEAR::isError($res1)) {
+ return $res1;
+ }
+ $res2 = $this->findFirstMatchingStatement(null, null, $subject);
+ if (PEAR::isError($res2)) {
+ return $res2;
+ }
+ if ($res1 || $res2) {
$blankNodes_tmp[$label] =& RDF_BlankNode::factory($this);
+ if (PEAR::isError($blankNodes_tmp[$label])) {
+ return $blankNodes_tmp[$label];
+ }
$statement->subj = $blankNodes_tmp[$label];
} else {
$blankNodes_tmp[$label] = $subject;
@@ -105,10 +120,19 @@ function _addStatementFromAnotherModel($statement, &$blankNodes_tmp)
if (is_a($object, 'RDF_BlankNode')) {
$label = $object->getLabel();
if (!array_key_exists($label, $blankNodes_tmp)) {
- if ($this->findFirstMatchingStatement($object, null, null)
- || $this->findFirstMatchingStatement(null, null, $object)
- ) {
+ $res1 = $this->findFirstMatchingStatement($object, null, null);
+ if (PEAR::isError($res1)) {
+ return $res1;
+ }
+ $res2 = $this->findFirstMatchingStatement(null, null, $object);
+ if (PEAR::isError($res2)) {
+ return $res2;
+ }
+ if ($res1 || $res2) {
$blankNodes_tmp[$label] =& RDF_BlankNode::factory($this);
+ if (PEAR::isError($blankNodes_tmp[$label])) {
+ return $blankNodes_tmp[$label];
+ }
$statement->obj = $blankNodes_tmp[$label];
} else {
$blankNodes_tmp[$label] = $object;
@@ -118,7 +142,7 @@ function _addStatementFromAnotherModel($statement, &$blankNodes_tmp)
}
}
- $this->add($statement);
+ return $this->add($statement);
}
} // end: Model
View
156 RDF/Model/Memory.php
@@ -200,7 +200,7 @@ function toStringIncludingTriples()
function writeAsHtml()
{
$ser =& new RDF_Serializer();
- $rdf = &$ser->serialize($this);
+ $rdf =& $ser->serialize($this);
$rdf = htmlspecialchars($rdf, ENT_QUOTES);
$rdf = str_replace(' ', ' ', $rdf);
$rdf = nl2br($rdf);
@@ -226,7 +226,7 @@ function writeAsHtmlTable()
function writeRDFToString()
{
$ser =& new RDF_Serializer();
- $rdf = &$ser->serialize($this);
+ $rdf =& $ser->serialize($this);
return $rdf;
}
@@ -281,16 +281,18 @@ function contains(&$statement)
for ($i = 1; $i <= $this->index[$subject->getLabel()][0]; $i++) {
$t = $this->triples[$this->index[$subject->getLabel()][$i]];
- if ($t->equals($statement)) {
- return true;
+ $result = $t->equals($statement);
+ if ($result) {
+ return $result;
}
}
return false;
} else {
// If there is no index, use linear search.
foreach($this->triples as $value) {
- if ($value->equals($statement)) {
- return true;
+ $result = $value->equals($statement);
+ if ($result) {
+ return $result;
}
}
return false;
@@ -436,14 +438,20 @@ function find($subject, $predicate, $object)
for ($i = 1; $i <= $this->index[$subject->getLabel()][0]; $i++) {
$t = $this->triples[$this->index[$subject->getLabel()][$i]];
if ($this->matchStatement($t, $subject, $predicate, $object)) {
- $res->add($t);
+ $result = $res->add($t);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
} else {
// If there is no index, use linear search.
foreach($this->triples as $value) {
if ($this->matchStatement($value, $subject, $predicate, $object)) {
- $res->add($value);
+ $result = $res->add($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
}
@@ -480,7 +488,10 @@ function findRegex($subject_regex, $predicate_regex, $object_regex)
&& ($predicate_regex == null || preg_match($predicate_regex, $value->pred->getLabel()))
&& ($object_regex == null || preg_match($object_regex, $value->obj->getLabel()))
) {
- $res->add($value);
+ $result = $res->add($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
@@ -510,7 +521,10 @@ function findVocabulary($vocabulary)
foreach($this->triples as $value) {
if (RDF_Util::getNamespace($value->getPredicate()) == $vocabulary) {
- $res->add($value);
+ $result = $res->add($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
return $res;
@@ -532,6 +546,9 @@ function findVocabulary($vocabulary)
function findFirstMatchingStatement($subject, $predicate, $object)
{
$res = $this->find($subject, $predicate, $object);
+ if (PEAR::isError($res)) {
+ return $res;
+ }
if ($res->size() != 0) {
return $res->triples[0];
} else {
@@ -554,6 +571,9 @@ function findFirstMatchingStatement($subject, $predicate, $object)
function findCount($subject, $predicate, $object)
{
$res = $this->find($subject, $predicate, $object);
+ if (PEAR::isError($res)) {
+ return $res;
+ }
return $res->size();
}
@@ -587,14 +607,26 @@ function replace($subject, $predicate, $object, $replacement)
}
foreach($this->triples as $key => $value) {
- if ($this->triples[$key]->subj->equals($subject)) {
+ $result = $this->triples[$key]->subj->equals($subject);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($result) {
$this->triples[$key]->subj = $replacement;
$this->indexed = false;
}
- if ($this->triples[$key]->pred->equals($predicate)) {
+ $result = $this->triples[$key]->pred->equals($predicate);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($result) {
$this->triples[$key]->pred = $replacement;
}
- if ($this->triples[$key]->obj->equals($object)) {
+ $result = $this->triples[$key]->obj->equals($object);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($result) {
$this->triples[$key]->obj = $replacement;
}
}
@@ -613,16 +645,34 @@ function replace($subject, $predicate, $object, $replacement)
*/
function matchStatement($statement, $subject, $predicate, $object)
{
- if ($subject != null && !$statement->subj->equals($subject)) {
- return false;
+ if ($subject) {
+ $result = $statement->subj->equals($subject);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if (!$result) {
+ return false;
+ }
}
- if ($predicate != null && !($statement->pred->equals($predicate))) {
- return false;
+ if ($predicate) {
+ $result = $statement->pred->equals($predicate);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if (!$result) {
+ return false;
+ }
}
- if ($object != null && !($statement->obj->equals($object))) {
- return false;
+ if ($object) {
+ $result = $statement->obj->equals($object);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if (!$result) {
+ return false;
+ }
}
return true;
@@ -643,8 +693,17 @@ function getUniqueResourceURI($prefix)
while (true) {
$uri = $this->getBaseURI() . $prefix . $counter;
$tempbNode =& RDF_BlankNode::factory($uri);
+ if (PEAR::isError($tempbNode)) {
+ return $tempbNode;
+ }
$res1 = $this->find($tempbNode, null, null);
+ if (PEAR::isError($res1)) {
+ return $res1;
+ }
$res2 = $this->find(null, null, $tempbNode);
+ if (PEAR::isError($res2)) {
+ return $res2;
+ }
if ($res1->size() == 0 && $res2->size() == 0) {
return $uri;
}
@@ -677,7 +736,11 @@ function equals(&$that)
return false;
}
- if (!$this->containsAll($that)) {
+ $result = $this->containsAll($that);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if (!$result) {
return false;
}
return true;
@@ -722,12 +785,18 @@ function &unite(&$model)
if (is_a($model, 'RDF_Model_Memory')) {
foreach($model->triples as $value) {
- $res->addWithoutDuplicates($value);
+ $result = $res->addWithoutDuplicates($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
} elseif (is_a($model, 'RDF_Model_MDB')) {
- $Model_Memory = &$model->getMemModel();
+ $Model_Memory =& $model->getMemModel();
foreach($Model_Memory->triples as $value) {
- $res->addWithoutDuplicates($value);
+ $result = $res->addWithoutDuplicates($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
@@ -756,12 +825,18 @@ function &subtract(&$model)
if (is_a($model, 'RDF_Model_Memory')) {
foreach($model->triples as $value) {
- $res->remove($value);
+ $result = $res->remove($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
} elseif (is_a($model, 'RDF_Model_MDB')) {
- $Model_Memory = &$model->getMemModel();
+ $Model_Memory =& $model->getMemModel();
foreach($Model_Memory->triples as $value) {
- $res->remove($value);
+ $result = $res->remove($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
@@ -789,14 +864,20 @@ function &intersect(&$model)
if (is_a($model, 'RDF_Model_Memory')) {
foreach($model->triples as $value) {
if ($this->contains($value)) {
- $res->add($value);
+ $result = $res->add($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
} elseif (is_a($model, 'RDF_Model_MDB')) {
- $Model_Memory = &$model->getMemModel();
+ $Model_Memory =& $model->getMemModel();
foreach($Model_Memory->triples as $value) {
if ($this->contains($value)) {
- $res->add($value);
+ $result = $res->add($value);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
}
@@ -826,12 +907,18 @@ function addModel(&$model)
if (is_a($model, 'RDF_Model_Memory')) {
foreach($model->triples as $value) {
- $this->_addStatementFromAnotherModel($value, $blankNodes_tmp);
+ $result = $this->_addStatementFromAnotherModel($value, $blankNodes_tmp);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
} elseif (is_a($model, 'RDF_Model_MDB')) {
$Model_Memory =& $model->getMemModel();
foreach($Model_Memory->triples as $value) {
- $this->_addStatementFromAnotherModel($value, $blankNodes_tmp);
+ $result = $this->_addStatementFromAnotherModel($value, $blankNodes_tmp);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
}
@@ -848,8 +935,11 @@ function &reify()
$res =& new RDF_Model_Memory($this->getBaseURI());
foreach($this->triples as $statement) {
- $pointer = &$statement->reify($res);
- $res->addModel($pointer);
+ $pointer =& $statement->reify($res);
+ $result = $res->addModel($pointer);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
return $res;
}
View
56 RDF/Parser.php
@@ -578,7 +578,8 @@ function is_valid_id($id)
}
if (!$result) {
- return RDF::raiseError(RDF_ERROR, null, null, 'illegal ID, nodeID or bagID attribute value');
+ return RDF::raiseError(RDF_ERROR, null, null,
+ 'illegal ID, nodeID or bagID attribute value');
}
return true;
@@ -594,7 +595,11 @@ function _resolve_id($id, &$buffer)
{
$id_buffer = '';
- if ($this->is_valid_id($id)) {
+ $result = $this->is_valid_id($id);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($result) {
$id_buffer = "#$id";
}
@@ -675,7 +680,7 @@ function _report_statement($subject_type, $subject, $predicate, $ordinal,
}
// call add statement
- $this->add_statement_to_model(
+ $result = $this->add_statement_to_model(
$this->rdf_parser['user_data'],
$subject_type,
$subject,
@@ -686,6 +691,9 @@ function _report_statement($subject_type, $subject, $predicate, $ordinal,
$xml_lang,
$datatype
);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
if ($bag_id) {
if ($statements == '') {
@@ -1058,7 +1066,10 @@ function _handle_resource_element($namespace_uri, $local_name, $attributes, $par
$this->rdf_parser['top']['subject_type'] = RDF_SUBJECT_TYPE_URI;
$this->rdf_parser['top']['subject'] = $id_buffer;
} else if ($node_id) {
- $this->is_valid_id($node_id);
+ $result = $this->is_valid_id($node_id);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
$this->rdf_parser['top']['subject_type'] = RDF_SUBJECT_TYPE_BNODE;
$this->rdf_parser['top']['subject'] = $node_id;
}
@@ -1240,7 +1251,10 @@ function _handle_property_element(&$namespace_uri, &$local_name, &$attributes)
}
if ($node_id) {
- $this->is_valid_id($node_id);
+ $result = $this->is_valid_id($node_id);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
if ($resource) {
return RDF::raiseError(RDF_ERROR, null, null,
@@ -1683,12 +1697,18 @@ function _start_element_handler($parser, $name, $attributes)
}
case RDF_IN_RDF:
$this->rdf_parser['top']['state'] = RDF_IN_DESCRIPTION;
- $this->_handle_resource_element($namespace_uri, $local_name, $attributes, '');
+ $result = $this->_handle_resource_element($namespace_uri, $local_name, $attributes, '');
+ if (PEAR::isError($result)) {
+ return $result;
+ }
break;
case RDF_IN_DESCRIPTION:
case RDF_IN_PROPERTY_PARSE_TYPE_RESOURCE:
$this->rdf_parser['top']['state'] = RDF_IN_PROPERTY_UNKNOWN_OBJECT;
- $this->_handle_property_element($namespace_uri, $local_name, $attributes);
+ $result = $this->_handle_property_element($namespace_uri, $local_name, $attributes);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
break;
case RDF_IN_PROPERTY_PARSE_TYPE_COLLECTION:
$this->_handle_collection_element($namespace_uri, $local_name, $attributes);
@@ -1699,12 +1719,15 @@ function _start_element_handler($parser, $name, $attributes)
$this->rdf_parser['top']['data'] = '';
$this->rdf_parser['top']['parent']['state'] = RDF_IN_PROPERTY_RESOURCE;
$this->rdf_parser['top']['state'] = RDF_IN_DESCRIPTION;
- $this->_handle_resource_element(
+ $result = $this->_handle_resource_element(
$namespace_uri,
$local_name,
$attributes,
$this->rdf_parser['top']['parent']
);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
break;
case RDF_IN_PROPERTY_LITERAL:
$this->_report_warning('no markup allowed in literals');
@@ -1888,8 +1911,14 @@ function add_statement_to_model(&$user_data, $subject_type, $subject,
} else {
$objsub =& RDF_Resource::factory($subject);
}
+ if (PEAR::isError($objsub)) {
+ return $objsub;
+ }
// create predicate
$objpred =& RDF_Resource::factory($predicate);
+ if (PEAR::isError($objpred)) {
+ return $objpred;
+ }
// create object
if (($object_type == RDF_OBJECT_TYPE_RESOURCE)
|| ($object_type == RDF_OBJECT_TYPE_BNODE)
@@ -1899,8 +1928,14 @@ function add_statement_to_model(&$user_data, $subject_type, $subject,
} else {
$objobj =& RDF_Resource::factory($object);
}
+ if (PEAR::isError($objobj)) {
+ return $objobj;
+ }
} else {
$objobj =& RDF_Literal::factory($object);
+ if (PEAR::isError($objobj)) {
+ return $objobj;
+ }
if ($datatype != '') {
$objobj->setDatatype($datatype);
} elseif ($xml_lang != "") {
@@ -1909,8 +1944,11 @@ function add_statement_to_model(&$user_data, $subject_type, $subject,
}
// create statement
$statement =& RDF_Statement::factory($objsub, $objpred, $objobj);
+ if (PEAR::isError($statement)) {
+ return $statement;
+ }
// add statement to model
- $this->model->add($statement);
+ return $this->model->add($statement);
}
/* public functions */
View
2 RDF/Resource.php
@@ -39,7 +39,7 @@ class RDF_Resource extends RDF_Node
*/
function factory($namespace_or_uri , $localName = null)
{
- $resource = new RDF_Resource;
+ $resource =& new RDF_Resource;
if ($localName == null) {
$resource->uri = $namespace_or_uri;
} else {
View
32 RDF/Serializer.php
@@ -332,9 +332,17 @@ function writeDescriptions()
$predicate = $statement->getPredicate();
$object = $statement->getobject();
// write Group and update current subject if nessesary
- if ($this->m_currentSubject == null
- || !$this->m_currentSubject->equals($subject)
- ) {
+ $result = $this->m_currentSubject;
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($this->m_currentSubject) {
+ $result = $this->m_currentSubject->equals($subject);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ }
+ if (!$result) {
$this->writeGroup();
$this->m_currentSubject = $subject;
}
@@ -380,6 +388,9 @@ function writeGroup()
}
if ($this->m_groupTypeStatement != null) {
$outerElementName = $this->getElementText($this->m_groupTypeStatement->obj->getURI());
+ if (PEAR::isError($outerElementName)) {
+ return $outerElementName;
+ }
} else {
$outerElementName = $this->rdf_qname_prefix . RDF_DESCRIPTION;
}
@@ -418,7 +429,11 @@ function writeGroup()
function checkForDoubleAttributes($predicate)
{
foreach($this->m_attributeStatements as $key => $statement) {
- if ($statement->pred->equals($predicate)) {
+ $result = $statement->pred->equals($predicate);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ if ($result) {
return false;
}
}
@@ -478,7 +493,11 @@ function writeAttributeStatements()
foreach($this->m_attributeStatements as $key => $statement) {
$this->m_out .= RDF_LINEFEED;
$this->m_out .= RDF_INDENTATION;
- $this->m_out .= $this->getElementText($statement->pred->getURI());
+ $result = $this->getElementText($statement->pred->getURI());
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ $this->m_out .= $result;
$this->m_out .= '=';
$value = $statement->obj->getLabel();
$quote = $this->getValueQuoteType($value);
@@ -498,6 +517,9 @@ function writeContentStatements()
$this->m_out .= RDF_INDENTATION;
$this->m_out .= '<';
$predicateElementText = $this->getElementText($statement->pred->getURI());
+ if (PEAR::isError($predicateElementText)) {
+ return $predicateElementText;
+ }
$this->m_out .= $predicateElementText;
if (is_a($statement->obj, 'RDF_Resource')) {
View
85 RDF/Statement.php
@@ -48,7 +48,7 @@ class RDF_Statement extends RDF_Object
*/
function factory($subj, $pred, $obj)
{
- $statement = new RDF_Statement;
+ $statement =& new RDF_Statement;
$return = $statement->setSubject($subj);
if (PEAR::isError($return)) {
@@ -256,9 +256,31 @@ function equals($that)
return false;
}
- return $this->subj->equals($that->getSubject())
- && $this->pred->equals($that->getPredicate())
- && $this->obj->equals($that->getObject());
+ $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;
+ }
+
+ return true;
}
/**
@@ -296,17 +318,64 @@ 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;
+ }
- $statementModel->add(RDF_Statement::factory($thisStatement, $RDFtype, $RDFstatement));
- $statementModel->add(RDF_Statement::factory($thisStatement, $RDFsubject, $this->getSubject()));
- $statementModel->add(RDF_Statement::factory($thisStatement, $RDFpredicate, $this->getPredicate()));
- $statementModel->add(RDF_Statement::factory($thisStatement, $RDFobject, $this->getObject()));
return $statementModel;
}
} // end: Statement
View
4 RDF/Store/MDB.php
@@ -157,7 +157,7 @@ function getNewModel($modelURI, $baseURI = null)
$this->dbConn->getValue('text', $modelID) .',' .
$this->dbConn->getValue('text', $modelURI) .',' .
$this->dbConn->getValue('text', $baseURI) .')';
- $result = &$this->dbConn->query($sql);
+ $result =& $this->dbConn->query($sql);
$this->dbConn->autoCommit(true);
@@ -193,7 +193,7 @@ function putModel(&$model, $modelURI = null)
}
$newmodel = $this->getNewModel($modelURI, $model->getBaseURI());
- $newmodel->addModel($model);
+ return $newmodel->addModel($model);
}
/**

0 comments on commit b38ba38

Please sign in to comment.
Something went wrong with that request. Please try again.