当前位置: 首页>>代码示例>>PHP>>正文


PHP EasyRdf_Graph::primaryTopic方法代码示例

本文整理汇总了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";
 }
开发者ID:acorbi,项目名称:pixelhumain,代码行数:8,代码来源:TestController.php

示例2: testPrimaryTopicUnknown

 public function testPrimaryTopicUnknown()
 {
     $graph = new EasyRdf_Graph();
     $this->assertNull($graph->primaryTopic());
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:5,代码来源:GraphTest.php

示例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>
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:30,代码来源:basic.php

示例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'));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:artistinfo.php

示例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 
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:foafinfo.php


注:本文中的EasyRdf_Graph::primaryTopic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。