Skip to content

Commit d571de3

Browse files
Make Path parameter optional (#80)
Fixes #74
1 parent a0c3501 commit d571de3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

docs/api/woql.js.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ when(true()).triple("a", "b", "c")
10291029
```
10301030

10311031
### path
1032-
#### WOQL.path(subject, pattern, object, resultVarName) ⇒ <code>WOQLQuery</code>
1032+
#### WOQL.path(subject, pattern, object, [resultVarName]) ⇒ <code>WOQLQuery</code>
10331033
Performs a path regular expression match on the graph
10341034

10351035
**Returns**: <code>WOQLQuery</code> - - A WOQLQuery which contains the path regular expression matching expression
@@ -1039,7 +1039,7 @@ Performs a path regular expression match on the graph
10391039
| subject | <code>string</code> | An IRI or variable that refers to an IRI representing the subject, i.e. the starting point of the path |
10401040
| pattern | <code>string</code> | (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 |
10411041
| object | <code>string</code> | An IRI or variable that refers to an IRI representing the object, i.e. ending point of the path |
1042-
| resultVarName | <code>string</code> | A variable in which the actual paths traversed will be stored |
1042+
| [resultVarName] | <code>string</code> | A variable in which the actual paths traversed will be stored |
10431043

10441044
**Example**
10451045
```js

lib/query/woqlQuery.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,9 @@ WOQLQuery.prototype.path = function(Subject, Pattern, Object, Path) {
939939
if (typeof Pattern == 'string') Pattern = this.compilePathPattern(Pattern)
940940
this.cursor['pattern'] = Pattern
941941
this.cursor['object'] = this.cleanObject(Object)
942-
this.cursor['path'] = this.varj(Path)
942+
if(typeof Path !== 'undefined') {
943+
this.cursor['path'] = this.varj(Path)
944+
}
943945
return this
944946
}
945947

lib/woql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ WOQL.true = function() {
925925
* - Representing any predicate
926926
* () - Parentheses, interpreted in the normal way to group clauses
927927
* @param {string} object - An IRI or variable that refers to an IRI representing the object, i.e. ending point of the path
928-
* @param {string} resultVarName - A variable in which the actual paths traversed will be stored
928+
* @param {string} [resultVarName] - A variable in which the actual paths traversed will be stored
929929
* @returns {WOQLQuery} - A WOQLQuery which contains the path regular expression matching expression
930930
* @example
931931
* let [person, grand_uncle, lineage] = vars("person", "grand uncle", "lineage")

0 commit comments

Comments
 (0)