You are here

protected function EasyRdf_Graph::checkSinglePropertyParam in Zircon Profile 8

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

Check that a single URI/property parameter (not a property path) is valid, and expand it if required @ignore

11 calls to EasyRdf_Graph::checkSinglePropertyParam()
EasyRdf_Graph::add in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Add data to the graph
EasyRdf_Graph::addLiteral in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Add a literal value as a property of a resource
EasyRdf_Graph::addResource in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Add a resource as a property of another resource
EasyRdf_Graph::allForSingleProperty in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Get all values for a single property of a resource
EasyRdf_Graph::deleteLiteral in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Delete a literal value from a property of a resource

... See full list

File

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

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

protected function checkSinglePropertyParam(&$property, &$inverse) {
  if (is_object($property) and $property instanceof EasyRdf_Resource) {
    $property = $property
      ->getUri();
  }
  elseif (is_object($property) and $property instanceof EasyRdf_ParsedUri) {
    $property = strval($property);
  }
  elseif (is_string($property)) {
    if ($property == '') {
      throw new InvalidArgumentException("\$property cannot be an empty string");
    }
    elseif (substr($property, 0, 1) == '^') {
      $inverse = true;
      $property = EasyRdf_Namespace::expand(substr($property, 1));
    }
    elseif (substr($property, 0, 2) == '_:') {
      throw new InvalidArgumentException("\$property cannot be a blank node");
    }
    else {
      $inverse = false;
      $property = EasyRdf_Namespace::expand($property);
    }
  }
  if ($property === null or !is_string($property)) {
    throw new InvalidArgumentException("\$property should be a string or EasyRdf_Resource and cannot be null");
  }
}