Skip to content

Commit d41be98

Browse files
committed
review docs
1 parent a2ab94b commit d41be98

File tree

8 files changed

+79
-15
lines changed

8 files changed

+79
-15
lines changed

docs/_sidebar.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
- [comment](api/woql.js?id=comment)
7676
- [select](api/woql.js?id=select)
7777
- [distinct](api/woql.js?id=distinct)
78-
- [and](api/woql.js?id=and)
78+
- [and](api/woql.js?id=an)
7979
- [or](api/woql.js?id=or)
8080
- [from](api/woql.js?id=from)
8181
- [into](api/woql.js?id=into)
@@ -157,16 +157,19 @@
157157
- [update_quad](api/woql.js?id=update_quad)
158158
- [value](api/woql.js?id=value)
159159
- [link](api/woql.js?id=link)
160-
- [ParamType](api/typedef.js?id=typedef)
160+
- [WOQLLibrary](api/woqlLibrary.js?id=WOQLLibrary)
161+
- [branches](api/woqlLibrary.js?id=branches)
162+
- [commits](api/woqlLibrary.js?id=commits)
163+
- [previousCommits](api/woqlLibrary.js?id=previousCommits)
164+
- [first_commit](api/woqlLibrary.js?id=first_commit)
165+
- [TypeDef](api/typedef.js?id=Typedefs)
161166
- [DocParamsGet](api/typedef.js?id=DocParamsGet)
162167
- [DocParamsPost](api/typedef.js?id=DocParamsPost)
163168
- [DocParamsPut](api/typedef.js?id=DocParamsPut)
164169
- [DocParamsDelete](api/typedef.js?id=DocParamsDelete)
165170
- [GraphRef](api/typedef.js?id=GraphRef)
166171
- [DataFormatObj](api/typedef.js?id=DataFormatObj)
167172
- [FuntionType](api/typedef.js?id=FuntionType)
168-
- [ClassObj](api/typedef.js?id=ClassObj)
169-
- [PropertyObj](api/typedef.js?id=PropertyObj)
170173
- [ResourceType](api/typedef.js?id=ResourceType)
171174
- [GraphType](api/typedef.js?id=GraphType)
172175
- [CredentialObj](api/typedef.js?id=CredentialObj)

docs/api/woql.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ json version of query for passing to api
12061206

12071207
### lib
12081208
#### WOQL.lib() ⇒ <code>WOQLQuery</code>
1209-
get the predefined library query
1209+
get the predefined library query [WOQLLibrary](/api/woqlLibrary.js?id=WOQLLibrary)
12101210

12111211
**Returns**: <code>WOQLQuery</code> - WOQLQuery object
12121212
**Example**

