Skip to content
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

Add Compare enum for the index query #44

Merged
merged 4 commits into from
Mar 17, 2016

Conversation

laughedelic
Copy link
Member

In #36 it was removed from the query method. See bio4j/angulillos-titan#17 (comment).

  • Blueprints-2.5 had Compare (which was used here)
  • Tinkerpop-3.1 has Compare
  • Titan-1.0 has Cmp

which are all basically the same thing. I'm going to add here the same thing and in angulillos-titan convert it to the Titan's Cmp.

@laughedelic
Copy link
Member Author

Actually, looking at the TitanGraphQuery.has, I see that it takes TitanPredicate which can be not only primitive Cmp, but also Contain, Geo or Text, which could be quite useful in general. Among them Tinkerpop supports only the first two, so Titan has defined conversions from Tinkerpop's

  • Contains
  • Compare

to TitanPredicate. See the beautiful code.

So I'm adding here an analog of Contain/Contains as well.

@laughedelic
Copy link
Member Author

@eparejatobes
RE bio4j/angulillos-titan#17 (comment):

I vote for depending on TinkerPop 3.x

Look, I've added here two enums, which are equivalent to the Tinkerpop or Titan ones. When you write code with bio4j/angulillos, you either use backend's query mechanism or these methods in the TypedElementIndex interface, and then it doesn't matter for you, to write

import org.apache.tinkerpop.gremlin.process.traversal.Compare;

GoGraph().goTermIdIndex().query(Compare.eq, "ID12345");

or

import com.bio4j.angulillos.QueryPredicate.Compare;

GoGraph().goTermIdIndex().query(Compare.EQUAL, "ID12345");

Then if you use bio4j-titan, it also doesn't matter to you, because both things will be converted to TitanPredicate. And bio4j/angulillos-titan#17 is ready for this solution.

I think that it is quite important to keep angulillos-core dependencies-free (without real need), while angulillos-titan is going to depend on it anyway, just because titan-core does.

@eparejatobes
Copy link
Member

@laughedelic fair enough.

@laughedelic laughedelic merged commit b306ecc into master Mar 17, 2016
@laughedelic laughedelic deleted the enhancement/query-with-compare branch March 17, 2016 15:50
laughedelic added a commit that referenced this pull request Mar 17, 2016
* Removed blueprints dependency (now angulillos is dependency-free 🎉):
  - #36: Using Java 8 `BiPredicate` instead of the `blueprints.Predicate`
  - #44: Added `Compare` and `Contain` query predicate enums and corresponding `query` methods to the `TypedElementIndex` interface
* Other minor changes: added `name`, `graph` and `elementType` to the `TypedElementIndex` interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants