You are here

public function EasyRdf_Graph::isA in Zircon Profile 8.0

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

Check if a resource is of the specified type

Parameters

string $resource The resource to check the type of:

string $type The type to check (e.g. foaf:Person):

Return value

boolean True if resource is of specified type

File

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

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function isA($resource, $type) {
  $this
    ->checkResourceParam($resource, true);
  $type = EasyRdf_Namespace::expand($type);
  foreach ($this
    ->all($resource, 'rdf:type', 'resource') as $t) {
    if ($t
      ->getUri() == $type) {
      return true;
    }
  }
  return false;
}