-
Notifications
You must be signed in to change notification settings - Fork 0
GDB-8161 MongoDB connector: Multiple index calls in the same query #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ public double estimate(long subject, long predicate, long object, long context, | |
if (predicate == rdf_type) { | ||
if (ctx != null && ctx.iters != null && object != 0 && object != Entities.BOUND) { | ||
String suffix = Utils.matchPrefix( | ||
pluginConnection.getEntities().get(object).stringValue(), NAMESPACE_INST); | ||
pluginConnection.getEntities().get(object).stringValue(), NAMESPACE_INST, NAMESPACE); | ||
if (suffix != null && suffix.length() > 0) { | ||
return 0.3; | ||
} | ||
|
@@ -243,7 +243,7 @@ public StatementIterator interpret(long subject, long predicate, long object, lo | |
if (predicate == rdf_type && context == 0) { | ||
if (object >= 0) | ||
return null; | ||
String suffix = Utils.matchPrefix(Utils.getString(entities, object), NAMESPACE_INST); | ||
String suffix = Utils.matchPrefix(Utils.getString(entities, object), NAMESPACE_INST, NAMESPACE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not care about this, since context is 0, we never get to here with the specific graph |
||
if (suffix == null) | ||
return null; | ||
if (ctx.iters != null) { | ||
|
@@ -421,7 +421,7 @@ public StatementIterator interpret(long subject, long predicate, long object, lo | |
|
||
if (context != 0) { | ||
MongoResultIterator iterator; | ||
String suffix = Utils.matchPrefix(entities.get(context).stringValue(), NAMESPACE_INST); | ||
String suffix = Utils.matchPrefix(entities.get(context).stringValue(), NAMESPACE, NAMESPACE_INST); | ||
if (suffix != null && suffix.length() > 0) { | ||
if (ctx.iters == null) { | ||
// no iterators up until this moment so we probably have model pattern before the actual query definition | ||
|
@@ -502,7 +502,7 @@ public boolean interpretUpdate(long subject, long predicate, long object, long c | |
|| predicate == passwordId || predicate == authDbId) { | ||
// no valid object or subject | ||
// get new instance localname | ||
String suffix = Utils.matchPrefix(Utils.getString(pluginConnection.getEntities(), subject), NAMESPACE_INST); | ||
String suffix = Utils.matchPrefix(Utils.getString(pluginConnection.getEntities(), subject), NAMESPACE_INST, NAMESPACE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should never get here as well |
||
if (suffix == null) { | ||
getLogger().error("No valid localname for the instance when registering a connection to MongoDB"); | ||
return true; | ||
|
@@ -541,7 +541,7 @@ public boolean interpretUpdate(long subject, long predicate, long object, long c | |
return true; | ||
} | ||
if (predicate == dropId) { | ||
String suffix = Utils.matchPrefix(Utils.getString(pluginConnection.getEntities(), subject), NAMESPACE_INST); | ||
String suffix = Utils.matchPrefix(Utils.getString(pluginConnection.getEntities(), subject), NAMESPACE_INST, NAMESPACE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can lead to lot of thrown exception, don`t need it here as well |
||
if (suffix == null) { | ||
getLogger().error("No valid localname for the instance when registering a connection to MongoDB"); | ||
return true; | ||
|
@@ -614,7 +614,7 @@ protected MongoResultIterator getIteratorOrNull(long subject, long context, Cont | |
} | ||
|
||
protected MongoResultIterator createMainIterator(long graphId, Entities entities, ContextImpl ctx) { | ||
String suffix = Utils.matchPrefix(entities.get(graphId).stringValue(), NAMESPACE_INST); | ||
String suffix = Utils.matchPrefix(entities.get(graphId).stringValue(), NAMESPACE_INST, NAMESPACE); | ||
if (StringUtils.isBlank(suffix)) { | ||
getLogger().error("Invalid MongoDB inst {}!", suffix); | ||
return null; | ||
|
@@ -864,7 +864,10 @@ private boolean isAlreadyDelegateToSomeoneElse(ContextImpl ctx, MongoResultItera | |
|
||
@Override public StatementIterator createEntityIter(long pred) { | ||
// we should have actual iterator instance when entity iterator is requested | ||
return getDelegate().createEntityIter(pred); | ||
MongoResultIterator iterator = getDelegate(); | ||
if (iterator == null) | ||
return StatementIterator.EMPTY; | ||
return iterator.createEntityIter(pred); | ||
} | ||
|
||
@Override public void setQuery(String query) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run this branch in order to test the examples from the documentation, the first example was still giving only 1 result (if we swap mongodb:entity ?entity to be in the first sub-query and mongodb:entity ?creativeWork in the second sub-query we get 2 results).