protected function RdfParsingTrait::getElementRdfType in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::getElementRdfType()
- 9 core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::getElementRdfType()
Gets type of RDF Element.
Parameters
\Drupal\Core\Url $url: URL of the document.
string $base_uri: The base URI for the html being parsed.
string $resource_uri: The URI of the resource from where to get element.
Return value
string|null The type of resource or NULL if the resource has no type.
Throws
\EasyRdf\Exception
File
- core/
modules/ rdf/ tests/ src/ Traits/ RdfParsingTrait.php, line 119
Class
- RdfParsingTrait
- Defines a trait for parsing RDF properties from HTML.
Namespace
Drupal\Tests\rdf\TraitsCode
protected function getElementRdfType(Url $url, $base_uri, $resource_uri) {
$parser = new Rdfa();
$graph = new Graph();
$parser
->parse($graph, $this
->drupalGet($url), 'rdfa', $base_uri);
return $graph
->type($resource_uri);
}