I double-checked the error message and found the plus sign '+' is missing
in the error message:

file_len := file_len   ses_len;

Do we need to escape plus sign in shell script? Any comment?

On Tue, Apr 7, 2015 at 4:36 PM, Gang Fu <gangfu1...@gmail.com> wrote:

> Hi,
>
> In our application, we want to create many different dump functions to
> dump different subset of triple collections from database.
>
> According to the wiki page:
>
> http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtRDFDatasetDump
>
> we can define dump one graph function in isql command line. Since we will
> create hundreds of customized dump functions, we do not want to copy and
> paste to isql command line. Instead we want to prepare a shell script.
>
> In the bash shell, we need to take care of single quote by converting ' to
> '"'"'.
>
> Basically, I copy and paste the create procedure into shell script
> surrounded by:
>
> /opt/virtuoso/bin/isql 1111 dba <password> exec='<create procedure
> function>'
>
> But I always got this error
> *** Error 37000: [Virtuoso Driver][Virtuoso Server]SQ074: Line 40:
> at line 0 of Top-Level:
>
> although the create procedure function itself works fine in the isql
> command line.
> Can anyone help me out?
>
> Thank you very much!
>
> Best,
> Gang
> -----------------------------------------------
> The shell command is as follow:
> /opt/virtuoso/bin/isql 1111 dba <password> verbose=on banner=off
> prompt=off echo=ON errors=stdout  \
> exec='CREATE PROCEDURE dump_one_graph
>   ( IN  srcgraph           VARCHAR  ,
>     IN  out_file           VARCHAR  ,
>     IN  file_length_limit  INTEGER  := 1000000000
>   )
>   {
>     DECLARE  file_name     VARCHAR;
>     DECLARE  env,
>              ses           ANY;
>     DECLARE  ses_len,
>              max_ses_len,
>              file_len,
>              file_idx      INTEGER;
>     SET ISOLATION = '"'"'uncommitted'"'"';
>     max_ses_len  := 10000000;
>     file_len     := 0;
>     file_idx     := 1;
>     file_name    := sprintf ('"'"'%s%06d.ttl'"'"', out_file, file_idx);
>     string_to_file ( file_name || '"'"'.graph'"'"',
>                      srcgraph,
>                      -2
>                    );
>     string_to_file ( file_name,
>                      sprintf ( '"'"'# Dump of graph <%s>, as of %s\n@base
> <> .\n'"'"',
>                                srcgraph,
>                                CAST (NOW() AS VARCHAR)
>                              ),
>                      -2
>                    );
>     env := vector (dict_new (16000), 0, '"''"', '"''"', '"''"', 0, 0, 0,
> 0, 0);
>     ses := string_output ();
>     FOR (SELECT * FROM ( SPARQL DEFINE input:storage ""
>                          SELECT ?s ?p ?o { GRAPH `iri(?:srcgraph)` { ?s ?p
> ?o } }
>                        ) AS sub OPTION (LOOP)) DO
>       {
>         http_ttl_triple (env, "s", "p", "o", ses);
>         ses_len := length (ses);
>         IF (ses_len > max_ses_len)
>           {
>             file_len := file_len + ses_len;
>             IF (file_len > file_length_limit)
>               {
>                 http ('"'"' .\n'"'"', ses);
>                 string_to_file (file_name, ses, -1);
> gz_compress_file (file_name, file_name||'"'"'.gz'"'"');
> file_delete (file_name);
>                 file_len := 0;
>                 file_idx := file_idx + 1;
>                 file_name := sprintf ('"'"'%s%06d.ttl'"'"', out_file,
> file_idx);
>                 string_to_file ( file_name,
>                                  sprintf ( '"'"'# Dump of graph <%s>, as
> of %s (part %d)\n@base <> .\n'"'"',
>                                            srcgraph,
>                                            CAST (NOW() AS VARCHAR),
>                                            file_idx),
>                                  -2
>                                );
>                  env := VECTOR (dict_new (16000), 0, '"''"', '"''"',
> '"''"', 0, 0, 0, 0, 0);
>               }
>             ELSE
>               string_to_file (file_name, ses, -1);
>             ses := string_output ();
>           }
>       }
>     IF (LENGTH (ses))
>       {
>         http ('"'"' .\n'"'"', ses);
>         string_to_file (file_name, ses, -1);
> gz_compress_file (file_name, file_name||'"'"'.gz'"'"');
> file_delete (file_name);
>       }
>   }
> ;'
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to