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


PHP EasyRdf_Graph::all方法代码示例

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


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

示例1: getProperties

  /**
   * Recursive function to extract properties.
   *
   * @param string $uri
   *   URI of schema type.
   *
   * @return array|null
   *   Array of properties of the type and all parent types.
   */
  private function getProperties($uri) {
    $resource = array("type" => "uri", "value" => $uri);
    $property_list = $this->graph->resourcesMatching("http://schema.org/domainIncludes", $resource);
    $options = array();

    foreach ($property_list as $value) {
      // Omit deprecated properties.
      if ($value->get("schema:supersededBy")) {
        continue;
      }
      $options[$value->shorten()] = $value->get("rdfs:label")->getValue();
    }

    $parents = $this->graph->all($uri, "rdfs:subClassOf");
    foreach ($parents as $value) {
      $options += $this->getProperties($value->getUri());
    }
    return $options;
  }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:28,代码来源:EasyRdfConverter.php

示例2: getListOfRelatedGraphs

 /**
  * @param EasyRdf_Graph $po_graph
  * @param string $ps_base_node
  * @param string $ps_node_uri
  * @param int $pn_limit
  * @param bool $pb_recursive
  * @return array
  */
 static function getListOfRelatedGraphs($po_graph, $ps_base_node, $ps_node_uri, $pn_limit, $pb_recursive = false)
 {
     $vs_cache_key = md5(serialize(func_get_args()));
     if (CompositeCache::contains($vs_cache_key, 'GettyLinkedDataRelatedGraphs')) {
         return CompositeCache::fetch($vs_cache_key, 'GettyLinkedDataRelatedGraphs');
     }
     $va_related_nodes = $po_graph->all($ps_base_node, $ps_node_uri);
     $va_pull_graphs = array();
     if (is_array($va_related_nodes)) {
         $vn_i = 0;
         foreach ($va_related_nodes as $o_related_node) {
             $vs_pull_uri = (string) $o_related_node;
             if (!($o_pull_graph = self::getURIAsRDFGraph($vs_pull_uri))) {
                 return false;
             }
             $va_pull_graphs[$vs_pull_uri] = $o_pull_graph;
             if (++$vn_i >= $pn_limit) {
                 break;
             }
         }
     }
     if ($pb_recursive) {
         $va_sub_pull_graphs = array();
         foreach ($va_pull_graphs as $vs_pull_uri => $o_pull_graph) {
             // avoid circular references
             if (isset($va_pull_graphs[$vs_pull_uri]) || isset($va_sub_pull_graphs[$vs_pull_uri])) {
                 continue;
             }
             $va_sub_pull_graphs = array_merge($va_sub_pull_graphs, self::getListOfRelatedGraphs($o_pull_graph, $vs_pull_uri, $ps_node_uri, $pn_limit, true));
         }
         $va_pull_graphs = array_merge($va_pull_graphs, $va_sub_pull_graphs);
     }
     CompositeCache::save($vs_cache_key, $va_pull_graphs, 'GettyLinkedDataRelatedGraphs');
     return $va_pull_graphs;
 }
开发者ID:samrahman,项目名称:providence,代码行数:43,代码来源:BaseGettyLODServicePlugin.php


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