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


PHP EasyRdf_Graph::hasProperty方法代码示例

本文整理汇总了PHP中EasyRdf_Graph::hasProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::hasProperty方法的具体用法?PHP EasyRdf_Graph::hasProperty怎么用?PHP EasyRdf_Graph::hasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EasyRdf_Graph的用法示例。


在下文中一共展示了EasyRdf_Graph::hasProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertFormatterRdfa

 /**
  * Helper function to test the formatter's RDFa.
  *
  * @param array $formatter
  *   An associative array describing the formatter to test and its settings
  *   containing:
  *   - type: The machine name of the field formatter to test.
  *   - settings: The settings of the field formatter to test.
  * @param string $property
  *   The property that should be found.
  * @param array $expected_rdf_value
  *   An associative array describing the expected value of the property
  *   containing:
  *   - value: The actual value of the string or URI.
  *   - type: The type of RDF value, e.g. 'literal' for a string, or 'uri'.
  *   Defaults to 'literal'.
  *   - datatype: (optional) The datatype of the value (e.g. xsd:dateTime).
  */
 protected function assertFormatterRdfa($formatter, $property, $expected_rdf_value)
 {
     $expected_rdf_value += array('type' => 'literal');
     // The field formatter will be rendered inside the entity. Set the field
     // formatter in the entity display options before rendering the entity.
     entity_get_display('entity_test', 'entity_test', 'default')->setComponent($this->fieldName, $formatter)->save();
     $build = entity_view($this->entity, 'default');
     $output = \Drupal::service('renderer')->renderRoot($build);
     $graph = new \EasyRdf_Graph($this->uri, $output, 'rdfa');
     $this->setRawContent($output);
     // If verbose debugging is turned on, display the HTML and parsed RDF
     // in the results.
     if ($this->debug) {
         print_r($output);
         print_r($graph->toRdfPhp());
     }
     $this->assertTrue($graph->hasProperty($this->uri, $property, $expected_rdf_value), "Formatter {$formatter['type']} exposes data correctly for {$this->fieldType} fields.");
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:36,代码来源:FieldRdfaTestBase.php

示例2: 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).');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:32,代码来源:StandardProfileTest.php


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