pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='IKDQd'><style id='IKDQd'><dir id='IKDQd'><q id='IKDQd'></q></dir></style></legend>
  • <small id='IKDQd'></small><noframes id='IKDQd'>

    1. <tfoot id='IKDQd'></tfoot>

    2. <i id='IKDQd'><tr id='IKDQd'><dt id='IKDQd'><q id='IKDQd'><span id='IKDQd'><b id='IKDQd'><form id='IKDQd'><ins id='IKDQd'></ins><ul id='IKDQd'></ul><sub id='IKDQd'></sub></form><legend id='IKDQd'></legend><bdo id='IKDQd'><pre id='IKDQd'><center id='IKDQd'></center></pre></bdo></b><th id='IKDQd'></th></span></q></dt></tr></i><div class="2oogkau" id='IKDQd'><tfoot id='IKDQd'></tfoot><dl id='IKDQd'><fieldset id='IKDQd'></fieldset></dl></div>

        • <bdo id='IKDQd'></bdo><ul id='IKDQd'></ul>

        Neo4j - Graphaware reco4php - 命名空間問題

        Neo4j - Graphaware reco4php - Problem with namespaces(Neo4j - Graphaware reco4php - 命名空間問題)

        • <small id='BA6IQ'></small><noframes id='BA6IQ'>

          <i id='BA6IQ'><tr id='BA6IQ'><dt id='BA6IQ'><q id='BA6IQ'><span id='BA6IQ'><b id='BA6IQ'><form id='BA6IQ'><ins id='BA6IQ'></ins><ul id='BA6IQ'></ul><sub id='BA6IQ'></sub></form><legend id='BA6IQ'></legend><bdo id='BA6IQ'><pre id='BA6IQ'><center id='BA6IQ'></center></pre></bdo></b><th id='BA6IQ'></th></span></q></dt></tr></i><div class="0ckw2ea" id='BA6IQ'><tfoot id='BA6IQ'></tfoot><dl id='BA6IQ'><fieldset id='BA6IQ'></fieldset></dl></div>
          <legend id='BA6IQ'><style id='BA6IQ'><dir id='BA6IQ'><q id='BA6IQ'></q></dir></style></legend>
            <tbody id='BA6IQ'></tbody>

              <bdo id='BA6IQ'></bdo><ul id='BA6IQ'></ul>

                  <tfoot id='BA6IQ'></tfoot>
                  本文介紹了Neo4j - Graphaware reco4php - 命名空間問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試從 Neo4j 運行演示 - reco4php 頁面位于 此鏈接我非常仔細地遵循了每個步驟,但最后卻出現了一個奇怪的錯誤.

                  I'm trying to run the demo from Neo4j - reco4php page at This Link I followed every steps very carefully but i'm getting a strange error at the end.

                  讓我更詳細地解釋一下:

                  let me explain in more details :

                  這是我要運行的代碼:

                  require 'vendor/autoload.php';
                  
                  use GraphAwareCommonCypherStatement;
                  use GraphAwareCommonTypeNode;
                  use GraphAwareReco4PHPContextContext;
                  use GraphAwareReco4PHPEngineSingleDiscoveryEngine;
                  
                  class RatedByOthers extends SingleDiscoveryEngine
                  {
                  public function discoveryQuery(Node $input, Context $context)
                  {
                      $query = 'MATCH (input:User) WHERE id(input) = {id}
                      MATCH (input)-[:RATED]->(m)<-[:RATED]-(o)
                      WITH distinct o
                      MATCH (o)-[:RATED]->(reco)
                      RETURN distinct reco LIMIT 500';
                  
                      return Statement::create($query, ['id' => $input->identity()]);
                  }
                  
                  public function name()
                  {
                      return "rated_by_others";
                  }
                  }
                  

                  上面的代碼擴展了類SingleDiscoveryEngine":

                  This above code extends the class "SingleDiscoveryEngine" :

                  declare (strict_types = 1);
                  
                  namespace GraphAwareReco4PHPEngine;
                  
                  use GraphAwareCommonResultRecord;
                  use GraphAwareCommonResultResultCollection;
                  use GraphAwareCommonTypeNode;
                  use GraphAwareReco4PHPContextContext;
                  use GraphAwareReco4PHPResultRecommendations;
                  use GraphAwareReco4PHPResultSingleScore;
                  
                  abstract class SingleDiscoveryEngine implements DiscoveryEngine
                  {
                  private static $DEFAULT_RECO_NAME = 'reco';
                  private static $DEFAULT_SCORE_NAME = 'score';
                  private static $DEFAULT_REASON_NAME = 'reason';
                  
                  
                  public function buildScore(Node $input, Node $item, Record $record, Context 
                  $context) : SingleScore
                  {
                      $score = $record->hasValue($this->scoreResultName()) ? $record- >value($this->scoreResultName()) : $this->defaultScore();
                      $reason = $record->hasValue($this->reasonResultName()) ? $record- >value($this->reasonResultName()) : null;
                  
                      return new SingleScore($score, $reason);
                  }
                  
                  
                  final public function produceRecommendations(Node $input, ResultCollection 
                  $resultCollection, Context $context) : Recommendations
                  {
                      $result = $resultCollection->get($this->name());
                      $recommendations = new Recommendations($context);
                  
                      foreach ($result->records() as $record) {
                          if ($record->hasValue($this->recoResultName())) {
                              $recommendations->add($record->get($this->recoResultName()), $this->name(), $this->buildScore($input, $record->get($this->recoResultName()), 
                  $record, $context));
                          }
                      }
                  
                      return $recommendations;
                  }
                  
                  /**
                   * {@inheritdoc}
                   */
                  public function recoResultName() : string
                  {
                      return self::$DEFAULT_RECO_NAME;
                  }
                  
                  /**
                   * {@inheritdoc}
                   */
                  public function scoreResultName() : string
                  {
                      return self::$DEFAULT_SCORE_NAME;
                  }
                  
                  /**
                   * {@inheritdoc}
                   */
                  public function reasonResultName() : string
                  {
                      return self::$DEFAULT_REASON_NAME;
                  }
                  
                  /**
                   * {@inheritdoc}
                   */
                  public function defaultScore() : float
                  {
                      return 1.0;
                  }
                  }
                  

                  上面的類還實現了下面的類:

                  and the above class is also implements the following class :

                  namespace GraphAwareReco4PHPEngine;
                  
                  use GraphAwareCommonCypherStatementInterface;
                  use GraphAwareCommonResultRecord;
                  use GraphAwareCommonTypeNode;
                  use GraphAwareCommonResultResultCollection;
                  use GraphAwareReco4PHPContextContext;
                  use GraphAwareReco4PHPResultRecommendations;
                  use GraphAwareReco4PHPResultSingleScore;
                  
                  interface DiscoveryEngine
                  {
                  /**
                   * @return string The name of the discovery engine
                   */
                  public function name() : string;
                  
                  /**
                   * The statement to be executed for finding items to be recommended.
                   *
                   * @param Node    $input
                   * @param Context $context
                   *
                   * @return GraphAwareCommonCypherStatement
                   */
                  public function discoveryQuery(Node $input, Context $context) : StatementInterface;
                  
                  /**
                   * Returns the score produced by the recommended item.
                   *
                   * @param Node    $input
                   * @param Node    $item
                   * @param Record  $record
                   * @param Context $context
                   *
                   * @return GraphAwareReco4PHPResultSingleScore A single score produced for the recommended item
                   */
                  public function buildScore(Node $input, Node $item, Record $record, Context $context) : SingleScore;
                  
                  /**
                   * Returns a collection of Recommendation object produced by this discovery engine.
                   *
                   * @param Node             $input
                   * @param ResultCollection $resultCollection
                   * @param Context          $context
                   *
                   * @return Recommendations
                   */
                  public function produceRecommendations(Node $input, ResultCollection $resultCollection, Context $context) : Recommendations;
                  
                  /**
                   * @return string The column identifier of the row result representing the recommended item (node)
                   */
                  public function recoResultName() : string;
                  
                  /**
                   * @return string The column identifier of the row result representing the score to be used, note that this
                   *                is not mandatory to have a score in the result. If empty, the score will be the float value returned by
                   *                <code>defaultScore()</code> or the score logic if the concrete class override the <code>buildScore</code>
                   *                method.
                   */
                  public function scoreResultName() : string;
                  
                  /**
                   * @return float The default score to be given to the discovered recommended item
                   */
                  public function defaultScore() : float;
                  }
                  

                  當我運行代碼時出現以下錯誤:

                  And when I run the code I'm getting the following error :

                  致命錯誤:RatedByOthers::name() 的聲明必須與 GraphAwareReco4PHPEngineDiscoveryEngine::name() 兼容:第 9 行/Applications/XAMPP/xamppfiles/htdocs/reco/index.php 中的字符串

                  Fatal error: Declaration of RatedByOthers::name() must be compatible with GraphAwareReco4PHPEngineDiscoveryEngine::name(): string in /Applications/XAMPP/xamppfiles/htdocs/reco/index.php on line 9

                  我檢查了幾個小時的代碼,我認為它應該可以正常工作,但我不知道問題出在哪里.

                  I checked the code for hours and I think it should works fine and I have no idea where the problem comes from.

                  推薦答案

                  我自己找到了答案.

                  通過在函數啟動后立即聲明返回類型解決的問題:

                  The problem solved by declaring the type of return right after function starts :

                  public function discoveryQuery(Node $input, Context $context) : GraphAwareCommonCypherStatementInterface   {
                  $query = 'MATCH (input:User) WHERE id(input) = {id}
                  MATCH (input)-[:RATED]->(m)<-[:RATED]-(o)
                  WITH distinct o
                  MATCH (o)-[:RATED]->(reco)
                  RETURN distinct reco LIMIT 500';
                  
                  return Statement::create($query, ['id' => $input->identity()]);
                  }
                  
                  public function name() : string 
                  {
                  return "rated_by_others";
                  }
                  

                  希望它可以在未來幫助其他人.

                  hope it can help someone else in the future.

                  這篇關于Neo4j - Graphaware reco4php - 命名空間問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  • <small id='DIq0l'></small><noframes id='DIq0l'>

                    1. <legend id='DIq0l'><style id='DIq0l'><dir id='DIq0l'><q id='DIq0l'></q></dir></style></legend>

                        <tbody id='DIq0l'></tbody>

                      1. <i id='DIq0l'><tr id='DIq0l'><dt id='DIq0l'><q id='DIq0l'><span id='DIq0l'><b id='DIq0l'><form id='DIq0l'><ins id='DIq0l'></ins><ul id='DIq0l'></ul><sub id='DIq0l'></sub></form><legend id='DIq0l'></legend><bdo id='DIq0l'><pre id='DIq0l'><center id='DIq0l'></center></pre></bdo></b><th id='DIq0l'></th></span></q></dt></tr></i><div class="gyqukoc" id='DIq0l'><tfoot id='DIq0l'></tfoot><dl id='DIq0l'><fieldset id='DIq0l'></fieldset></dl></div>
                          <bdo id='DIq0l'></bdo><ul id='DIq0l'></ul>

                          <tfoot id='DIq0l'></tfoot>
                          • 主站蜘蛛池模板: 吸音板,隔音板,吸音材料,吸音板价格,声学材料 - 佛山诺声吸音板厂家 | 滚珠丝杆升降机_螺旋升降机_丝杠升降机-德迈传动 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 模具ERP_模具管理系统_模具mes_模具进度管理_东莞市精纬软件有限公司 | 至顶网| 整合营销推广|营销网络推广公司|石家庄网站优化推广公司|智营销 好物生环保网、环保论坛 - 环保人的学习交流平台 | 宿松新闻网 宿松网|宿松在线|宿松门户|安徽宿松(直管县)|宿松新闻综合网站|宿松官方新闻发布 | 清洁设备_洗地机/扫地机厂家_全自动洗地机_橙犀清洁设备官网 | 能耗监测系统-节能监测系统-能源管理系统-三水智能化 | 南汇8424西瓜_南汇玉菇甜瓜-南汇水蜜桃价格 | 复合肥,化肥厂,复合肥批发,化肥代理,复合肥品牌-红四方 | 中央空调温控器_风机盘管温控器_智能_液晶_三速开关面板-中央空调温控器厂家 | 热镀锌槽钢|角钢|工字钢|圆钢|H型钢|扁钢|花纹板-天津千百顺钢铁贸易有限公司 | 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 康明斯发电机,上柴柴油发电机,玉柴柴油发电机组_海南重康电力官网 | 等离子空气净化器_医用空气消毒机_空气净化消毒机_中央家用新风系统厂家_利安达官网 | 涡轮流量计_LWGY智能气体液体电池供电计量表-金湖凯铭仪表有限公司 | 购买舔盐、舔砖、矿物质盐压块机,鱼饵、鱼饲料压块机--请到杜甫机械 | 大立教育官网-一级建造师培训-二级建造师培训-造价工程师-安全工程师-监理工程师考试培训 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 密度电子天平-内校-外校电子天平-沈阳龙腾电子有限公司 | 老城街小面官网_正宗重庆小面加盟技术培训_特色面馆加盟|牛肉拉面|招商加盟代理费用多少钱 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 顶空进样器-吹扫捕集仪-热脱附仪-二次热解吸仪-北京华盛谱信仪器 | 成都治疗尖锐湿疣比较好的医院-成都治疗尖锐湿疣那家医院好-成都西南皮肤病医院 | 半容积式换热器_北京浮动盘管换热器厂家|北京亿丰上达 | 冷凝水循环试验箱-冷凝水试验箱-可编程高低温试验箱厂家-上海巨为(www.juweigroup.com) | 拖鞋定制厂家-品牌拖鞋代加工厂-振扬实业中国高端拖鞋大型制造商 | 济宁工业提升门|济宁电动防火门|济宁快速堆积门-济宁市统一电动门有限公司 | 煤机配件厂家_刮板机配件_链轮轴组_河南双志机械设备有限公司 | 上海电子秤厂家,电子秤厂家价格,上海吊秤厂家,吊秤供应价格-上海佳宜电子科技有限公司 | 首页|成都尚玖保洁_家政保洁_开荒保洁_成都保洁 | 南京展台搭建-南京展会设计-南京展览设计公司-南京展厅展示设计-南京汇雅展览工程有限公司 | 昊宇水工|河北昊宇水工机械工程有限公司| 保镖公司-私人保镖-深圳保镖公司【环宇兄弟保镖】 | 学考网学历中心| 食药成分检测_调料配方还原_洗涤剂化学成分分析_饲料_百检信息科技有限公司 | 聚丙烯酰胺PAM-聚合氯化铝PAC-絮凝剂-河南博旭环保科技有限公司 巨野电机维修-水泵维修-巨野县飞宇机电维修有限公司 | 不锈钢电动球阀_气动高压闸阀_旋塞疏水调节阀_全立阀门-来自温州工业阀门巨头企业 | 欧盟ce检测认证_reach检测报告_第三方检测中心-深圳市威腾检验技术有限公司 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 |