public function EasyRdf_Resource::__construct

Constructor

  • Please do not call new EasyRdf_Resource() directly *

To create a new resource use the get method in a graph: $resource = $graph->resource('http://www.example.com/');

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Resource.php, line 63

Class

EasyRdf_Resource
Class that represents an RDF resource

Code

public function __construct($uri, $graph = null) {
  if (!is_string($uri) or $uri == null or $uri == '') {
    throw new InvalidArgumentException("\$uri should be a string and cannot be null or empty");
  }
  $this->uri = $uri;

  # Check that $graph is an EasyRdf_Graph object
  if (is_object($graph) and $graph instanceof EasyRdf_Graph) {
    $this->graph = $graph;
  }
  elseif (!is_null($graph)) {
    throw new InvalidArgumentException("\$graph should be an EasyRdf_Graph object");
  }
}