本文整理汇总了PHP中EasyRdf_Graph::allResources方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::allResources方法的具体用法?PHP EasyRdf_Graph::allResources怎么用?PHP EasyRdf_Graph::allResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::allResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRangeDataTypes
/**
* Gets data types in range of the property.
*
* @param string $uri
* URI of the resource (eg: schema:name).
*
* @return null|array
* Array containing URIs of the datatype, if not null.
*/
public function getRangeDataTypes($uri) {
if (empty($uri)) {
drupal_set_message($this->t("Invalid URI"));
return NULL;
}
$range_datatypes = $this->graph->allResources($uri, "schema:rangeIncludes");
if (!empty($range_datatypes)) {
$range_datatype_uris = array();
foreach ($range_datatypes as $type) {
array_push($range_datatype_uris, $type->getUri());
}
return $range_datatype_uris;
}
return NULL;
}
示例2: urlencode
$graph = new EasyRdf_Graph("http://localhost/lod/tcmdemoen.rdf");
$graph->load();
echo "The count is: " . $graph->countTriples();
$data = $graph->serialise('ntriples');
if (!is_scalar($data)) {
$data = var_export($data, true);
}
//print htmlspecialchars($data);
//$me = $graph->resource('http://www.example.com/Huperzia_Serrata');
$me = $graph->resource('http://www.example.com/fourGentlemenDecoction');
echo "<p>http://www.example.com/Huperzia_Serrata 的标签是: " . $me->get('rdfs:label') . "</p>";
echo "<p>http://www.example.com/Huperzia_Serrata 的中文标签是: " . $me->label('zh') . "</p>";
echo "<p>http://www.example.com/Huperzia_Serrata 的英文标签是: " . $me->label('en') . "</p>";
$hasMinister = $graph->resource('http://www.example.com/hasMinister');
echo "<p>http://www.example.com/hasMinister 的标签是: " . $hasMinister->get('rdfs:label') . "</p>";
$graph->allResources($me, $hasMinister);
foreach ($me->all($hasMinister) as $type) {
echo 'start';
$label = $type->label('zh');
if (!$label) {
$label = $type->getUri();
}
if ($type->isBnode()) {
echo "<li>{$label}</li>";
} else {
echo "<li>" . link_to_self($label, 'uri=' . urlencode($friend)) . "</li>";
}
}
foreach ($me->toArray() as $type => $value) {
echo $type . ':' . $value;
}