本文整理汇总了PHP中EasyRdf_Graph::type方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::type方法的具体用法?PHP EasyRdf_Graph::type怎么用?PHP EasyRdf_Graph::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertRdfaNodeCommentProperties
/**
* Tests output for comment properties on nodes in full page view mode.
*
* @param \EasyRdf_Graph $graph
* The EasyRDF graph object.
*/
protected function assertRdfaNodeCommentProperties($graph)
{
// Relationship between node and comment.
$expected_value = array('type' => 'uri', 'value' => $this->articleCommentUri);
$this->assertTrue($graph->hasProperty($this->articleUri, 'http://schema.org/comment', $expected_value), 'Relationship between node and comment found (schema:comment).');
// Comment type.
$this->assertEqual($graph->type($this->articleCommentUri), 'schema:Comment', 'Comment type was found (schema:Comment).');
// Comment title.
$expected_value = array('type' => 'literal', 'value' => $this->articleComment->get('subject')->value, 'lang' => 'en');
$this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/name', $expected_value), 'Article comment title was found (schema:name).');
// Comment created date.
$expected_value = array('type' => 'literal', 'value' => format_date($this->articleComment->get('created')->value, 'custom', 'c', 'UTC'), 'lang' => 'en');
$this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/dateCreated', $expected_value), 'Article comment created date was found (schema:dateCreated).');
// Comment body.
$text = $this->articleComment->get('comment_body')->value;
$expected_value = array('type' => 'literal', 'value' => "{$text}\n", 'lang' => 'en');
$this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/text', $expected_value), 'Article comment body was found (schema:text).');
// Comment uid.
$expected_value = array('type' => 'uri', 'value' => $this->commenterUri);
$this->assertTrue($graph->hasProperty($this->articleCommentUri, 'http://schema.org/author', $expected_value), 'Article comment author was found (schema:author).');
// Comment author type.
$this->assertEqual($graph->type($this->commenterUri), 'schema:Person', 'Comment author type was found (schema:Person).');
// Comment author name.
$expected_value = array('type' => 'literal', 'value' => $this->webUser->getUsername());
$this->assertTrue($graph->hasProperty($this->commenterUri, 'http://schema.org/name', $expected_value), 'Comment author name was found (schema:name).');
}
示例2: testTypeUnknown
public function testTypeUnknown()
{
$graph = new EasyRdf_Graph();
$this->assertNull($graph->type());
}
示例3: testTypeForUnamedGraph
public function testTypeForUnamedGraph()
{
$graph = new EasyRdf_Graph();
$this->assertNull($graph->type());
}
示例4: form_tag
<head><title>FOAF Info</title></head>
<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>