/** Get or create a resource stored in a graph * * If the resource did not previously exist, then a new resource will * be created. If you provide an RDF type and that type is registered * with the EasyRdf_TypeMapper, then the resource will be an instance * of the class registered. * * @param string $baseUri The base URI * @param string $referenceUri The URI to resolve * @param mixed $types RDF type of a new resource (e.g. foaf:Person) * @return object The newly resolved URI as an EasyRdf_Resource */ public function resolveResource($baseUri, $referenceUri, $types = array()) { $uri = EasyRdf_Utils::resolveUriReference($baseUri, $referenceUri); return $this->resource($uri, $types); }
/** Delete a graph from the graph store * * The URI can either be a full absolute URI or * a URI relative to the URI of the graph store. * * @param string $uriRef The URI of graph to be added to * @return object EasyRdf_Http_Response The response from the graph store */ public function delete($uriRef) { $graphUri = EasyRdf_Utils::resolveUriReference($this->_uri, $uriRef); $dataUrl = $this->urlForGraph($graphUri); $client = EasyRdf_Http::getDefaultHttpClient(); $client->resetParameters(true); $client->setUri($dataUrl); $client->setMethod('DELETE'); $response = $client->request(); if (!$response->isSuccessful()) { throw new EasyRdf_Exception("HTTP request to delete {$dataUrl} failed: " . $response->getMessage()); } return $response; }
/** @ignore */ protected function endState4($t) { /* empty p | pClose after cdata | pClose after collection */ if ($s = $this->getParentS()) { $b = isset($s['p_x_base']) && $s['p_x_base'] ? $s['p_x_base'] : (isset($s['x_base']) ? $s['x_base'] : ''); if (isset($s['is_coll']) && $s['is_coll']) { $this->addTriple($s['value'], $this->_rdf . 'rest', $this->_rdf . 'nil', $s['type'], 'uri'); /* back to collection start */ while (!isset($s['p']) || $s['p'] != $t) { $subS = $s; $this->popS(); $s = $this->getParentS(); } /* reification */ if (isset($s['p_id']) && $s['p_id']) { $this->reify(EasyRdf_Utils::resolveUriReference($b, '#' . $s['p_id']), $s['value'], $s['p'], $subS['value'], $s['type'], $subS['type']); } unset($s['p']); $this->updateS($s); } else { $dt = isset($s['o_datatype']) ? $s['o_datatype'] : null; $l = isset($s['p_x_lang']) && $s['p_x_lang'] ? $s['p_x_lang'] : (isset($s['x_lang']) ? $s['x_lang'] : null); $o = array('type' => 'literal', 'value' => $s['o_cdata']); $this->addTriple($s['value'], $s['p'], $o['value'], $s['type'], $o['type'], $dt, $l); /* reification */ if (isset($s['p_id']) && $s['p_id']) { $this->reify(EasyRdf_Utils::resolveUriReference($b, '#' . $s['p_id']), $s['value'], $s['p'], $o['value'], $s['type'], $o['type'], $dt, $l); } unset($s['o_cdata']); unset($s['o_datatype']); unset($s['p']); $this->updateS($s); } $this->_state = 2; } }
public function testResolveReferenceUriExtra4() { $this->markTestSkipped('FIXME'); $this->assertEquals(EasyRdf_Utils::resolveUriReference("foo:1234", "9999"), "foo:9999"); }