Open Semantic Framework PHP API  3.0
 All Data Structures Namespaces Files Functions Variables Pages
DatasetDeleteQuery Class Reference

Dataset Delete Query to a OSF Dataset Delete web service endpoint. More...

Inheritance diagram for DatasetDeleteQuery:

Public Member Functions

 __construct ($network, $appID, $apiKey, $userID)
 Constructor. More...
 
 uri ($uri)
 Specifies the URI of the dataset to delete. More...
 

Detailed Description

Dataset Delete Query to a OSF Dataset Delete web service endpoint.

The Dataset: Delete Web service is used to delete an existing dataset in a WSF (Web Services Framework). When a dataset gets deleted, all of the information archived in it is deleted as well. There is no way to recover any data once this query is issued.

Here is a code example of how this class can be used by developers:

use \StructuredDynamics\osf\php\api\ws\dataset\create\DatasetCreateQuery;
use \StructuredDynamics\osf\php\api\ws\dataset\delete\DatasetDeleteQuery;
use \StructuredDynamics\osf\php\api\ws\auth\lister\AuthListerQuery;
use \StructuredDynamics\osf\framework\Namespaces;
use \StructuredDynamics\osf\php\api\framework\CRUDPermission;
// First, let's create a new dataset to delete after
// Create the DatasetCreateQuery object
$dcreate = new DatasetCreateQuery("http://localhost/ws/");
// Set the URI of the new dataset
$dcreate->uri("http://localhost/ws/dataset/my-new-dataset-5/");
// Set the title of the dataset
$dcreate->title("My Brand New Dataset to delete!");
// Set the description of the dataset
$dcreate->description("This is something to look at!");
// Set the creator's URI
$dcreate->creator("http://localhost/people/bob/");
// Get all the web services registered on this instance with a
// Create the AuthListerQuery object
$authlister = new AuthListerQuery("http://localhost/ws/");
// Specifies that we want to get all the list of all registered web service endpoints.
$authlister->getRegisteredWebServiceEndpointsUri();
// Send the auth lister query to the endpoint
$authlister->send();
// Get back the resultset returned by the endpoint
$resultset = $authlister->getResultset()->getResultset();
$webservices = array();
// Get all the URIs from the resultset array
foreach($resultset["unspecified"] as $list)
{
foreach($list[Namespaces::$rdf."li"] as $item)
{
array_push($webservices, $item["uri"]);
}
}
unset($authlister);
// We make sure that this dataset will be accessible by all the
// registered web service endpoints of the network.
$dcreate->targetWebservices($webservices);
// We make this new dataset world readable
$dcreate->globalPermissions(new CRUDPermission(FALSE, TRUE, FALSE, FALSE));
// Send the crud read query to the endpoint
$dcreate->send();
// Now, let's delete that dataset!
$dDelete = new DatasetDeleteQuery("http://localhost/ws/");
// Specify the URI of the dataset we want to remove
$dDelete->uri("http://localhost/ws/dataset/my-new-dataset-5/");
// Send que request
$dDelete->send();
if($dDelete->isSuccessful())
{
// Get the RDF+N3 serialization of the resultset
echo "Dataset deleted!";
}
else
{
echo "Dataset deletation failed: ".$dDelete->getStatus()." (".$dDelete->getStatusMessage().")\n";
echo $dDelete->getStatusMessageDescription();
}
See also
http://wiki.opensemanticframework.org/index.php/Dataset:_Delete
Author
Frederick Giasson, Structured Dynamics LLC.

Definition at line 111 of file DatasetDeleteQuery.php.

Constructor & Destructor Documentation

__construct (   $network,
  $appID,
  $apiKey,
  $userID 
)

Constructor.

Parameters
mixed$networkOSF network where to send this query. Ex: http://localhost/ws/
mixed$appIDThe Application ID of the instance instance to key. The APP-ID is related to the API-KEY
mixed$apiKeyThe API Key of the OSF web service endpoints
mixed$userIDThe ID of the user that is doing the query

Definition at line 121 of file DatasetDeleteQuery.php.

Member Function Documentation

uri (   $uri)

Specifies the URI of the dataset to delete.

Required: This function must be called before sending the query

Parameters
mixed$uriURI of the dataset to delete
See also
http://wiki.opensemanticframework.org/index.php/Dataset:_Delete#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 158 of file DatasetDeleteQuery.php.