You are here

public function EasyRdf_Graph::label in Zircon Profile 8.0

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

Get a human readable label for a resource

This method will check a number of properties for a resource (in the order: skos:prefLabel, rdfs:label, foaf:name, dc:title) and return an approriate first that is available. If no label is available then it will return null.

Return value

string A label for the resource.

File

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

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function label($resource = null, $lang = null) {
  $this
    ->checkResourceParam($resource, true);
  if ($resource) {
    return $this
      ->get($resource, 'skos:prefLabel|rdfs:label|foaf:name|rss:title|dc:title|dc11:title', 'literal', $lang);
  }
  else {
    return null;
  }
}