public function EasyRdf_Graph::addType in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php \EasyRdf_Graph::addType()
Add one or more rdf:type properties to a resource
Parameters
string $resource The resource to add the type to:
string $types One or more types to add (e.g. foaf:Person):
Return value
integer The number of types added
2 calls to EasyRdf_Graph::addType()
- EasyRdf_Graph::resource in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Graph.php - Get or create a resource stored in a graph
- EasyRdf_Graph::setType in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Graph.php - Change the rdf:type property for a resource
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Graph.php, line 1491
Class
- EasyRdf_Graph
- Container for collection of EasyRdf_Resources.
Code
public function addType($resource, $types) {
$this
->checkResourceParam($resource, true);
if (!is_array($types)) {
$types = array(
$types,
);
}
$count = 0;
foreach ($types as $type) {
$type = EasyRdf_Namespace::expand($type);
$count += $this
->add($resource, 'rdf:type', array(
'type' => 'uri',
'value' => $type,
));
}
return $count;
}