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

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

Inheritance diagram for CrudUpdateQuery:

Public Member Functions

 __construct ($network, $appID, $apiKey, $userID)
 Constructor. More...
 
 document ($document)
 Set the RDF document where instance record(s) are described. More...
 
 documentMimeIsRdfXml ()
 Specifies that the serialization format of the input document is in RDF+XML. More...
 
 documentMimeIsRdfN3 ()
 Specifies that the serialization format of the input document is in RDF+N3. More...
 
 dataset ($uri)
 Set the URI(s) of the dataset where the instance record is indexed. More...
 
 createRevision ()
 Specify that we want to create a revision record for this update. More...
 
 ignoreRevision ()
 Specify that we do not want to create a revision record for this update. More...
 
 isPublished ()
 Specify that the record(s) beind update have a lifecycle stage status 'published'. More...
 
 isArchive ()
 Specify that the record(s) beind update have a lifecycle stage status 'archive'. More...
 
 isExperimental ()
 Specify that the record(s) beind update have a lifecycle stage status 'experimental'. More...
 
 isPreRelease ()
 Specify that the record(s) beind update have a lifecycle stage status 'pre-release'. More...
 
 isStaging ()
 Specify that the record(s) beind update have a lifecycle stage status 'staging'. More...
 
 isHarvesting ()
 Specify that the record(s) beind update have a lifecycle stage status 'harvesting'. More...
 
 isUnspecified ()
 Specify that the record(s) beind update have a lifecycle stage status 'unspecified'. More...
 

Detailed Description

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

The CRUD: Update Web service is used to update an existing instance record indexed in a target dataset part of a WSF (Web Services Framework).

Usage notes: This Web service is intended to be used by any user that wants to update the description of an instance record. The update of a record is performed by two atomic actions: delete and create. All records described within the input RDF document will get updated on the system. For each of them, the Crud Update web service will remove all the triples we have defined for them in the target dataset, and then will re-insert the new ones.

This is the main difference between an Update of a given instance record, and the Creation (using Crud Create) of an already existing record: the update web service guaranties that only the triples of the updated version of an instance record will be in the system. Creating an already existing instance record, will overwrite existing triples, and will add new ones. But the ones from the old version of the instance record that are not in the new version won't be delete in the triple store instance, but will be deleted in the Solr instance because Solr documents can't be updated (they can only be replaced).

It also update possible reification statements.

Warning: if your RDF document contains blank nodes and that you try to update them using the CRUD: Update web service endpoint, this will results in the creation of a new set of resources with new blank nodes URIS. This means that resources specified as blank nodes can't be updated using this web service endpoint. The best practice is not using blank nodes.

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

