本文整理汇总了PHP中EasyRdf_Graph::newBnode方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::newBnode方法的具体用法?PHP EasyRdf_Graph::newBnode怎么用?PHP EasyRdf_Graph::newBnode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::newBnode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtolower
*/
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "EasyRdf.php";
$ns = new EasyRdf_Namespace();
$ns->set("dct", "http://www.dc.com");
$graph = new EasyRdf_Graph();
$me = $graph->resource('http://www.example.com/joe#me', 'foaf:Person');
$me->set('foaf:name', 'Joseph Bloggs');
$me->set('foaf:title', 'Mr');
$me->set('dct:title', 'ma oeeeeeee');
$me->set('foaf:nick', 'Joe');
$me->add('foaf:homepage', $graph->resource('http://example.com/joe/'));
// I made these up; they are not officially part of FOAF
$me->set('foaf:dateOfBirth', new EasyRdf_Literal_Date('1980-09-08'));
$me->set('foaf:height', 1.82);
$project = $graph->newBnode('foaf:Project');
$project->set('foaf:name', "Joe's current project");
$me->set('foaf:currentProject', $project);
if (isset($_REQUEST['format'])) {
$format = preg_replace("/[^\\w\\-]+/", '', strtolower($_REQUEST['format']));
} else {
$format = 'ntriples';
}
?>
<html>
<head><title>EasyRdf Serialiser Example</title></head>
<body>
<h1>EasyRdf Serialiser Example</h1>
<ul>
<?php
示例2: testDumpResource
public function testDumpResource()
{
$graph = new EasyRdf_Graph();
$graph->addResource('http://example.com/joe#me', 'rdf:type', 'foaf:Person');
$graph->addResource('http://example.com/joe#me', 'foaf:homepage', 'http://example.com/');
$graph->add('http://example.com/joe#me', 'foaf:knows', $graph->newBnode());
$text = $graph->dumpResource('http://example.com/joe#me', false);
$this->assertContains('http://example.com/joe#me', $text);
$this->assertContains('-> rdf:type -> foaf:Person', $text);
$this->assertContains('-> foaf:homepage -> http://example.com/', $text);
$this->assertContains('-> foaf:knows -> _:genid1', $text);
$html = $graph->dumpResource('http://example.com/joe#me', true);
$this->assertContains('http://example.com/joe#me', $html);
$this->assertContains('>rdf:type</span>', $html);
$this->assertContains('>foaf:Person</a>', $html);
$this->assertContains('>foaf:homepage</span>', $html);
$this->assertContains('>http://example.com/</a>', $html);
$this->assertContains('>foaf:knows</span>', $html);
$this->assertContains('>_:genid1</a>', $html);
}