3535use WikibaseSolutions \CypherDSL \Traits \PointTrait ;
3636use WikibaseSolutions \CypherDSL \Traits \StringTypeTrait ;
3737use WikibaseSolutions \CypherDSL \Traits \TimeTrait ;
38+ use WikibaseSolutions \CypherDSL \Patterns \Path ;
3839use WikibaseSolutions \CypherDSL \Types \AnyType ;
3940use WikibaseSolutions \CypherDSL \Types \CompositeTypes \ListType ;
4041use WikibaseSolutions \CypherDSL \Types \CompositeTypes \MapType ;
42+ use WikibaseSolutions \CypherDSL \Types \PropertyTypes \PropertyType ;
4143use WikibaseSolutions \CypherDSL \Types \PropertyTypes \BooleanType ;
4244use WikibaseSolutions \CypherDSL \Types \PropertyTypes \DateTimeType ;
4345use WikibaseSolutions \CypherDSL \Types \PropertyTypes \DateType ;
4749use WikibaseSolutions \CypherDSL \Types \PropertyTypes \PointType ;
4850use WikibaseSolutions \CypherDSL \Types \PropertyTypes \StringType ;
4951use WikibaseSolutions \CypherDSL \Types \PropertyTypes \TimeType ;
52+ use WikibaseSolutions \CypherDSL \Types \StructuralTypes \NodeType ;
53+ use WikibaseSolutions \CypherDSL \Types \StructuralTypes \RelationshipType ;
54+ use WikibaseSolutions \CypherDSL \Types \StructuralTypes \StructuralType ;
55+ use WikibaseSolutions \CypherDSL \Types \StructuralTypes \HasPropertiesType ;
56+ use WikibaseSolutions \CypherDSL \Types \StructuralTypes \HasRelationshipsType ;
57+
5058
5159/**
5260 * Represents a variable.
@@ -61,8 +69,10 @@ class Variable implements
6169 LocalDateTimeType,
6270 LocalTimeType,
6371 MapType,
72+ NodeType,
6473 NumeralType,
6574 PointType,
75+ RelationshipType,
6676 StringType,
6777 TimeType
6878{
@@ -137,4 +147,57 @@ public function toQuery(): string
137147 {
138148 return self ::escape ($ this ->getName ());
139149 }
150+
151+ private function toNode (): NodeType
152+ {
153+ return Query::node ()->named ($ this );
154+ }
155+
156+ /**
157+ * @inheritdoc
158+ */
159+ public function relationship (RelationshipType $ relationship , HasRelationshipsType $ nodeOrPath ): Path
160+ {
161+ return $ this ->toNode ()->relationship ($ relationship , $ nodeOrPath );
162+ }
163+
164+ /**
165+ * @inheritdoc
166+ */
167+ public function relationshipTo (HasRelationshipsType $ nodeOrPath , ?string $ type = null , $ properties = null , $ name = null ): Path
168+ {
169+ return $ this ->toNode ()->relationshipTo ($ nodeOrPath , $ type , $ properties , $ name );
170+ }
171+
172+ /**
173+ * @inheritdoc
174+ */
175+ public function relationshipFrom (HasRelationshipsType $ nodeOrPath , ?string $ type = null , $ properties = null , $ name = null ): Path
176+ {
177+ return $ this ->toNode ()->relationshipFrom ($ nodeOrPath , $ type , $ properties , $ name );
178+ }
179+
180+ /**
181+ * @inheritdoc
182+ */
183+ public function relationshipUni (HasRelationshipsType $ nodeOrPath , ?string $ type = null , $ properties = null , $ name = null ): Path
184+ {
185+ return $ this ->toNode ()->relationshipUni ($ nodeOrPath , $ type , $ properties , $ name );
186+ }
187+
188+ /**
189+ * @inheritdoc
190+ */
191+ public function withProperty (string $ key , PropertyType $ value ): HasPropertiesType
192+ {
193+ return $ this ->toNode ()->withProperties ($ key , $ value );
194+ }
195+
196+ /**
197+ * @inheritdoc
198+ */
199+ public function withProperties ($ properties ): HasPropertiesType
200+ {
201+ return $ this ->toNode ()->withProperties ($ properties );
202+ }
140203}
0 commit comments