33/// /@ts -check 
44// I HAVE TO REVIEW THE Inheritance and the prototype chain 
55const  WOQLQuery  =  require ( './query/woqlBuilder' ) ; 
6- const  {  Var }  =  require ( './query/woqlDoc' ) ; 
6+ const  {  Var,  Doc  }  =  require ( './query/woqlDoc' ) ; 
77/** 
88 * @license  Apache Version 2 
99 * @module  WOQL 
@@ -102,14 +102,19 @@ WOQL.read_object = function (IRI, output, formatObj) {
102102
103103/** 
104104 * Read a node identified by an IRI as a JSON-LD document 
105-  * @param  {string } IRI -  The document id  or a variable 
106-  * @param  {string } output - variable name 
107-  * @param  {object } formatObj 
105+  * @param  {string } IRI -  The document id  or a variable to read 
106+  * @param  {string } output - Variable which will be bound to the document. 
108107 * @return  {object } WOQLQuery 
108+  * @example  
109+  * const query = WOQL.read_document( 
110+  *      "Person/0b4feda109d9d13c9da809090b342ad9e4d8185545ce05f7cd20b97fe458f547", 
111+  *      "v:Person" 
112+  * ); 
113+  * const res =  await client.query(query); 
109114 */ 
110115
111- WOQL . read_document  =  function  ( IRI ,  output ,   formatObj )  { 
112-   return  new  WOQLQuery ( ) . read_document ( IRI ,  output ,   formatObj ) ; 
116+ WOQL . read_document  =  function  ( IRI ,  output )  { 
117+   return  new  WOQLQuery ( ) . read_document ( IRI ,  output ) ; 
113118} ; 
114119
115120/** 
@@ -118,6 +123,10 @@ WOQL.read_document = function (IRI, output, formatObj) {
118123 * have a class specified key. 
119124 * @param  {string } [IRI] - An optional identifier specifying the document location. 
120125 * @return  {object } WOQLQuery 
126+  * @example  
127+  * const res = await client.query( 
128+  *    WOQL.insert_document(WOQL.doc({ "@type " : "Person", "label": "John" })) 
129+  * ) 
121130 */ 
122131
123132WOQL . insert_document  =  function  ( docjson ,  IRI )  { 
@@ -1264,6 +1273,19 @@ WOQL.vars = function (...varNames) {
12641273  return  varNames . map ( ( item )  =>  new  Var ( item ) ) ; 
12651274} ; 
12661275
1276+ /** 
1277+  * Produces an encoded form of a document that can be used by a WOQL operation 
1278+  * such as `WOQL.insert_document`. 
1279+  * @param   {object } object - Document to encode 
1280+  * @returns  {object } The encoded document 
1281+  * @example  
1282+  * const doc = WOQL.doc({ "@type ": "Person", name: "Newperson" }) 
1283+  */ 
1284+ 
1285+ WOQL . doc  =  function  ( object )  { 
1286+   return  new  Doc ( object ) ; 
1287+ } ; 
1288+ 
12671289/** 
12681290 * Gets/Sets woqlClient 
12691291 * @param  {WOQLClient } 
0 commit comments