Neo4j Enterprise

org.neo4j.index.lucene
Interface TimelineIndex<T extends PropertyContainer>

All Known Implementing Classes:
LuceneTimeline

public interface TimelineIndex<T extends PropertyContainer>

A utility for ordering nodes or relationships in a timeline. Entities are added to the timeline and then queried given a time period, w/ or w/o lower/upper bounds, for example "Give me all entities before this given timestamp" or "Give me all nodes between these two timestamps". Please note that the timestamps don't need to represent actual points in time, any long that identifies the indexed Node or Relationship and defines its global order is fine.


Method Summary
 void add(T entity, long timestamp)
          Adds an entity to this timeline with the given timestamp.
 IndexHits<T> getBetween(Long startTimestampOrNull, Long endTimestampOrNull)
          Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date with lowest first.
 IndexHits<T> getBetween(Long startTimestampOrNull, Long endTimestampOrNull, boolean reversed)
          Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date.
 T getFirst()
           
 T getLast()
           
 void remove(T entity, long timestamp)
          Removes an entity from the timeline.
 

Method Detail

getLast

T getLast()
Returns:
the last entity in the timeline, that is the entity with the highest timestamp or null if the timeline is empty.

getFirst

T getFirst()
Returns:
the first entity in the timeline, that is the entity with the lowest timestamp or null if the timeline is empty.

remove

void remove(T entity,
            long timestamp)
Removes an entity from the timeline. The timestamp should be the same as when it was added.

Parameters:
entity - the entity to remove from this timeline.
timestamp - the timestamp this entity was added with.

add

void add(T entity,
         long timestamp)
Adds an entity to this timeline with the given timestamp.

Parameters:
entity - the entity to add to this timeline.
timestamp - the timestamp to use.

getBetween

IndexHits<T> getBetween(Long startTimestampOrNull,
                        Long endTimestampOrNull,
                        boolean reversed)
Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date. If reversed is true the order of the result is reversed.

Parameters:
startTimestampOrNull - the start timestamp, entities with greater timestamp value will be returned (exclusive). Will be ignored if null.
endTimestampOrNull - the end timestamp, entities with lesser timestamp
reversed - reverses the result order if true. value will be returned (exclude). Will be ignored if null.
Returns:
all entities within the given boundaries in this timeline, ordered by timestamp.

getBetween

IndexHits<T> getBetween(Long startTimestampOrNull,
                        Long endTimestampOrNull)
Query the timeline with optional lower/upper bounds and get back entities within that range, ordered by date with lowest first.

Parameters:
startTimestampOrNull - the start timestamp, entities with greater timestamp value will be returned (exclusive). Will be ignored if null.
endTimestampOrNull - the end timestamp, entities with lesser timestamp value will be returned (exclude). Will be ignored if null.
Returns:
all entities within the given boundaries in this timeline, ordered by timestamp.

Neo4j Enterprise

Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.