You are here

public function EasyRdf_Graph::types in Zircon Profile 8.0

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

Get a list of types for a resource

The types will each be a shortened URI as a string. This method will return an empty array if the resource has no types.

If $resource is null, then it will get the types for the URI of the graph.

Return value

array All types assocated with the resource (e.g. foaf:Person)

File

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

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function types($resource = null) {
  $resources = $this
    ->typesAsResources($resource);
  $types = array();
  foreach ($resources as $type) {
    $types[] = EasyRdf_Namespace::shorten($type);
  }
  return $types;
}