You are here

public function EasyRdf_Graph::addResource in Zircon Profile 8

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

Add a resource as a property of another resource

The resource can either be a resource or the URI of a resource.

Example: $graph->add("http://example.com/bob", 'foaf:knows', 'http://example.com/alice');

Parameters

mixed $resource The resource to add data to:

mixed $property The property name:

mixed $resource2 The resource to be value of the property:

Return value

integer The number of values added

File

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

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function addResource($resource, $property, $resource2) {
  $this
    ->checkResourceParam($resource);
  $this
    ->checkSinglePropertyParam($property, $inverse);
  $this
    ->checkResourceParam($resource2);
  return $this
    ->add($resource, $property, array(
    'type' => substr($resource2, 0, 2) == '_:' ? 'bnode' : 'uri',
    'value' => $resource2,
  ));
}