◆ __construct()
TripalWebServiceResource::__construct |
( |
|
$service_path | ) |
|
Implements the constructor.
- Parameters
-
◆ addContextItem()
TripalWebServiceResource::addContextItem |
( |
|
$name, |
|
|
|
$iri |
|
) |
| |
Adds a term to the '@context' section for this resource.
This function should not be called directory. Rather, the addContextTerm() and addContextVocab() functions built into the TripalWebService class should be used as these will help ensure terms are added proper for the context of the web service.
- Parameters
-
$name | The term name. |
$iri | The Internationalized Resource Identifiers or it's shortcut. |
◆ addProperty()
TripalWebServiceResource::addProperty |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Adds a new key/value pair to the web serivces response.
The value must either be a scalar or another TripalWebServiceResource object. If the same key is usesd multiple times then the resulting resource will be presented as an array of elements.
- Parameters
-
unknown | $key | The name of the $key to add. This key must already be present in the web service context by first adding it using the addContextItem() member function. |
unknown | $value | The value of the key which must either be a scalar or a TripalWebServiceResource instance. |
◆ disableID()
TripalWebServiceResource::disableID |
( |
| ) |
|
Exclude the @id element form the data of this resource.
◆ disbleType()
TripalWebServiceResource::disbleType |
( |
| ) |
|
Exclude the @type element form the data of this resource.
◆ enableID()
TripalWebServiceResource::enableID |
( |
| ) |
|
Include the @id element form the data of this resource.
◆ enableType()
TripalWebServiceResource::enableType |
( |
| ) |
|
Include the @type element form the data of this resource.
◆ getContext()
TripalWebServiceResource::getContext |
( |
| ) |
|
Retrieves the data section of the resource.
The JSON-LD response constists of two sections the '@context' section and the data section. This function only returns the data section for this resource
- Returns
- An associative array containing the data section of the response.
Reimplemented in TripalWebServiceCollection.
◆ getData()
TripalWebServiceResource::getData |
( |
| ) |
|
Retrieves the data section of the resource.
The JSON-LD response constists of two sections the '@context' section and the data section. This function only returns the data section for this resource
- Returns
- An associative array containing the data section of the response.
Reimplemented in TripalWebServiceCollection.
◆ getID()
TripalWebServiceResource::getID |
( |
| ) |
|
Retrieves the unique identifier for this resource.
Every resource must have a unique Idientifer. In JSON-LD the '@id' element identifies the IRI for the resource which will include the unique identifier. The TraiplWebService to which a resource is added will build the IRIs but it needs the unique ID of each resource.
- Returns
- The unique identifier for the resource.
◆ getProperty()
TripalWebServiceResource::getProperty |
( |
|
$key | ) |
|
Retrieves the value of a property.
- Parameters
-
$key | The name of the property. |
The | value of the property. This could be a scalar, array or a TripalWebService object. |
◆ getType()
TripalWebServiceResource::getType |
( |
| ) |
|
Retrieves the type of this resource.
- Returns
- The name of the resource.
◆ getURI()
TripalWebServiceResource::getURI |
( |
|
$id | ) |
|
Retrieves the IRI for an entity of a given ID in this web service.
- Parameters
-
$id | The unique identifier for the resource. |
◆ removeContextItem()
TripalWebServiceResource::removeContextItem |
( |
|
$name, |
|
|
|
$iri |
|
) |
| |
Removes a term for the '@context' section for this resource.
- Parameters
-
$name | The term name. |
$iri | The Internationalized Resource Identifiers or it's shortcut. |
◆ setContext()
TripalWebServiceResource::setContext |
( |
|
$resource | ) |
|
Copies the context from a given TripalWebService resource to this resource.
- Parameters
-
◆ setID()
TripalWebServiceResource::setID |
( |
|
$id | ) |
|
Set's the unique identifier for the resource.
Every resource must have a unique Idientifer. In JSON-LD the '@id' element identifies the IRI for the resource which will include the unique identifier. The TraiplWebService to which a resource is added will build the IRIs but it needs the unique ID of each resource.
- Parameters
-
$id | The unique identifier for the resource. |
◆ setServicePath()
TripalWebServiceResource::setServicePath |
( |
|
$service_path | ) |
|
Sets the service path for this resource.
By default, the service path is provided to the constructor, but this function will allow it to be changed if needed.
- Parameters
-
$service_path | The URL for the service path. |
◆ setType()
TripalWebServiceResource::setType |
( |
|
$type | ) |
|
◆ $context
TripalWebServiceResource::$context |
|
protected |
The JSON-LD compatible context for this resource.
◆ $data
TripalWebServiceResource::$data |
|
protected |
Holds the data portion of the JSON-LD response for this resource.
◆ $disable_type
TripalWebServiceResource::$disable_type = FALSE |
|
protected |
All resources should have a @type and an @id. But, there are times when we don't want any, such as an array of unpblished properties (e.g. featureloc elements). These can be set to TRUE to disable.
◆ $id
TripalWebServiceResource::$id |
|
protected |
The unique identifier for this resource.
◆ $service_path
TripalWebServiceResource::$service_path |
|
protected |
The URL path that the service is providing to access this resource. This path plus the $id are concatenated to form the IRI for this resource.
◆ $type
TripalWebServiceResource::$type |
|
protected |
The unique type of resource. The type must exists in the context for the web service.
The documentation for this class was generated from the following file:
- tripal_ws/includes/TripalWebServiceResource.inc