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

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

Inheritance diagram for DatasetUpdateQuery:

Public Member Functions

 __construct ($network, $appID, $apiKey, $userID)
 Constructor. More...
 
 uri ($uri)
 Set the URI of the dataset to update its description. More...
 
 title ($title)
 Set the title of the dataset to update. More...
 
 description ($description)
 Set the description of the dataset to update. More...
 
 contributors ($contributorsUris)
 Redefine the contributors to this dataset. More...
 
 modified ($date)
 Specifies the date of the modification of the dataset. More...
 

Detailed Description

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

The Dataset: Update Web service is used to update the description of an existing dataset in a WSF (Web Services Framework).

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\update\DatasetUpdateQuery;
use \StructuredDynamics\osf\php\api\ws\dataset\read\DatasetReadQuery;
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 update 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-6/");
// Set the title of the dataset
$dcreate->title("My Brand New Dataset to update!");
// 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();
$dupdate = new DatasetUpdateQuery("http://localhost/ws/");
// Set the URI of the dataset to update
$dupdate->uri("http://localhost/ws/dataset/my-new-dataset-6/");
// Set the title of the dataset
$dupdate->title("My Brand New Updated Dataset!");
// Set the description of the dataset
// Here we want to keep the same as the old one
$dupdate->description("This is something to look at!");
// Set the contributors to this dataset. Keep Bob, and add Kelly.
$dupdate->contributors(array("http://localhost/people/bob/", "http://localhost/people/kelly/"));
// Specify the date it got modifed, with our own date format.
$dupdate->modified(date('l jS \of F Y h:i:s A'));
// Update the description of the dataset
$dupdate->send();
if($dupdate->isSuccessful())
{
// Now that it is updated, use the Dataset Read endpoint to get the description
// of our updated dataset in RDF+XML
$dRead = new DatasetReadQuery("http://localhost/ws/");
// Specify the Dataset URI for which we want its description
$dRead->uri("http://localhost/ws/dataset/my-new-dataset-6/");
$dRead->send();
if($dRead->isSuccessful())
{
// Get the RDF+XML serialization of the resultset
echo $dRead->getResultset()->getResultsetRDFXML();
}
else
{
echo "Dataset read failed: ".$dRead->getStatus()." (".$dRead->getStatusMessage().")\n";
echo $dRead->getStatusMessageDescription();
}
}
else
{
echo "Dataset update failed: ".$dupdate->getStatus()." (".$dupdate->getStatusMessage().")\n";
echo $dupdate->getStatusMessageDescription();
}
See also
http://wiki.opensemanticframework.org/index.php/Dataset:_Update
Author
Frederick Giasson, Structured Dynamics LLC.

Definition at line 139 of file DatasetUpdateQuery.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 149 of file DatasetUpdateQuery.php.

Member Function Documentation

contributors (   $contributorsUris)

Redefine the contributors to this dataset.

Usage Note: If this function is not called, the reference to all contributors will be removed from the descrioption of this dataset

Parameters
mixed$contributorsUrisArray of contributors URIs
See also
http://wiki.opensemanticframework.org/index.php/Dataset:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 241 of file DatasetUpdateQuery.php.

description (   $description)

Set the description of the dataset to update.

Usage Note: If this function is not called, the description of the dataset will be removed from the description.

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

Definition at line 222 of file DatasetUpdateQuery.php.

modified (   $date)

Specifies the date of the modification of the dataset.

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

Definition at line 263 of file DatasetUpdateQuery.php.

title (   $title)

Set the title of the dataset to update.

Usage Note: If this function is not called, the title of the dataset will be removed from the description.

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

Definition at line 204 of file DatasetUpdateQuery.php.

uri (   $uri)

Set the URI of the dataset to update its description.

Required: This function must be called before sending the query

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

Definition at line 186 of file DatasetUpdateQuery.php.