function RdfParsingTrait::hasRdfProperty
Same name and namespace in other branches
- 8.9.x core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::hasRdfProperty()
Checks if a html document contains a resource with a given property value.
Parameters
string $html: The HTML to parse.
string $base_uri: The base URI for the html being parsed.
string $resource: The URI of the resource which should have the given property.
string $property: The property being tested.
array $value: The expected value. This should include the following keys:
- type: one of literal, uri and bnode
- value: the expected value
- datatype: the expected datatype in URI format - e.g.
- lang: language code of the property.
Return value
bool TRUE if the property exists with the given value.
Throws
\EasyRdf\Exception
File
-
core/
modules/ rdf/ tests/ src/ Traits/ RdfParsingTrait.php, line 39
Class
- RdfParsingTrait
- Defines a trait for parsing RDF properties from HTML.
Namespace
Drupal\Tests\rdf\TraitsCode
protected function hasRdfProperty($html, $base_uri, $resource, $property, array $value) {
$parser = $this->getInstanceParser();
$graph = $this->getInstanceGraph();
$parser->parse($graph, $html, 'rdfa', $base_uri);
return $graph->hasProperty($resource, $property, $value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.