You are here

public function EasyRdf_Graph::delete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php \EasyRdf_Graph::delete()

Delete a property (or optionally just a specific value)

Parameters

mixed $resource The resource to delete the property from:

string $property The name of the property (e.g. foaf:name):

mixed $value The value to delete (null to delete all values):

Return value

integer The number of values deleted

5 calls to EasyRdf_Graph::delete()
EasyRdf_Graph::deleteLiteral in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Delete a literal value from a property of a resource
EasyRdf_Graph::deleteResource in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Delete a resource from a property of another resource
EasyRdf_Graph::set in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Set a value for a property
EasyRdf_Graph::setType in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Change the rdf:type property for a resource
EasyRdf_Graph::__unset in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Magic method to delete a property of the graph

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php, line 1040

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function delete($resource, $property, $value = null) {
  $this
    ->checkResourceParam($resource);
  if (is_object($property) and $property instanceof EasyRdf_Resource) {
    return $this
      ->deleteSingleProperty($resource, $property
      ->getUri(), $value);
  }
  elseif (is_string($property) and preg_match('|^(\\^?)<(.+)>|', $property, $matches)) {
    return $this
      ->deleteSingleProperty($resource, "{$matches[1]}{$matches[2]}", $value);
  }
  elseif ($property === null or !is_string($property)) {
    throw new InvalidArgumentException("\$property should be a string or EasyRdf_Resource and cannot be null");
  }
  elseif ($property === '') {
    throw new InvalidArgumentException("\$property cannot be an empty string");
  }

  // FIXME: finish implementing property paths for delete
  return $this
    ->deleteSingleProperty($resource, $property, $value);
}