Skip to content
m0mo edited this page Dec 13, 2011 · 1 revision

Another important feature is to allow resources or statements to be edited. For this reason, the Model class provides a simple function called edit(). An example for editing a Statement object is illustrated in code 5.3.

<?php
	require_once 'path/to/API.php';
	
	// create or load a model
	// define a statement, e.g., $oldStatement
        
        // Add to model
        $model->add($oldStatement);
                
        // modify statement
        $model->edit($oldStatement, $newStatement);
?>

As shown, the function edit() takes two parameters, the original statement and the edited one. For the resource-centric approach, the same function can be used by passing the original and edited Resource object.

Clone this wiki locally