@@ -226,7 +226,7 @@ WOQLClient.prototype.resource = function(type, val) {
226226 * @param {object } config - see constructor for structure
227227 * @return {Promise }
228228 * @public
229- *
229+ *
230230 */
231231WOQLClient . prototype . connect = function ( config ) {
232232 if ( config ) this . connectionConfig . update ( config )
@@ -369,7 +369,7 @@ WOQLClient.prototype.updateTriples = function(gtype, gid, turtle, commit_msg) {
369369
370370
371371/**
372- * Appends the passed turtle to the contents of a graph
372+ * Appends the passed turtle to the contents of a graph
373373 *
374374 * @param {string } gtype type of graph |instance|schema|inference|
375375 * @param {string } gid TerminusDB Graph ID to update, main is the default value
@@ -393,6 +393,49 @@ WOQLClient.prototype.insertTriples = function(gtype, gid, turtle, commit_msg) {
393393 )
394394}
395395
396+ /**
397+ * Adds a csv
398+ *
399+ * @param {string } gtype type of graph |instance|schema|inference|
400+ * @param {string } gid TerminusDB Graph ID to update, main is the default value
401+ * @param {string } csv is an array of csv file names
402+ * @param {string } commit_msg Textual message describing the reason for the update
403+ * @return {Promise }
404+ */
405+
406+ WOQLClient . prototype . addCSV = function ( gtype , gid , csv , commit_msg ) {
407+ if ( commit_msg && csv ) {
408+ let commit = this . generateCommitInfo ( commit_msg )
409+ const formData = new FormData ( ) ;
410+ for ( var x = 0 ; x < csv . length ; x ++ ) {
411+ formData . append ( 'file' , csv [ x ] )
412+ }
413+ formData . append ( 'payload' , JSON . stringify ( commit ) )
414+ return this . dispatch (
415+ CONST . ADD_CSV ,
416+ this . connectionConfig . csvURL ( gtype , gid ) ,
417+ formData ,
418+ )
419+ }
420+ }
421+
422+
423+ /**
424+ * gets loaded csv
425+ *
426+ * @param {string } gtype Type of graph (instance|schema|inference)
427+ * schema get the database schema in owl
428+ * instance get all the database documents data in owl format
429+ * inference get all the constraints schema in owl
430+ *
431+ * @return {Promise }
432+ *
433+ */
434+ WOQLClient . prototype . getCSV = function ( gtype , gid ) {
435+ return this . dispatch ( CONST . GET_CSV , this . connectionConfig . csvURL ( gtype , gid ) )
436+ }
437+
438+
396439/**
397440 * Executes a WOQL query on the specified database and returns the results
398441 *
@@ -586,7 +629,7 @@ WOQLClient.prototype._load_db_prefixes = function(dbs) {
586629 ndb . prefix_pairs = { }
587630 }
588631 if ( row [ 'Prefix_' + j ] && row [ 'Prefix_' + j ] [ '@value' ] && row [ 'IRI_' + j ] [ "@value" ] ) {
589- ndb . prefix_pairs [ row [ 'Prefix_' + j ] [ "@value" ] ] = row [ 'IRI_' + j ] [ "@value" ]
632+ ndb . prefix_pairs [ row [ 'Prefix_' + j ] [ "@value" ] ] = row [ 'IRI_' + j ] [ "@value" ]
590633 }
591634 }
592635 }
@@ -598,8 +641,8 @@ WOQLClient.prototype._load_db_prefixes = function(dbs) {
598641/**
599642 * Not yet released - subject to change in parameters
600643 * The class frame API endpoint is not yet sufficiently stable for release
601- * It should be considered unreliable and subject to change in parameters until
602- * it has been released
644+ * It should be considered unreliable and subject to change in parameters until
645+ * it has been released
603646 */
604647
605648/**
@@ -621,12 +664,12 @@ WOQLClient.prototype.getClassFrame = function(cls) {
621664
622665
623666/***
624- * Server Version API
667+ * Server Version API
625668 * Note: the below endpoints are not part of the terminusdb desktop package
626- * they belong to the server package version of the DB which is under construction.
669+ * they belong to the server package version of the DB which is under construction.
627670 * Until that package is released all of the below endpoints should be considered
628671 * as unreliable and subject to change - they are provided complete with the desktop
629- * version to show users what is coming and to allow people to use them at their own risk
672+ * version to show users what is coming and to allow people to use them at their own risk
630673 * Any use of them should be considered unsupported and at your own risk
631674 */
632675
0 commit comments