diff --git a/docs/api/woql.js.md b/docs/api/woql.js.md
index a04ba573..bb88383a 100644
--- a/docs/api/woql.js.md
+++ b/docs/api/woql.js.md
@@ -1029,7 +1029,7 @@ when(true()).triple("a", "b", "c")
```
### path
-#### WOQL.path(subject, pattern, object, resultVarName) ⇒ WOQLQuery
+#### WOQL.path(subject, pattern, object, [resultVarName]) ⇒ WOQLQuery
Performs a path regular expression match on the graph
**Returns**: WOQLQuery - - A WOQLQuery which contains the path regular expression matching expression
@@ -1039,7 +1039,7 @@ Performs a path regular expression match on the graph
| subject | string | An IRI or variable that refers to an IRI representing the subject, i.e. the starting point of the path |
| pattern | string | (string) - A path regular expression describing a pattern through multiple edges of the graph Path regular expressions consist of a sequence of predicates and / or a set of alternatives, with quantification operators The characters that are interpreted specially are the following: | representing alternative choices , - representing a sequence of predcitates + - Representing a quantification of 1 or more of the preceding pattern in a sequence {min, max} - Representing at least min examples and at most max examples of the preceding pattern - Representing any predicate () - Parentheses, interpreted in the normal way to group clauses |
| object | string | An IRI or variable that refers to an IRI representing the object, i.e. ending point of the path |
-| resultVarName | string | A variable in which the actual paths traversed will be stored |
+| [resultVarName] | string | A variable in which the actual paths traversed will be stored |
**Example**
```js
diff --git a/lib/query/woqlQuery.js b/lib/query/woqlQuery.js
index a2c2ac81..f570d4c1 100644
--- a/lib/query/woqlQuery.js
+++ b/lib/query/woqlQuery.js
@@ -939,7 +939,9 @@ WOQLQuery.prototype.path = function(Subject, Pattern, Object, Path) {
if (typeof Pattern == 'string') Pattern = this.compilePathPattern(Pattern)
this.cursor['pattern'] = Pattern
this.cursor['object'] = this.cleanObject(Object)
- this.cursor['path'] = this.varj(Path)
+ if(typeof Path !== 'undefined') {
+ this.cursor['path'] = this.varj(Path)
+ }
return this
}
diff --git a/lib/woql.js b/lib/woql.js
index 93632000..5cced140 100644
--- a/lib/woql.js
+++ b/lib/woql.js
@@ -925,7 +925,7 @@ WOQL.true = function() {
* - Representing any predicate
* () - Parentheses, interpreted in the normal way to group clauses
* @param {string} object - An IRI or variable that refers to an IRI representing the object, i.e. ending point of the path
- * @param {string} resultVarName - A variable in which the actual paths traversed will be stored
+ * @param {string} [resultVarName] - A variable in which the actual paths traversed will be stored
* @returns {WOQLQuery} - A WOQLQuery which contains the path regular expression matching expression
* @example
* let [person, grand_uncle, lineage] = vars("person", "grand uncle", "lineage")