Hello Burak Yönyül,

> I cannot execute queries which are greater than a few kilobytes on Virtuoso. 
> I've loaded example drugbank dataset into Virtuoso Opensource 6.1 and I'm 
> trying to execute the query in the file I've attached here, on my local 
> drugbank dataset with the sparql endpoint 
> "http://155.223.24.47:8893/drugbank/sparql";. But when I execute this I get 
> "HTTPException: 400 Bad Request". How can I execute queries greater than 25 
> KB?
> 
> How do I configure incoming HTTP request size in Virtuoso server(opensource 
> 6.1)? I cannot send queries which are greater than a few kilobytes (25 KB).


The main problem that you cannot use the GET method to execute such a big query 
to any server. 

First of all your query in text form is around 25Kb large, but before it can be 
posted your browser will have to urlencode it so it can make a 
&query=ENCODED_TEXT_OF_QUERY parameter to add to the URL which blows it up to 
around 57Kb.

Even when you remove the whitespace from the beginning of each line this will 
still result in a large query of 16Kb.

This will still cause problems as all modern browsers have a practical limit on 
the total length of a URL[1] that can be used by a <form METHOD=GET> request. 
And even many HTTP servers like Apache, IIS etc have a server side limit on the 
length of a URL request line.

Fortunately there are several ways to resolve this problem.

a. Virtuoso supports both GET and POST forms to the /sparql interface so if you 
use like an AJAX call (in case of javascript), 
   a CURL call (in case of php) etc, you should be able to change your code to 
use a POST method. This will encode the parameter
   into the body of the request which can hold much more data than the 
request-header, instead of adding this to the URL as a &param.

   NOTE: the basic form you get when you use /sparql uses GET by default, but 
this can be changed to use a post without much problems.

b. Virtuoso can also handle SPARQL requests through an ODBC or JDBC interface 
which does not have such length limits.
   You can test this by using the isql (on some Linux distros this is installed 
as isql-vt) to connect to your database :

        isql 1111
        SQL> sparql select * where {?s a ?o} limit 100;

   Note the sparql keyword at the start of the line. This is a trigger for 
Virtuoso to parse and execute this with the SPARQL engine
   instead of the SQL engine.
         

When using any of the above suggestions, you will find out that Virtuoso will 
return an error as your query has to many expressions generated:

        The nesting depth of subexpressions exceed limits of SPARQL compiler



I will check if there is a more compact way to write this query instead of this 
huge number of UNIONS and will send a separate reply about that later.


I have attached two small patches that you can try, provided you do not have a 
problem rebuilding the Virtuoso Open Source Edition from its source code. 

Both patches should apply without any errors on the latest version 6.1.6 or 
even better the develop/6 branch of VOS on Github.

I will discuss these temp patches internally to see if we can make a permanent 
fix for these issues in time for the next release of VOS.



Best regards,

Patrick


See Also:
[1] 
http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url
[2] Attached patch sparql_form_use_post.diff
[3] Attached patch sparql_h_depth_define.diff

Attachment: sparql_h_depth_define.diff
Description: Binary data

Attachment: sparql_form_use_post.diff
Description: Binary data

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to