Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index creation/access API #50

Merged
merged 2 commits into from
May 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main/java/com/bio4j/angulillos/TypedEdgeIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface TypedEdgeIndex <
interface Unique <
E extends TypedEdge<?,?, E,ET, ?,?, ?,?,?>,
ET extends TypedEdge.Type<?,?, E,ET, ?,?, ?,?,?>,
P extends Property<ET,X>,
P extends Property<ET,X> & Arity.FromAtMostOne,
X
> extends
TypedEdgeIndex<E,ET, P,X>,
Expand All @@ -28,19 +28,17 @@ interface Unique <
default Optional<E> getEdge(X byValue) { return getElement(byValue); }
}

interface List <
interface NonUnique <
E extends TypedEdge<?,?, E,ET, ?,?, ?,?,?>,
ET extends TypedEdge.Type<?,?, E,ET, ?,?, ?,?,?>,
P extends Property<ET,X>,
X
> extends
TypedEdgeIndex<E,ET, P,X>,
TypedElementIndex.List<E,ET, P,X>
TypedElementIndex.NonUnique<E,ET, P,X>
{

/* get a list of nodes by providing a value of the indexed property. */
default Stream<E> getEdges(X byValue) { return getElements(byValue); }
}


}
6 changes: 2 additions & 4 deletions src/main/java/com/bio4j/angulillos/TypedElementIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@ public interface TypedElementIndex <

default FT elementType() { return property().elementType(); }


/* Query this index by comparing the property value with the given one */
Stream<F> query(QueryPredicate.Compare predicate, X value);

/* Query this index by checking whether the property value is in/not in the given collection */
Stream<F> query(QueryPredicate.Contain predicate, Collection<X> values);


/* This interface declares that this index is over a property that uniquely classifies a element type for exact match queries */
interface Unique <
// element
F extends TypedElement<F,FT, ?,?>,
FT extends TypedElement.Type<F,FT, ?,?>,
// property
P extends Property<FT,X>,
P extends Property<FT,X> & Arity.FromAtMostOne,
X
>
extends TypedElementIndex<F,FT, P,X>
Expand All @@ -53,7 +51,7 @@ default Optional<F> getElement(X byValue) {
}

/* This interface declares that this index is over a property that classifies lists of elements for exact match queries */
interface List <
interface NonUnique <
// element
F extends TypedElement<F,FT, ?,?>,
FT extends TypedElement.Type<F,FT, ?,?>,
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/bio4j/angulillos/TypedVertexIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface TypedVertexIndex <
interface Unique <
V extends TypedVertex<V,VT, ?,?,?>,
VT extends TypedVertex.Type<V,VT, ?,?,?>,
P extends Property<VT,X>,
P extends Property<VT,X> & Arity.FromAtMostOne,
X
> extends
TypedVertexIndex<V,VT, P,X>,
Expand All @@ -35,18 +35,17 @@ interface Unique <
}

/* This interface declares that this index is over a property that classifies lists of vertices for exact match queries; it adds the method `getTypedVertexs` for that. */
interface List <
interface NonUnique <
V extends TypedVertex<V,VT, ?,?,?>,
VT extends TypedVertex.Type<V,VT, ?,?,?>,
P extends Property<VT,X>,
X
> extends
TypedVertexIndex<V,VT, P,X>,
TypedElementIndex.List<V,VT, P,X>
TypedElementIndex.NonUnique<V,VT, P,X>
{

/* get a list of vertices by providing a value of the property. The default */
default Stream<V> getVertices(X byValue) { return getElements(byValue); }
}

}
2 changes: 2 additions & 0 deletions src/main/java/com/bio4j/angulillos/TypedVertexQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
## Vertex queries

This two interfaces are the typed version of Blueprints `VertexQuery`. Given a node, we can use this for querying relationships of a given type in or out of that node.

**IMPORTANT** Ignored in build. Needs update.
*/
public interface VertexQueryOut <
// vertex
Expand Down