bio4j / bio4j-titan

Titan-specific bio4j implementation
https://github.com/bio4j/bio4j
6 stars 2 forks source link

Unused PropertyKeys and Vertex/EdgeLabels #77

Open laughedelic opened 8 years ago

laughedelic commented 8 years ago

I'm reading the code of, say TitanGoGraph.java, and I see:

    private VertexLabel goTermTypeLabel;

    private PropertyKey goTermTypekey;
    private PropertyKey goTermIdKey;
    private PropertyKey goTermNameKey;
    private PropertyKey goTermDefinitionKey;
    private PropertyKey goTermObsoleteKey;
    private PropertyKey goTermCommentKey;
    private PropertyKey goTermSynonymKey;

And these private fields are not used ever. They are assigned in the initTypes method:

  ...
  goTermSynonymKey = raw().createOrGet(mgmt, raw().titanPropertyMakerForVertexProperty( mgmt, GoTerm().synonym ).cardinality(Cardinality.SINGLE));
  goTermTypeLabel = raw().createOrGet(mgmt, goTermType.raw());

But then never used. Except the goTermTypeLabel which is used to create an index:

  goTermIdIndex =  new TitanTypedVertexIndex.DefaultUnique<>(mgmt, this, GoTerm().id);
  goTermIdIndex.makeOrGet(goTermTypeLabel);

There it's not really needed, because you create index once and can just call the same raw().createOrGet(mgmt, goTermType.raw()).

So I think those unused property keys and vertex/edge labels can be removed. Then with https://github.com/bio4j/angulillos/issues/51 there is no much business left in this code and I think it can be made generic.