You are here

public function EasyRdf_Resource::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Resource.php \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/');

2 calls to EasyRdf_Resource::__construct()
EasyRdf_Collection::__construct in vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php
Create a new collection - do not use this directly
EasyRdf_Container::__construct in vendor/easyrdf/easyrdf/lib/EasyRdf/Container.php
Create a new container - do not use this directly
2 methods override EasyRdf_Resource::__construct()
EasyRdf_Collection::__construct in vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php
Create a new collection - do not use this directly
EasyRdf_Container::__construct in vendor/easyrdf/easyrdf/lib/EasyRdf/Container.php
Create a new container - do not use this directly

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Resource.php, line 62

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");
  }
}