public class QueryIndex<T,C>
extends java.lang.Object
| Constructor and Description |
|---|
QueryIndex(int tupleSize)
Constructs a new query index for tuples of a given size
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Query<T,C> query)
Indexes a query for matching of future tuples
|
boolean |
add(T[] tuple,
java.util.function.BiConsumer<C,Bindings<T>> handler,
int ttl,
long now)
Consumes a tuple and matches it against any and all applicable queries,
possibly producing one or more solutions.
|
void |
clear()
Returns this index to its original, empty state, removing all queries and all solutions
|
void |
remove(Query<T,C> query)
Removes a previously added query.
|
void |
removeExpired(long now)
Enforce query and tuple time-to-live by removing expired graph patterns and solutions.
|
void |
renew(Query<T,C> query,
int ttl,
long now)
Renews a previously submitted query, applying a new time-to-live with respect to the current moment.
|
public QueryIndex(int tupleSize)
tupleSize - the size of tuples to index and match.
For RDF, an appropriate tuple size is 3, or 4 for RDF with Named Graphspublic void clear()
public void add(Query<T,C> query)
query - the query to indexpublic void remove(Query<T,C> query)
query - the query to removepublic void renew(Query<T,C> query, int ttl, long now)
query - the query to refreshttl - a time-to-live, in seconds. If the special value 0 is supplied, the query will never expire.now - the current time, in milliseconds since the Unix epochpublic boolean add(T[] tuple, java.util.function.BiConsumer<C,Bindings<T>> handler, int ttl, long now)
tuple - the input tuplehandler - a handler for any solutions producedttl - the time-to-live of the tuple and any derived solutions, in seconds.
Use 0 for infinite time-to-live.now - the current Unix time, in milliseconds (not seconds)public void removeExpired(long now)
now - the current time, in milliseconds since the Unix epochCopyright © 2016. All Rights Reserved.