timeout query for testing

0 views
Skip to first unread message

Peter Neorr

unread,
May 6, 2016, 3:35:01 PM5/6/16
to Stardog
I'm wanting to test what happens in our application when our users create sparql queries that timeout.  Is there any clever way to write a query that I know will take X minutes to complete?

Thanks,
Peter 


Michael Grove

unread,
May 6, 2016, 3:46:58 PM5/6/16
to stardog
The simplest way is to just pick an absurdly small timeout value. Similarly, you can create an obviously dumb query like `select * where { ?a ?b c? . ?d ?e ?f . ?g ?h ?i }` where each additional BGP is another cartesian product over the size of the DB. Enough BGPs and that query will take awhile to complete.

If you want something more fine-grained, you could implement your own `com.complexible.stardog.PropertyFunction`.

Cheers,

Mike

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Peter Neorr

unread,
May 6, 2016, 4:35:03 PM5/6/16
to stardog
I will try your select example.  I never woulda thought I'd need help creating obviously dumb queries.  ;)
Thank you Micheal.  
-Peter

---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Zachary Whitley

unread,
May 6, 2016, 4:42:55 PM5/6/16
to sta...@clarkparsia.com
It might not be the ideal implementation but it's the best I could do in a couple of minutes and should get you what you're looking for.​

To install drop the jar into $STARDOG_HOME/server/dbms and restart stardog

Then you can use the following query


prefix utils: <http://semantalytics.com/2016/04/ns/stardog/udf/utils/

select ?result where { bind(utils:sleep(10000) as ?result) }



The argument to the function is the approximate amount of time that you'd like the query to take in ms.

Hope this helps

Peter Neorr

unread,
May 6, 2016, 6:00:37 PM5/6/16
to sta...@clarkparsia.com
Oh wow! This is exactly what I wanted.  I didn't know it was so easy to "plug-in" new functions 

Unfortunately it didn't work for me.  Stardog logged the following exception:
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: Unknown function: http://semantalytics.com/2016/04/ns/stardog/udf/utils/sleep
        at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:226) ~[stardog-4.0.3.jar:?] 

Are there guides beyond the javadoc on using this API?  I could see our team wanting to experiment with this more in the future.

Thanks,
Peter

Zachary Whitley

unread,
May 6, 2016, 6:11:02 PM5/6/16
to sta...@clarkparsia.com
They're very easy to create. There are examples in the Complexible stardog-examples repo and I'm hoping to put together a blog post on it shortly. 

The possible problems I can think of are

- I copied down the URL incorrectly
- the jar isn't in the correct folder
- the jar isn't readable by the user that's running Stardog
- you didn't restart Stardog

I'll take a look on my side when I get home. Let me know if you have any luck before then. 

Peter Neorr

unread,
May 6, 2016, 6:22:21 PM5/6/16
to sta...@clarkparsia.com
Just in case you need the extra nudge, I would be *all over* a how-to/stardog/semantic tech blog.  There's not enough info out there for newbs. :) 
-P

Zachary Whitley

unread,
May 6, 2016, 6:28:38 PM5/6/16
to sta...@clarkparsia.com
Extra encouragement always helps, thanks. I also take requests. If there's any particular subject you're interested in just shout it out. 

Zachary Whitley

unread,
May 6, 2016, 6:58:10 PM5/6/16
to sta...@clarkparsia.com
I just tried it out and it should be working. The only mistake I noticed is the ending angle bracket on the prefix url was missing but that wouldn't have given you the error you are seeing.


prefix utils: <http://semantalytics.com/2016/04/ns/stardog/udf/utils/>

select ?result where { bind(utils:sleep(10000) as ?result) }

Try making sure the jar is where you expect it to be, is readable by the user running stardog and that you've stopped and started stardog. You can also try taking a look at the Stardog logs ($STARDOG_HOME/stardog.log) to see if there's any additional information in there. This was built against the latest Stardog release 4.0.5.


Kendall Clark

unread,
May 6, 2016, 7:40:13 PM5/6/16
to sta...@clarkparsia.com
We'll be addressing this issue—hopefully with others too—in the 2nd half of the year.

Cheers,
Kendall

Peter Neorr

unread,
May 6, 2016, 7:57:53 PM5/6/16
to sta...@clarkparsia.com
Zachary,

It worked for me once I upgraded to v4.0.5.  (I was on v4.0.3 before) 

Very cool!

Thanks for your help!

-P
Reply all
Reply to author
Forward
0 new messages