本文整理汇总了PHP中EasyRdf_Graph::primaryTopic方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::primaryTopic方法的具体用法?PHP EasyRdf_Graph::primaryTopic怎么用?PHP EasyRdf_Graph::primaryTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::primaryTopic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEasyRDF
public function actionEasyRDF()
{
$this->layout = "test";
$foaf = new EasyRdf_Graph("http://njh.me/foaf.rdf");
$foaf->load();
$me = $foaf->primaryTopic();
echo "My name is: " . $me->get('foaf:name') . "\n";
}
示例2: testPrimaryTopicUnknown
public function testPrimaryTopicUnknown()
{
$graph = new EasyRdf_Graph();
$this->assertNull($graph->primaryTopic());
}
示例3:
* the primary topic of the document (me, Nicholas Humfrey) is returned
* and then used to display my name.
*
* @package EasyRdf
* @copyright Copyright (c) 2009-2011 Nicholas J Humfrey
* @license http://unlicense.org/
*/
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "EasyRdf.php";
?>
<html>
<head>
<title>Basic FOAF example</title>
</head>
<body>
<?php
$foaf = new EasyRdf_Graph("http://www.aelius.com/njh/foaf.rdf");
$foaf->load();
$me = $foaf->primaryTopic();
?>
<p>
My name is: <?php
echo $me->get('foaf:name');
?>
</p>
</body>
</html>
示例4: form_tag
<head><title>Artist Info</title></head>
<body>
<h1>Artist Info</h1>
<?php
echo form_tag();
echo text_field_tag('uri', 'http://www.bbc.co.uk/music/artists/70248960-cb53-4ea4-943a-edb18f7d336f.rdf', array('size' => 50));
echo submit_tag();
echo form_end_tag();
?>
<?php
if (isset($_REQUEST['uri'])) {
$graph = new EasyRdf_Graph($_REQUEST['uri']);
$graph->load();
$artist = $graph->primaryTopic();
}
if (isset($artist)) {
?>
<dl>
<dt>Artist Name:</dt><dd><?php
echo $artist->get('foaf:name');
?>
</dd>
<dt>Type:</dt><dd><?php
echo join(', ', $artist->types());
?>
</dd>
<dt>Homepage:</dt><dd><?php
echo link_to($artist->get('foaf:homepage'));
示例5: form_tag
<body>
<h1>FOAF Info</h1>
<?php
echo form_tag();
echo text_field_tag('uri', 'http://www.aelius.com/njh/foaf.rdf', array('size' => 50));
echo submit_tag();
echo form_end_tag();
?>
<?php
if (isset($_REQUEST['uri'])) {
$graph = new EasyRdf_Graph($_REQUEST['uri']);
$graph->load();
if ($graph->type() == 'foaf:PersonalProfileDocument') {
$person = $graph->primaryTopic();
} else {
if ($graph->type() == 'foaf:Person') {
$person = $graph->resource();
}
}
}
if (isset($person)) {
?>
<dl>
<dt>Name:</dt><dd><?php
echo $person->get('foaf:name');
?>
</dd>
<dt>Homepage:</dt><dd><?php