It looks like it's breaking it into two separate queries and doing a ServiceJoin which probably isn't very performant. I'm not sure why. You might want to include you mapping if you can so you can avoid a round trip when someone more knowledgable about this takes a look at this. You might also want to add some details about your mongodb setup, schema, indexes, etc
This happens because frameId is not known to be a unique field. frameId is the field that's used to create the IRI for ?image, which in turn is the variable we're joining on in the query.
If frameId is not a unique field in the aus collection, then Stardog needs this join to create the cross product of existence and seqId fields per frameId.
If this is not what's intended, you have a couple options, depending on your data, what it means, and how you wish to model it.
If the combination of the _id and frameId fields represent some concept (an image element, say) you could change your model such that each aus document represents an "ImageFrame" with an IRI who's template includes both the _id and frameId fields. See this blog post for a detailed explanation: Mapping Denormalized Data | Stardog
If there is a 1 to 1 relationship between frames and documents (between the frameId field and the _id field), then you have a couple choices.
You could use the _id field in place of the frameId field in the image template.
You could indicate to Stardog that frameId is a unique field in aus collection using the unique.key.sets virtual graph property.
In this example, the property would be set to: unique.key.sets=(aus.[].frameId)
Thanks for the response..
frameId is unique in my dataset but as you suggested I tried following things:
I did set unique.key.sets=(aus.[].frameId) in my stardog studio virtual graph configuration options under other options as property & value keys..
Output:- I couldn't find any improvement in the response time of the query.
Then i tried using _id in place of frameId field to create IRI WHERE { BIND (template("http://austria.com/images/{_id}") AS ?image) }
fetches around 44k records in just a second which is what i'm looking for.. But now when i add one more condition to this query I don't get any output.. This happens when I try to add a condition from any of the array fields (in this query existence is an array object)..
I just see header fields as image and frameId without any data.
Observation: In 2nd case queries are working fine if I query only on int and string fields but when I'm including array objects not able to see any result..
Other option you suggested was combination of frameId and _id for IRI, again with this change query is behaving like 2nd case..
It sounds like you're describing a case where you query for images where one of the values of the existence field is "0707". You used this query as an example: