autoprotect-group / neo4j-common
Neo4j 常用工具库
3.6.2
2021-06-10 20:28 UTC
Requires
- myclabs/php-enum: ^1.4
Requires (Dev)
- phpunit/phpunit: ^4.0
- dev-master
- 3.6.2
- 3.6.1
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.1
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.14.0
- 1.13.3
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.1
- 1.12.0
- 1.11.6
- 1.11.5
- 1.11.4
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- dev-collections
This package is not auto-updated.
Last update: 2024-09-14 10:52:54 UTC
README
Neo4j 常用工具类库
安装
在您的应用程序中要求依赖项
composer require graphaware/neo4j-common
图
标签
节点标签的对象表示。
use GraphAware\Common\Graph\Label; $label = new Label("User"); echo $label->getName(); // Returns (string) "User" // or static construction $label = Label::label("User");
节点
节点对象表示。节点对象扩展了 PropertyBag
。
use GraphAware\Common\Graph\Node; $node = new Node(1, array("User", "Person")); $node->getId(); // Returns (int) 1 $node->getLabels(); // Returns an array of \GraphAware\Common\Graph\Label objects
关系
关系对象表示。关系对象扩展了 PropertyBag
。
use GraphAware\Common\Graph\Relationship; $rel = new Relationship(1, RelationshipType::withName("RELATES"), $node, $node2); echo $rel->getType(); // Returns (string) "RELATES" var_dump($rel->isType(RelationshipType::withName("RELATES"))); // Returns (bool) true
方向(枚举):关系方向的表示
use GraphAware\Common\Graph\Direction; $direction = new Direction(Direction::INCOMING); echo $direction; // Returns (string) "INCOMING" // Or static call construction $direction = Direction::OUTGOING; echo $direction; // Returns (string) "OUTGOING"
有效值是 INCOMING
、OUTGOING
和 BOTH
。
关系类型
关系类型的对象表示。
use GraphAware\Common\Graph\RelationshipType; $relType = RelationshipType::withName("FOLLOWS"); echo $relType->getName(); // Returns (string) "FOLLOWS" echo (string) $relType; // implements __toString method : Returns (string) "FOLLOWS"
Cypher
语句和语句集合
表示 Cypher 语句的实用类。`Statement` 和 `StatementCollection` 类都是可标记的。
还包括在大多数 GraphAware 的 PHP 库中使用的 `StatementInterface` 和 `StatementCollectionInterface`。
Statement
表示带有查询和参数数组的 Cypher 语句。语句还接受一个默认为 null 的 tag
参数;
use GraphAware\Common\Cypher\Statement; $statement = Statement::create("MATCH (n) WHERE id(n) = {id} RETURN n", array("id" => 324)); echo $statement->getQuery(); // Returns (string) "MATCH (n) WHERE id(n) = {id} RETURN n" echo count($statement->getParameters()); // Returns (int) 1
StatementCollection
表示一组 Statement
对象。也是可标记的。
use GraphAware\Common\Cypher\Statement GraphAware\Common\Cypher\StatementCollection; $collection = new StatementCollection(); $collection->add(Statement::create("MATCH (n) RETURN count(n)")); print_r($collection->getStatements()); echo $collection->isEmpty();
许可证
Apache 许可证 2.0
Copyright 2015 Graphaware Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
支持
通过 Github Issues 和 PR 流程提供标准社区支持。
企业支持通过您的第一级支持联系人。