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


PHP EasyRdf_Graph::isEmpty方法代码示例

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


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

示例1: execute

 /**
  * Perform the load.
  *
  * @param EasyRdf_Graph $chunk
  * @return void
  */
 public function execute(&$chunk)
 {
     if (!$chunk->isEmpty()) {
         // Don't use EasyRdf's ntriple serializer, as something might be wrong with its unicode byte characters
         // After serializing with semsol/arc and easyrdf, the output looks the same (with unicode characters), but after a
         // binary utf-8 conversion (see $this->serialize()) the outcome is very different, leaving easyrdf's encoding completely different
         // from the original utf-8 characters, and the semsol/arc encoding correct as the original.
         $ttl = $chunk->serialise('turtle');
         $arc_parser = \ARC2::getTurtleParser();
         $ser = \ARC2::getNTriplesSerializer();
         $arc_parser->parse('', $ttl);
         $triples = $ser->getSerializedTriples($arc_parser->getTriples());
         preg_match_all("/(<.*\\.)/", $triples, $matches);
         if ($matches[0]) {
             $this->buffer = array_merge($this->buffer, $matches[0]);
         }
         $triple_count = count($matches[0]);
         $this->log("Added {$triple_count} triples to the load buffer.");
         while (count($this->buffer) >= $this->loader->buffer_size) {
             // Log the time it takes to load the triples into the store
             $start = microtime(true);
             $buffer_size = $this->loader->buffer_size;
             $triples_to_send = array_slice($this->buffer, 0, $buffer_size);
             $this->addTriples($triples_to_send);
             $this->buffer = array_slice($this->buffer, $buffer_size);
             $duration = round((microtime(true) - $start) * 1000, 2);
             $this->log("Took {$buffer_size} triples from the load buffer, loading them took {$duration} ms.");
         }
     }
 }
开发者ID:Tjoosten,项目名称:input,代码行数:36,代码来源:Sparql.php

示例2: testIsEmptyAfterDelete

 public function testIsEmptyAfterDelete()
 {
     $graph = new EasyRdf_Graph();
     $graph->add('http://example.com/', 'rdfs:label', 'Example');
     $graph->delete('http://example.com/', 'rdfs:label');
     $this->assertTrue($graph->isEmpty());
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:7,代码来源:GraphTest.php


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