@Override
 public int size(InternalEObject object, EStructuralFeature feature) {
   if (feature instanceof EReference) {
     EReference eReference = (EReference) feature;
     final Map<Object, Object> cache = pCore.getActiveCache();
     if (!(eReference.getEType() instanceof EClass)) {
       return super.size(object, feature);
     }
     PersistentEObject neoEObject =
         NeoEObjectAdapterFactoryImpl.getAdapter(object, PersistentEObject.class);
     NeoEMFIndexedCacheKey key =
         new NeoEMFIndexedCacheKey(neoEObject.id().toString(), eReference, -2);
     if (cache.containsKey(key)) {
       pCore.hit();
       ;
       int cachedSize = (int) cache.get(key);
       if (cachedSize == -1) {
         return 0;
       } else {
         return cachedSize;
       }
     } else {
       pCore.miss();
       ;
       return super.size(object, feature);
     }
   }
   return super.size(object, feature);
 }
 @Override
 protected boolean isSet(InternalEObject object, EReference eReference) {
   PrefetchLogger.info("Accessing eSet");
   final Map<Object, Object> cache = pCore.getActiveCache();
   if (!(eReference.getEType() instanceof EClass)) {
     return super.isSet(object, eReference);
   }
   if (!cache.isEmpty()) {
     PersistentEObject neoEObject =
         NeoEObjectAdapterFactoryImpl.getAdapter(object, PersistentEObject.class);
     NeoEMFIndexedCacheKey key =
         new NeoEMFIndexedCacheKey(neoEObject.id().toString(), eReference, -2);
     if (cache.containsKey(key)) {
       pCore.hit();
       ;
       int theSize = (int) cache.get(key);
       return theSize > 0;
     }
   }
   pCore.miss();
   return super.isSet(object, eReference);
 }
  @Override
  protected Object get(InternalEObject object, EReference eReference, int index) {
    Map<Object, Object> cache = pCore.getActiveCache();
    EventAPI eventAPI = pCore.getEventAPI();
    if (!(eReference.getEType() instanceof EClass)) {
      Object r = super.get(object, eReference, index);
      if (r instanceof PersistentEObject) {
        Vertex v = graph.getVertex(((PersistentEObject) r).id());
        eventAPI.accessEvent(v, ((EObject) r).eClass());
      }
      return r;
    }

    PersistentEObject neoEObject =
        NeoEObjectAdapterFactoryImpl.getAdapter(object, PersistentEObject.class);
    if (eReference.isMany()) {
      NeoEMFIndexedCacheKey key =
          new NeoEMFIndexedCacheKey(neoEObject.id().toString(), eReference, index);
      if (cache.containsKey(key)) {
        pCore.hit();
        VertexWrapper wrapper = (VertexWrapper) cache.get(key);
        eventAPI.accessEvent(wrapper.getV(), wrapper.getEClass());
        return reifyVertex(wrapper);
      } else {
        pCore.miss();
        Vertex vertex = graph.getVertex(object);
        Iterator<Vertex> iterator =
            vertex
                .query()
                .labels(eReference.getName())
                .direction(Direction.OUT)
                .has(POSITION, index)
                .vertices()
                .iterator();
        if (iterator.hasNext()) {
          Vertex referencedVertex = iterator.next();
          InternalEObject reifiedObject = reifyVertex(referencedVertex);
          eventAPI.accessEvent(referencedVertex, graph.resolveInstanceOf(referencedVertex));
          return reifiedObject;
        } else {
          return null;
        }
      }
    } else {
      NeoEMFIndexedCacheKey key =
          new NeoEMFIndexedCacheKey(neoEObject.id().toString(), eReference, -1);
      if (cache.containsKey(key)) {
        pCore.hit();
        VertexWrapper wrapper = (VertexWrapper) cache.get(key);
        eventAPI.accessEvent(wrapper.getV(), wrapper.getEClass());
        return reifyVertex(wrapper);
      } else {
        pCore.miss();
        Vertex vertex = graph.getVertex(object);
        Iterator<Vertex> iterator =
            vertex.getVertices(Direction.OUT, eReference.getName()).iterator();
        if (iterator.hasNext()) {
          Vertex referencedVertex = iterator.next();
          eventAPI.accessEvent(referencedVertex, graph.resolveInstanceOf(referencedVertex));
          InternalEObject reifiedObject = reifyVertex(referencedVertex);
          return reifiedObject;
        } else {
          return null;
        }
      }
    }
  }