Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
- [update_quad](api/woql.js?id=update_quad)
- [value](api/woql.js?id=value)
- [link](api/woql.js?id=link)
- [dot](api/woql.js?id=dot)
- [WOQLLibrary](api/woqlLibrary.js?id=WOQLLibrary)
- [branches](api/woqlLibrary.js?id=branches)
- [commits](api/woqlLibrary.js?id=commits)
Expand Down
13 changes: 13 additions & 0 deletions docs/api/woql.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -1375,3 +1375,16 @@ Creates a pattern matching rule for a quad [Subject, Predicate, Object, Graph] o
| object | <code>string</code> | The IRI of a node or a variable, or a literal |
| [graphRef] | <code>typedef.GraphRef</code> | specify a graph type, default is instance schema|instance |


### dot
#### WOQL.dot(document, field, value) ⇒ <code>WOQLQuery</code>
Extract the value of a key in a bound document.

**Returns**: <code>WOQLQuery</code> - A WOQLQuery which contains the a dot Statement

| Param | Type | Description |
| --- | --- | --- |
| document | <code>string</code> | Document which is being accessed. |
| field | <code>string</code> | The field from which the document which is being accessed. |
| value | <code>string</code> | The value for the document and field. |

9 changes: 9 additions & 0 deletions lib/query/woqlQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,15 @@ WOQLQuery.prototype.path = function(Subject, Pattern, Object, Path) {
return this
}

WOQLQuery.prototype.dot = function(Document, Field, Value) {
if (this.cursor['@type']) this.wrapCursorWithAnd()
this.cursor['@type'] = 'Dot'
this.cursor['document'] = this.expandValueVariable(Document)
this.cursor['field'] = this.cleanDataValue(Field, 'xsd:string')
this.cursor['value'] = this.expandValueVariable(Value)
return this
}

WOQLQuery.prototype.size = function(Graph, Size) {
//if (Graph && Graph == 'args')
//return ['resource', 'size']
Expand Down
10 changes: 10 additions & 0 deletions lib/woql.js
Original file line number Diff line number Diff line change
Expand Up @@ -1242,5 +1242,15 @@ WOQL.link = function(subject, predicate, object, graphRef) {
return new WOQLQuery().link(subject, predicate, object, graphRef)
}

/**
* Extract the value of a key in a bound document.
* @param {string} document - Document which is being accessed.
* @param {string} field - The field from which the document which is being accessed.
* @param {string} value - The value for the document and field.
* @returns {WOQLQuery} A WOQLQuery which contains the a dot Statement
*/
WOQL.dot = function(document, field, value) {
return new WOQLQuery().dot(document, field, value);
}

module.exports = WOQL