Rely on virtuoso to get the same order each time ? OFFSET and LIMIT , without ORDER BY?

Hello,
i want to query a local version of the english DBpedia (on virtuoso) using a quite heavy query.
Since LIMITing result set to e.g., 20000 at least returned some result in a resonable time (without LIMIT not practical) i wanted to get the results in steps using LIMIT and OFFSET . Using those clauses without ORDER BY is practical while when i add ORDER BY i cannot get even one result (waiting time not practical).
My question is now could i rely on virtuoso to get the same solution sequence in the same order each time without ORDER BY ?
If not how could i deal with querying large datasets using heavy queries ?

Here the query i am trying to run:

SELECT ?CLASS1 ?p ?CLASS2
WHERE
{
    ?X1 ?p ?X2 .
    ?X1 rdf:type ?CLASS1 .
    ?X2 rdf:type ?CLASS2 .

    FILTER(STRSTARTS(str(?CLASS1), "http://dbpedia.org/ontology/")) .
    FILTER(STRSTARTS(str(?CLASS2), "http://dbpedia.org/ontology/")) .

    FILTER(!STRSTARTS(str(?X1), "http://dbpedia.org/resource/Category:")) .
    FILTER(!STRSTARTS(str(?X2), "http://dbpedia.org/resource/Category:")) .

    FILTER NOT EXISTS { ?X1 dbo:wikiPageRedirects ?X2 } .
    FILTER NOT EXISTS { ?X2 dbo:wikiPageRedirects ?X1 } .
    FILTER NOT EXISTS { ?X1 dbo:wikiPageDisambiguates ?X2 } .
    FILTER NOT EXISTS { ?X2 dbo:wikiPageDisambiguates ?X1 } .
} 

Is the query provided the actual query you are seeking to run, as when I run it against the DBpedia SPARQL endpoint it does not return any results ? If not then please provide the actual query being run.

Generally to guarantee the order of results then they should include an order by, which does add overhead to query execution time. What is the difference in query execution time being experienced in your use case ?

You have the following tools at your disposal for large results handling:

  1. Anytime Query Feature – based on a configurable timeout (which you set in the [SPARQL section of your INI]
  2. OFFSET, LIMIT, and ORDER BY in conjunction with the Anytime Query Feature

ORDER BY is how you make ordering predictable.

Related

Thank you for your response,
Actually i run the same query as mentioned before (just forgot DISTINCT after SELECT). I also tried it against the open dbpedia endpoint and i get an empty result, but this is just a strange behavior since the actual cause is a timeout as you can see in the image attached.

(i couldn’t upload the images since new user)

This is why i am querying a local mirror of the english dbpedia that i set up (Virtuoso 07.20.3230 + DBpedia 2015-10), since the available endpoint is not scalable enough.
In my endpoint at least i get a result when I set a LIMIT (as you can see in the second picture , with LIMIT 100000 i get results in 2mins).

(i couldn’t upload the images since new user)

Since i can get the results partially i thought of making use of OFFSET, LIMIT.
I tried it without ORDER BY it works quickly.
With ORDER BY (which seems more logical to preserve the order) the response seems taking forever with the same settings.

I launched the query without limit at all (like the one written) and even after 5 hours i do not get results (if i could predict how big the final result set would be , i could for example make sure that in that time i do not loose connection into the endpoint and that i have enough space to store the results …)

I do not know how to deal with the scalability issue, this is why i asked if maybe Virtuoso internally guarantees some order without using ORDER BY to at least give a try to the working variant.

Do you have an idea how to deal with that ?