bio4j / angulillos

Java 8 library for strongly typed graph data
GNU Affero General Public License v3.0
7 stars 2 forks source link

Add Compare enum for the index query #44

Closed laughedelic closed 8 years ago

laughedelic commented 8 years ago

In #36 it was removed from the query method. See https://github.com/bio4j/angulillos-titan/pull/17#issuecomment-196954920.

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 commented 8 years ago

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

to TitanPredicate. See the beautiful code.

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

laughedelic commented 8 years ago

@eparejatobes RE https://github.com/bio4j/angulillos-titan/pull/17#issuecomment-196979060:

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 https://github.com/bio4j/angulillos-titan/pull/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 commented 8 years ago

@laughedelic fair enough.