docs/api/woqlClient.js.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,14 +815,14 @@ client.addDocument(json,{"graph_type":"schema"},"mydb","add new schema")
815815
```
816816
817817
### queryDocument
818-
#### woqlClient.queryDocument([query], [params], [dbId], [branch]) ⇒ <code>Promise</code>
818+
#### woqlClient.queryDocument(query, [params], [dbId], [branch]) ⇒ <code>Promise</code>
819819
Retrieves all documents that match a given document template
820820
821821
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
822822
823823
| Param | Type | Description |
824824
| --- | --- | --- |
825-
| [query] | <code>object</code> | the query template |
825+
| query | <code>object</code> | the query template |
826826
| [params] | <code>typedef.DocParamsGet</code> | the get parameters |
827827
| [dbId] | <code>string</code> | the database id |
828828
| [branch] | <code>string</code> | the database branch |

docs/api/woqlLibrary.js.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
## WOQLLibrary
3+
#### WOQLLibrary()
4+
Library Functions to manage the commits graph
5+
6+
**Example**
7+
```js
8+
const woqlLib = WOQLLibrary()
9+
woqlLib.branches()
10+
11+
//or you can call this functions using WOQL Class
12+
WOQL.lib().branches()
13+
```
14+
15+
### branches
16+
#### woqlLibrary.branches()
17+
General Pattern 4: Retrieves Branches, Their ID, Head Commit ID, Head Commit Time
18+
(if present, new branches have no commits)
19+
20+
21+
### commits
22+
#### woqlLibrary.commits([branch], [limit], [start], [timestamp])
23+
get all the commits of a specific branch
24+
if a timestamp is given, gets all the commits before the specified timestamp
25+
26+
27+
| Param | Type | Description |
28+
| --- | --- | --- |
29+
| [branch] | <code>string</code> | the branch name |
30+
| [limit] | <code>number</code> | the max number of result |
31+
| [start] | <code>number</code> | the start of the pagination |
32+
| [timestamp] | <code>number</code> | Unix timestamp in seconds |
33+
34+
35+
### previousCommits
36+
#### woqlLibrary.previousCommits([commit_id], [limit])
37+
get commits older than the specified commit id
38+
39+
40+
| Param | Type | Description |
41+
| --- | --- | --- |
42+
| [commit_id] | <code>string</code> | the commit id |
43+
| [limit] | <code>number</code> | the max number of result |
44+
45+
46+
### first_commit
47+
#### woqlLibrary.first\_commit()
48+
Finds the id of the very first commit in a database's history
49+
50+
This is useful for finding information about when, by who and why the database was created
51+
The first commit is the only commit in the database that does not have a parent commit
52+

docs/createDocs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('path')
77
const {woqlClientMenu} = require('./navigationModel')
88

99
/* input and output paths */
10-
const inputFile = ['./lib/woqlClient.js', './lib/woql.js', './lib/typedef.js']
10+
const inputFile = ['./lib/woqlClient.js', './lib/woql.js', './lib/query/woqlLibrary.js','./lib/typedef.js']
1111
const outputDir = './docs/api'
1212

1313
/* create a documentation file for each class */

lib/query/woqlLibrary.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
const WOQLQuery = require('./woqlCore')
33

44
/**
5-
* Library Functions
5+
* Library Functions to manage the commits graph
6+
* @example
7+
* const woqlLib = WOQLLibrary()
8+
* woqlLib.branches()
9+
*
10+
* //or you can call this functions using WOQL Class
11+
* WOQL.lib().branches()
612
**/
713
function WOQLLibrary() {
814
this.default_schema_resource = 'schema/main'
@@ -28,9 +34,10 @@ WOQLLibrary.prototype.branches = function(){//values, variables, cresource) {
2834
/**
2935
* get all the commits of a specific branch
3036
* if a timestamp is given, gets all the commits before the specified timestamp
31-
* @param {string} branch - the branch name
32-
* @param {number} limit - the max number of result
33-
* @param {number} timestamp - Unix timestamp in seconds
37+
* @param {string} [branch] - the branch name
38+
* @param {number} [limit] - the max number of result
39+
* @param {number} [start] - the start of the pagination
40+
* @param {number} [timestamp] - Unix timestamp in seconds
3441
*/
3542

3643
WOQLLibrary.prototype.commits = function (branch="main",limit=0,start=0,timestamp=0){
@@ -55,6 +62,8 @@ WOQLLibrary.prototype.commits = function (branch="main",limit=0,start=0,timestam
5562

5663
/**
5764
*get commits older than the specified commit id
65+
* @param {string} [commit_id] - the commit id
66+
* @param {number} [limit] - the max number of result
5867
*/
5968
WOQLLibrary.prototype.previousCommits = function(commit_id,limit=10){
6069
return new WOQLQuery().using("_commits").limit(limit).select("v:Parent ID","v:Message","v:Commit ID","v:Time","v:Author").and(
@@ -76,7 +85,7 @@ WOQLLibrary.prototype.previousCommits = function(commit_id,limit=10){
7685
*
7786
* This is useful for finding information about when, by who and why the database was created
7887
* The first commit is the only commit in the database that does not have a parent commit
79-
* Therefore this query will not change performance markedly with the size of the database - it does not have to traverse any commit chain
88+
*
8089
*/
8190
WOQLLibrary.prototype.first_commit = function() {
8291
let noparent = new WOQLQuery()

lib/woql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ WOQL.json = function(JSON_LD) {
10701070
}
10711071

10721072
/**
1073-
* get the predefined library query
1073+
* get the predefined library query [WOQLLibrary](/api/woqlLibrary.js?id=WOQLLibrary)
10741074
* @returns {WOQLQuery} WOQLQuery object
10751075
* @example
10761076
* //get commits older than the specified commit id

lib/woqlClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ WOQLClient.prototype.addDocument = function(json, params, dbId, message="add a n
10451045

10461046
/**
10471047
* Retrieves all documents that match a given document template
1048-
* @param {object} [query] - the query template
1048+
* @param {object} query - the query template
10491049
* @param {typedef.DocParamsGet} [params] - the get parameters
10501050
* @param {string} [dbId] - the database id
10511051
* @param {string} [branch] - the database branch

0 commit comments

Comments
 (0)