|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * Cypher DSL |
| 5 | + * Copyright (C) 2021 Wikibase Solutions |
| 6 | + * |
| 7 | + * This program is free software; you can redistribute it and/or |
| 8 | + * modify it under the terms of the GNU General Public License |
| 9 | + * as published by the Free Software Foundation; either version 2 |
| 10 | + * of the License, or (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program; if not, write to the Free Software |
| 19 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | + */ |
| 21 | + |
| 22 | +namespace WikibaseSolutions\CypherDSL\Types\StructuralTypes; |
| 23 | + |
| 24 | +use WikibaseSolutions\CypherDSL\Patterns\Node; |
| 25 | +use WikibaseSolutions\CypherDSL\Patterns\Path; |
| 26 | +use WikibaseSolutions\CypherDSL\PropertyMap; |
| 27 | +use WikibaseSolutions\CypherDSL\Types\AnyType; |
| 28 | +use WikibaseSolutions\CypherDSL\Variable; |
| 29 | + |
| 30 | +/** |
| 31 | + * Represents a structural type in Cypher that can have relationships. |
| 32 | + * |
| 33 | + * Those are: |
| 34 | + * |
| 35 | + * - node |
| 36 | + * - path |
| 37 | + * |
| 38 | + * @see https://neo4j.com/docs/cypher-manual/current/syntax/values/#structural-types |
| 39 | + */ |
| 40 | +interface HasRelationshipsType extends StructuralType |
| 41 | +{ |
| 42 | + /** |
| 43 | + * Adds a new relationship from the end of the structural type to the node pattern. |
| 44 | + * |
| 45 | + * @param RelationshipType $relationship |
| 46 | + * @param Node|Path $nodeOrPath |
| 47 | + * @return Path |
| 48 | + */ |
| 49 | + public function relationship(RelationshipType $relationship, StructuralType $nodeOrPath): Path; |
| 50 | + |
| 51 | + /** |
| 52 | + * Adds a new relationship to the node pattern at the end of the structural type to form a path. |
| 53 | + * |
| 54 | + * @param NodeType|Path $nodeOrPath The node to attach to the end of the structural type |
| 55 | + * @param string|null $type The type of the relationship |
| 56 | + * @param array|PropertyMap|null $properties The properties to attach to the relationship |
| 57 | + * @param string|Variable|null $name The name fo the relationship |
| 58 | + * |
| 59 | + * @return Path |
| 60 | + */ |
| 61 | + public function relationshipTo(StructuralType $nodeOrPath, ?string $type = null, $properties = null, $name = null): Path; |
| 62 | + |
| 63 | + /** |
| 64 | + * Adds a new relationship from the node pattern at the end of the structural type to form a path. |
| 65 | + * |
| 66 | + * @param NodeType|Path $nodeOrPath The node to attach to the end of the structural type. |
| 67 | + * @param string|null $type The type of the relationship |
| 68 | + * @param array|PropertyMap|null $properties The properties to attach to the relationship |
| 69 | + * @param string|Variable|null $name The name fo the relationship |
| 70 | + * |
| 71 | + * @return Path |
| 72 | + */ |
| 73 | + public function relationshipFrom(StructuralType $nodeOrPath, ?string $type = null, $properties = null, $name = null): Path; |
| 74 | + |
| 75 | + /** |
| 76 | + * Adds a new unidirectional relationship to the node pattern at the end of the structural type to form a path. |
| 77 | + * |
| 78 | + * @param NodeType|Path $nodeOrPath The node to attach to the end of the structural type. |
| 79 | + * @param string|null $type The type of the relationship |
| 80 | + * @param array|PropertyMap|null $properties The properties to attach to the relationship |
| 81 | + * @param string|Variable|null $name The name fo the relationship |
| 82 | + * |
| 83 | + * @return Path |
| 84 | + */ |
| 85 | + public function relationshipUni(StructuralType $nodeOrPath, ?string $type = null, $properties = null, $name = null): Path; |
| 86 | +} |
0 commit comments