@@ -1269,6 +1269,42 @@ WOQL.literal = function (val, type) {
12691269 return new WOQLQuery ( ) . literal ( val , type ) ;
12701270} ;
12711271
1272+ /**
1273+ * Generates explicitly a JSON-LD literal date from the imput
1274+ * @param {string } date - any date format string (YYYY-MM-DD)
1275+ * @returns {object } - A JSON-LD literal date
1276+ * @example
1277+ * date("2022-10-02")
1278+ * //returns { "@type": "xsd:date", "@value": "2022-10-02" }
1279+ */
1280+ WOQL . date = function ( date ) {
1281+ return new WOQLQuery ( ) . literal ( date , 'xsd:date' ) ;
1282+ } ;
1283+
1284+ /**
1285+ * Generates explicitly a JSON-LD literal datetime from the imput
1286+ * @param {string } datetime - any datetime format string (YYYY-MM-DDThh-mm-ssZ)
1287+ * @returns {object } - A JSON-LD literal datetime
1288+ * @example
1289+ * datetime("2022-10-19T14:17:12Z")
1290+ * //returns { "@type": "xsd:dateTime", "@value": "2022-10-19T14:17:12Z" }
1291+ */
1292+ WOQL . datetime = function ( datetime ) {
1293+ return new WOQLQuery ( ) . literal ( datetime , 'xsd:dateTime' ) ;
1294+ } ;
1295+
1296+ /**
1297+ * Generates explicitly a JSON-LD literal boolean from the input
1298+ * @param {boolean } bool - true | false
1299+ * @returns {object } - A JSON-LD literal boolean
1300+ * @example
1301+ * boolean(true)
1302+ * //returns { "@type": "xsd:boolean", "@value": true }
1303+ */
1304+ WOQL . boolean = function ( bool ) {
1305+ return new WOQLQuery ( ) . boolean ( bool ) ;
1306+ } ;
1307+
12721308/**
12731309 * Explicitly sets a value to be an IRI - avoiding automatic type marshalling
12741310 * @param {string } val string which will be treated as an IRI
0 commit comments