// Use the CrudCreateQuery class
use \StructuredDynamics\osf\php\api\ws\crud\create\CrudCreateQuery;
// Use the CrudUpdateQuery class
use \StructuredDynamics\osf\php\api\ws\crud\update\CrudUpdateQuery;
// Use the SearchQuery class
// First, let's create our object that we will then modify.
// Create the CrudCreateQuery object
$crudCreate = new CrudCreateQuery("http://localhost/ws/");
// Specifies where we want to add the RDF content
$crudCreate->dataset("http://localhost/ws/dataset/my-new-dataset/");
// Specifies the RDF content we want to add to this dataset
$crudCreate->document('<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://www.w3.org/">
<dc:title>World Wide Web Consortium</dc:title>
</rdf:Description>
</rdf:RDF>');
// Specifies that the input document is serialized using RDF+XML
$crudCreate->documentMimeIsRdfXml();
// Make sure we index that new RDF data everywhere in the OSF instance
$crudCreate->enableFullIndexationMode();
// Import that new RDF data
$crudCreate->send();
if($crudCreate->isSuccessful())
{
// Now that it got created, let's try to modify it.
// Create the CrudUpdateQuery object
$crudUpdate = new CrudUpdateQuery("http://localhost/ws/");
// Specifies where we want to add the RDF content
$crudUpdate->dataset("http://localhost/ws/dataset/my-new-dataset/");
// Specifies the RDF content we want to add to this dataset
$crudUpdate->document('<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://www.w3.org/">
<dc:title>CRUD: Update testing (was: World Wide Web Consortium)</dc:title>
</rdf:Description>
</rdf:RDF>');
// Specifies that the input document is serialized using RDF+XML
$crudUpdate->documentMimeIsRdfXml();
// Import that new RDF data
$crudUpdate->send();
if($crudUpdate->isSuccessful())
{
// If the document has been properly updated, let's try to search for it.
// Create the SearchQuery object
$search = new SearchQuery("http://localhost/ws/");
// Set the query parameter with the search keyword "elm"
$search->query("Update testing");
$search->excludeAggregates();
// Send the search query to the endpoint
$search->send();
// Get back the resultset returned by the endpoint
$resultset = $search->getResultset();
// Print different serializations for that resultset
print_r($resultset->getResultset());
}
else
{
echo "Update failed: ".$crudUpdate->getStatus()." (".$crudUpdate->getStatusMessage().")\n";
echo $crudUpdate->getStatusMessageDescription();
}
}
else
{
echo "Creation failed: ".$crudCreate->getStatus()." (".$crudCreate->getStatusMessage().")\n";
echo $crudCreate->getStatusMessageDescription();
}
See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update
Author
Frederick Giasson, Structured Dynamics LLC.

Definition at line 145 of file CrudUpdateQuery.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 155 of file CrudUpdateQuery.php.

Member Function Documentation

createRevision ( )

Specify that we want to create a revision record for this update.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 263 of file CrudUpdateQuery.php.

dataset (   $uri)

Set the URI(s) of the dataset where the instance record is indexed.

Required: This function must be called before sending the query

Parameters
mixed$uriDataset URI where to index the RDF document
See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 247 of file CrudUpdateQuery.php.

document (   $document)

Set the RDF document where instance record(s) are described.

The size of this document is limited to 8MB on the default system (may be lower or higher on different systems).

Required: This function must be called before sending the query

Parameters
mixed$documentRDF+XML or RDF+N3 documents to import into the system
See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 197 of file CrudUpdateQuery.php.

documentMimeIsRdfN3 ( )

Specifies that the serialization format of the input document is in RDF+N3.

Required: This function (or documentMimeIsRdfXml()) must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 229 of file CrudUpdateQuery.php.

documentMimeIsRdfXml ( )

Specifies that the serialization format of the input document is in RDF+XML.

Required: This function (or documentMimeIsRdfN3()) must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 213 of file CrudUpdateQuery.php.

ignoreRevision ( )

Specify that we do not want to create a revision record for this update.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 279 of file CrudUpdateQuery.php.

isArchive ( )

Specify that the record(s) beind update have a lifecycle stage status 'archive'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 311 of file CrudUpdateQuery.php.

isExperimental ( )

Specify that the record(s) beind update have a lifecycle stage status 'experimental'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 327 of file CrudUpdateQuery.php.

isHarvesting ( )

Specify that the record(s) beind update have a lifecycle stage status 'harvesting'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 375 of file CrudUpdateQuery.php.

isPreRelease ( )

Specify that the record(s) beind update have a lifecycle stage status 'pre-release'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 343 of file CrudUpdateQuery.php.

isPublished ( )

Specify that the record(s) beind update have a lifecycle stage status 'published'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 295 of file CrudUpdateQuery.php.

isStaging ( )

Specify that the record(s) beind update have a lifecycle stage status 'staging'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 359 of file CrudUpdateQuery.php.

isUnspecified ( )

Specify that the record(s) beind update have a lifecycle stage status 'unspecified'.

Required: This function must be called before sending the query

See also
http://wiki.opensemanticframework.org/index.php/CRUD:_Update#Web_Service_Endpoint_Information
Author
Frederick Giasson, Structured Dynamics LLC.*

Definition at line 391 of file CrudUpdateQuery.php.