Thanks Hugh, you are really helpfull.

If I use

VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create(query,
graph);
vqe.setTimeout(timeout);

What kind of exception does it throw ? I can't find it in the documantation.

I know that

TupleQuery tupleQuery =
connection.prepareTupleQuery(QueryLanguage.SPARQL, query);
 tupleQuery.setMaxExecutionTime(timeout/1000);

does throw HTTPQueryEvaluationException

Best,

Henrik

Hugh Williams schrieb am 23.11.2017 um 14:00:
> Hi Henrik,
>
> For query execution in Jena:
>
> class VirtGraph 
> method     
> public void setQueryTimeout(int seconds) 
>
> OR
>
> class VirtuosoQueryExecution
> method
>     /**
>      * Set time, in milliseconds
>      *
>      * @see #setTimeout(long, TimeUnit)
>      */
>     public void setTimeout(long timeout)
>
> see 
> https://jena.apache.org/documentation/javadoc/jdbc/org/apache/jena/jdbc/statements/JenaStatement.html
>
> For query execution in RDF4J :
>
> class VirtuosoRepository
> method
> /**
> * Set the query timeout(default 0)
> *
> * @param seconds
> * queryTimeout seconds, 0 - unlimited.
> */
> public void setQueryTimeout(int seconds)
>
> OR
>
> public class VirtuosoOperation implements Operation 
> method
> /**
> * Specifies the maximum time that an operation is allowed to run. The
> * operation will be interrupted when it exceeds the time limit. Any
> * consecutive requests to fetch query results will result in
> * {@link QueryInterruptedException}s
> * (depending on whether the operation is a query or an update).
> *
> * @param maxExecTime
> * The maximum query time, measured in seconds. A negative or zero
> * value indicates an unlimited execution time (which is the default).
> * @since 2.8.0
> */
> public void setMaxExecutionTime(int maxExecTime)
>
> see
>  
> http://docs.rdf4j.org/javadoc/2.0/org/eclipse/rdf4j/http/client/query/AbstractHTTPQuery.html
>
> Best Regards
> Hugh Williams
> Professional Services
> OpenLink Software, Inc.      //              http://www.openlinksw.com/
> Weblog   -- http://www.openlinksw.com/blogs/
> LinkedIn -- http://www.linkedin.com/company/openlink-software/
> Twitter  -- http://twitter.com/OpenLink
> Google+  -- http://plus.google.com/100570109519069333827/
> Facebook -- http://www.facebook.com/OpenLinkSoftware
> Universal Data Access, Integration, and Management Technology Providers
>
>
>
>> On 22 Nov 2017, at 22:51, Henrik Schmidt <h...@informatik.uni-kiel.de
>> <mailto:h...@informatik.uni-kiel.de>> wrote:
>>
>> Thanks Hugh,
>>
>> how do I use the timeot within my java code where I use
>>
>> virtDataSource = new VirtuosoDataSource();
>> virtDataSource.setServerName(serverAddress);
>> virtDataSource.setPortNumber(Integer.parseInt(serverPort));
>> virtDataSource.setUser(user);
>> virtDataSource.setPassword(password);
>>
>> So there is no connect string, just a DataSource -> Graph and the
>> Query String.
>>
>> Same for rdf4j with
>> rdf4jRepo = new HTTPRepository(serverAddress, repoName);
>>
>> Best,
>>
>> Henrik
>>
>> Am 22.11.2017 um 17:29 schrieb Hugh Williams:
>>> Hi Henrik,
>>>
>>> Glad to hear you have solved the problem.
>>>
>>> As the Virtuoso Jena and RDF4J provider use the Virtuoso JDBC Driver
>>> for connecting to the Virtuoso Server you can pass any of the
>>> connect string options of the JDBC driver, one of which is
>>> "/TIMEOUT=<timeout_secs>",  to the providers as detailed at:
>>>
>>> http://docs.openlinksw.com/virtuoso/jdbcurl4mat/
>>>
>>> Best Regards
>>> Hugh Williams
>>> Professional Services
>>> OpenLink Software, Inc.      //              http://www.openlinksw.com/
>>> Weblog   -- http://www.openlinksw.com/blogs/
>>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>>> Twitter  -- http://twitter.com/OpenLink
>>> Google+  -- http://plus.google.com/100570109519069333827/
>>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>>> Universal Data Access, Integration, and Management Technology Providers
>>>
>>>
>>>
>>>> On 22 Nov 2017, at 12:28, Henrik Schmidt
>>>> <h...@informatik.uni-kiel.de> wrote:
>>>>
>>>> Hi Hugh,
>>>>
>>>> Problem solved, I had to call new virtGraph = VirtGraph() for each
>>>> query
>>>> and not only once.
>>>> Before I only called VirtuosoQueryExecutionFactory.create(sparql,
>>>> virtGraph) in each query, using the same virtGraph.
>>>>
>>>> A partially related question :
>>>>
>>>> How do I properly use query timeouts for both jena and rdf4j providers
>>>> to prevent sparql queries running a very long time on large database.
>>>> Is there a good documentation ? I'm inexperienced and just learning.
>>>>
>>>> Best,
>>>>
>>>> Henrik
>>>>
>>>> Hugh Williams schrieb am 22.11.2017 um 13:19:
>>>>> Hi Henrik,
>>>>>
>>>>> Can you please provide more detailed example jena3 & rdf4j sample
>>>>> code demonstrating how you are seeking to use both such that we
>>>>> can obtain a better understanding of the apparent concurrent query
>>>>> execution problem ?
>>>>>
>>>>> Best Regards
>>>>> Hugh Williams
>>>>> Professional Services
>>>>> OpenLink Software, Inc.      //
>>>>>              http://www.openlinksw.com/
>>>>> Weblog   -- http://www.openlinksw.com/blogs/
>>>>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>>>>> Twitter  -- http://twitter.com/OpenLink
>>>>> Google+  -- http://plus.google.com/100570109519069333827/
>>>>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>>>>> Universal Data Access, Integration, and Management Technology
>>>>> Providers
>>>>>
>>>>>
>>>>>
>>>>>> On 22 Nov 2017, at 08:05, Henrik Schmidt
>>>>>> <h...@informatik.uni-kiel.de> wrote:
>>>>>>
>>>>>> Hi Hugh,
>>>>>>
>>>>>> the problem is that the jena code is blocking while executing
>>>>>> whereas the rdf4j code is non blocking and does allow multiple
>>>>>> simultaneous queries.
>>>>>>
>>>>>> So I'm looking for a non blocking jena solution. Is there any ?
>>>>>>
>>>>>> Best,
>>>>>>
>>>>>> Jenrik
>>>>>>
>>>>>> Am 22.11.2017 um 00:50 schrieb Hugh Williams:
>>>>>>> Hi Henrik,
>>>>>>>
>>>>>>> The jena code can be simplified to the following to give an
>>>>>>> equivalent execution to rdf4j:
>>>>>>>
>>>>>>> String query = "select .....";
>>>>>>> VirtuosoQueryExecution vqe =
>>>>>>> VirtuosoQueryExecutionFactory.create(query, virtGraph);
>>>>>>>
>>>>>>> Best Regards
>>>>>>> Hugh Williams
>>>>>>> Professional Services
>>>>>>> OpenLink Software, Inc.      //
>>>>>>>              http://www.openlinksw.com/
>>>>>>> Weblog   -- http://www.openlinksw.com/blogs/
>>>>>>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>>>>>>> Twitter  -- http://twitter.com/OpenLink
>>>>>>> Google+  -- http://plus.google.com/100570109519069333827/
>>>>>>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>>>>>>> Universal Data Access, Integration, and Management Technology
>>>>>>> Providers
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On 21 Nov 2017, at 14:56, Henrik Schmidt
>>>>>>>> <h...@informatik.uni-kiel.de> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> what is a comaparable jena provider query to this rdf4j
>>>>>>>> provider query ?
>>>>>>>>
>>>>>>>> TupleQuery tupleQuery =
>>>>>>>> connection.prepareTupleQuery(QueryLanguage.SPARQL, query);
>>>>>>>>
>>>>>>>> I want to use the jena provider instead and I'm using this
>>>>>>>> threaded so
>>>>>>>> it must be connection based.
>>>>>>>>
>>>>>>>> My current jena implementation is using something like this :
>>>>>>>>
>>>>>>>> Query sparql = QueryFactory.create(query);
>>>>>>>> VirtuosoQueryExecution vqe =
>>>>>>>> VirtuosoQueryExecutionFactory.create(sparql, virtGraph);
>>>>>>>>
>>>>>>>> This will block the port (1111) until completed whereas the
>>>>>>>> rdf4j code
>>>>>>>> can handle multiple parallel queries.
>>>>>>>>
>>>>>>>> Best,
>>>>>>>>
>>>>>>>> Henrik
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Check out the vibrant tech community on one of the world's most
>>>>>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>>>>>> _______________________________________________
>>>>>>>> Virtuoso-users mailing list
>>>>>>>> Virtuoso-users@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to