diff --git a/README.md b/README.md index f275e25bb5de5ed9e32feddb3c8ff69eb0ac923a..1186902d476f10d85722b269b48fc2d387a6124b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # GRAIL _Graph Represented Algorithm Implementation Layer_ -GRAIL is an Algorithm Implementation layer that allows arbitrary algorithms to be backed, and executed from, a graph +GRAIL is an algorithm implementation layer that allows arbitrary algorithms to be backed, and executed, from a graph database. The backing graph database can be either an on-disk server instance or a purely local in-memory instance. This allows generic tools to be interfaced to accomplish an assortment of extensions such as: distributed processing, -visualizations, indexing, graph traversal, [SPARQL](http://en.wikipedia.org/wiki/SPARQL) queries and much more. +visualizations, indexing, graph traversal, [SPARQL](http://en.wikipedia.org/wiki/SPARQL) queries, and much more. GRAIL uses a native [TinkerPop](http://www.tinkerpop.com) stack, this means it can support virtually every graph -database available to you. A few examples of supported Graph Databases are as follows: +database available to you. A few examples of supported Graph Databases are as follows. * [Titan](http://thinkaurelius.github.io/titan/) * [Neo4j](http://neo4j.com) @@ -16,7 +16,7 @@ database available to you. A few examples of supported Graph Databases are as fo * [Oracle NoSQL](http://www.oracle.com/us/products/database/nosql/overview/index.html) * [TinkerGraph](https://github.com/tinkerpop/blueprints/wiki/TinkerGraph) -TinkerPop also provides several tools which can be used to work with GRAIL backed Algorithms including: +TinkerPop also provides several tools which can be used to work with GRAIL backed algorithms. * **Furnace** - Graph analysis utilities * **Frames** - An object-to-graph mapping similar to ORM for relational databases @@ -24,16 +24,19 @@ TinkerPop also provides several tools which can be used to work with GRAIL backe * **Gremlin** - A graph query language * **Blueprints** - A standard graph API -Finally, depending on the choice of graph database backend it is possible to utilize any of the following features -if provided by the backend. +Finally, depending on the choice of a graph database backend, it is possible to utilize any of the following features. * Elastic and linear scaling capabilities -* [ACID](http://en.wikipedia.org/wiki/ACID) and [BASE](http://en.wikipedia.org/wiki/Eventual_consistency) consistency models +* [ACID](http://en.wikipedia.org/wiki/ACID) and [BASE](http://en.wikipedia.org/wiki/Eventual_consistency) consistency +models * Distributed data, replication, high availability, and fault tolerance -* [Apache Hadoop](http://hadoop.apache.org) Integration providing graph analytics, reporting, and ETL features -* Indexing and search utilities including: [ElasticSearch](http://www.elasticsearch.org/overview/elasticsearch), [Solr](http://lucene.apache.org/solr/), and [Lucene](http://lucene.apache.org) +* [Faunus](https://github.com/thinkaurelius/faunus) Gremlin-based distributed graph analytics, backed by an Hadoop +cluster. +* Direct [Apache Hadoop](http://hadoop.apache.org) integration providing graph analytics, reporting, and ETL features +* Indexing and search utilities including: [ElasticSearch](http://www.elasticsearch.org/overview/elasticsearch), +[Solr](http://lucene.apache.org/solr/), and [Lucene](http://lucene.apache.org) -It is important to note that a Titan backend supports all the above features. +A Titan backend can support all the above features. ## Obtaining the Source @@ -45,5 +48,5 @@ git clone http://gerrit.syncleus.com/GRAIL-core ``` We also maintain a GitHub clone of the official repository which can be found -[here](https://github.com/Syncleus/GRAIL-core). Finally Syncleus also hosts an instance of GitLab which also hosts a +[here](https://github.com/Syncleus/GRAIL-core). Finally Syncleus also hosts an instance of GitLab which has a clone of the repository which can be found [here](http://gitlab.syncleus.com/syncleus/GRAIL-core). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6045b96a3a214eafd2e279c0b8c4d60bc1715b01..677e41ef0f6329accaab545794cfb228d7a7d645 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,12 @@ <name>GRAIL</name> <inceptionYear>2014</inceptionYear> + <description> + GRAIL is an algorithm implementation layer that allows arbitrary algorithms to be backed, and executed + from, a graph database. The backing graph database can be either an on-disk server instance or a purely local + in-memory instance. This allows generic tools to be interfaced to accomplish an assortment of extensions such + as: distributed processing, visualizations, indexing, graph traversal, SPARQL queries and much more. + </description> <licenses> <license> diff --git a/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java b/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java index b394b000ba0e880add66405eb038fbe2b9041e48..5b2a7da2586fefdeb2cfee7fa7ddb9e3b1e5fce0 100644 --- a/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java +++ b/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java @@ -28,6 +28,11 @@ public abstract class AbstractSignalMultiplyingEdge implements SignalMultiplying private static final double OFFSET = -1.0; private static final double SCALE = 0.1; + /** + * Initializes newly constructed elements with default values. + * + * @since 0.1 + */ @Initializer public void init() { this.setWeight(((AbstractSignalMultiplyingEdge.RANDOM.nextDouble() * AbstractSignalMultiplyingEdge.RANGE) + AbstractSignalMultiplyingEdge.OFFSET) * AbstractSignalMultiplyingEdge.SCALE); diff --git a/src/main/java/com/syncleus/grail/graph/Node.java b/src/main/java/com/syncleus/grail/graph/Node.java index 6ad2bfcec200e8dc938b46973d7efe0a5d4a1014..567c8d0ec114993f15069a746bbd3f722f7fc725 100644 --- a/src/main/java/com/syncleus/grail/graph/Node.java +++ b/src/main/java/com/syncleus/grail/graph/Node.java @@ -21,6 +21,14 @@ package com.syncleus.grail.graph; import com.tinkerpop.frames.VertexFrame; import com.tinkerpop.frames.modules.typedgraph.*; +/** + * A node in a graph. All custom graph node types should inherit this interface. This is required to properly handle + * class typing and instantiation from a graph. A global GRAIL specific TinkerPop TypeField is implemented on this + * class which is required to coordinate class instantiation. Therefore while custom nodes are welcome to implement + * a TypeValue annotation to their classes they should never implement their own TypeField. + * + * @since 0.1 + */ @TypeField("type") public interface Node extends VertexFrame { } diff --git a/src/main/java/com/syncleus/grail/graph/SignalMultiplyingEdge.java b/src/main/java/com/syncleus/grail/graph/SignalMultiplyingEdge.java index ee9d5016ba93550da10b54f38787214074473a13..79e48fbba43a1e4587ef50dcc588812eed863927 100644 --- a/src/main/java/com/syncleus/grail/graph/SignalMultiplyingEdge.java +++ b/src/main/java/com/syncleus/grail/graph/SignalMultiplyingEdge.java @@ -22,13 +22,31 @@ import com.tinkerpop.frames.*; import com.tinkerpop.frames.modules.javahandler.*; import com.tinkerpop.frames.modules.typedgraph.*; +/** + * A graph edge which multiplies the signal from the source node by the edges weight. It then stores the result in the + * signal for this edge. + * + * @since 0.1 + */ @TypeField("type") @TypeValue("Synapse") @JavaHandlerClass(AbstractSignalMultiplyingEdge.class) public interface SignalMultiplyingEdge extends Weighted, Signaler, EdgeFrame { + /** + * The node connected to the source end of this edge. + * + * @return the source node. + * @since 0.1 + */ @OutVertex Signaler getSource(); + /** + * This method will propagate the signal from the source node into this edges signal. It will multiply the source + * node's signal by this edges weight and set that value as this edge's new signal. + * + * @since 0.1 + */ @JavaHandler void propagate(); } diff --git a/src/main/java/com/syncleus/grail/graph/SignalNode.java b/src/main/java/com/syncleus/grail/graph/SignalNode.java index 6b5ec40a75d634934b71aa4587a74a0510c3e091..1738f21a326cfab568214ade00beb3f7d2e29b72 100644 --- a/src/main/java/com/syncleus/grail/graph/SignalNode.java +++ b/src/main/java/com/syncleus/grail/graph/SignalNode.java @@ -18,5 +18,10 @@ ******************************************************************************/ package com.syncleus.grail.graph; +/** + * A graph node which has a signal property. + * + * @since 0.1 + */ public interface SignalNode extends Signaler, Node { } diff --git a/src/main/java/com/syncleus/grail/graph/Signaler.java b/src/main/java/com/syncleus/grail/graph/Signaler.java index 0e1328260385be7d3ccf5cecafc13ed50fe63994..5314a01c36227755c237973556f1cf728a9a8d9b 100644 --- a/src/main/java/com/syncleus/grail/graph/Signaler.java +++ b/src/main/java/com/syncleus/grail/graph/Signaler.java @@ -20,10 +20,28 @@ package com.syncleus.grail.graph; import com.tinkerpop.frames.Property; +/** + * A signaler is any graph object which has a signal. A signal is just a double value that varies with time and is + * represented as a property of the graph object. + * + * @since 0.1 + */ public interface Signaler { + /** + * Get the signal property of the graph object. + * + * @return the signal. + * @since 0.1 + */ @Property("signal") Double getSignal(); + /** + * Set the signal property of the graph object. + * + * @param signal the signal. + * @since 0.1 + */ @Property("signal") void setSignal(double signal); } diff --git a/src/main/java/com/syncleus/grail/graph/TypedAdjacency.java b/src/main/java/com/syncleus/grail/graph/TypedAdjacency.java index 35331bace38a4f76ac2deecbadd17b5c68ed8186..dd01fb9eb936e12dc21c08ceca2d4abda218c4df 100644 --- a/src/main/java/com/syncleus/grail/graph/TypedAdjacency.java +++ b/src/main/java/com/syncleus/grail/graph/TypedAdjacency.java @@ -23,7 +23,17 @@ import com.tinkerpop.blueprints.Direction; import java.lang.annotation.*; /** - * Adjacencies annotate getters and adders to represent a Vertex adjacent to a Vertex. + * Adjacencies annotate getters and adders to represent a Vertex adjacent to a Vertex. This annotation extends the + * TinkerPop built-in Adjacency annotation. It allows type arguments to be passed into the annotated method. This + * ensures the returned type is of the specified type in the argument. The following method signatures are valid. + * + * T add*(Class<T> type) + * T get*(Class<T> type) + * + * When annotating a get* class it ensures it only returns nodes of the specified type (including sub-classes). Any + * Nodes which are not of this type will not be returned. + * + * @since 0.1 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -32,6 +42,7 @@ public @interface TypedAdjacency { * The label of the edges making the adjacency between the vertices. * * @return the edge label + * @since 0.1 */ String label(); @@ -39,6 +50,7 @@ public @interface TypedAdjacency { * The edge direction of the adjacency. * * @return the direction of the edges composing the adjacency + * @since 0.1 */ Direction direction() default Direction.OUT; } diff --git a/src/main/java/com/syncleus/grail/graph/TypedIncidence.java b/src/main/java/com/syncleus/grail/graph/TypedIncidence.java index ffe9e64a5ae2c1cc6f8386b3e965140413c9a129..ac82c03d07163652fc3be394061db5e789576331 100644 --- a/src/main/java/com/syncleus/grail/graph/TypedIncidence.java +++ b/src/main/java/com/syncleus/grail/graph/TypedIncidence.java @@ -23,7 +23,18 @@ import com.tinkerpop.blueprints.Direction; import java.lang.annotation.*; /** - * Incidences annotate getters and adders to represent a Vertex incident to an Edge. + * Incidences annotate getters and adders to represent a Vertex incident to an Edge. This annotation extends the + * TinkerPop built-in Incidence annotation. It allows type arguments to be passed into the annotated method. This + * ensures the returned type is of the specified type in the argument. The following method signatures are valid. + * + * + * T add*(Class<T> type) + * T get*(Class<T> type) + * + * When annotating a get* class it ensures it only returns nodes of the specified type (including sub-classes). Any + * Nodes which are not of this type will not be returned. + * + * @since 0.1 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -32,6 +43,7 @@ public @interface TypedIncidence { * The labels of the edges that are incident to the vertex. * * @return the edge label + * @since 0.1 */ String label(); @@ -39,6 +51,7 @@ public @interface TypedIncidence { * The direction of the edges. * * @return the edge direction + * @since 0.1 */ Direction direction() default Direction.OUT; } diff --git a/src/main/java/com/syncleus/grail/graph/Weighted.java b/src/main/java/com/syncleus/grail/graph/Weighted.java index 7216652be8e53c183bb9875aa8f1d1845987225e..2c08d423fa0e5d21c76ae312fbabb38554b75dbd 100644 --- a/src/main/java/com/syncleus/grail/graph/Weighted.java +++ b/src/main/java/com/syncleus/grail/graph/Weighted.java @@ -20,9 +20,28 @@ package com.syncleus.grail.graph; import com.tinkerpop.frames.Property; +/** + * A weighted graph object. This interface represents any object in a graph with a weight property. A weight is simply + * a double value that may or may not change over time. + * + * @since 0.1 + */ public interface Weighted { + /** + * Get the weight property for this object. + * + * @return the weight property. + * @since 0.1 + */ @Property("weight") Double getWeight(); + + /** + * Set the weight property for this object. + * + * @param weight new weight to set. + * @since 0.1 + */ @Property("weight") void setWeight(double weight); } diff --git a/src/main/java/com/syncleus/grail/graph/action/AbstractPrioritySerialTrigger.java b/src/main/java/com/syncleus/grail/graph/action/AbstractPrioritySerialTrigger.java index 15bbe8ebe012036d79587f9a9d33fb30230c9cb9..a040d5ddfc53bab762a1719c344eba84d40bd9e4 100644 --- a/src/main/java/com/syncleus/grail/graph/action/AbstractPrioritySerialTrigger.java +++ b/src/main/java/com/syncleus/grail/graph/action/AbstractPrioritySerialTrigger.java @@ -68,7 +68,7 @@ public abstract class AbstractPrioritySerialTrigger extends AbstractActionTrigge final int priorityB = java.lang.Integer.parseInt(argument.getB().getProperty("triggerPriority").toString()); if( priorityA == priorityB ) return 0; - else if(priorityA > priorityB) + else if(priorityA < priorityB) return 1; else return -1; diff --git a/src/main/java/com/syncleus/grail/graph/action/Action.java b/src/main/java/com/syncleus/grail/graph/action/Action.java index ec91a61b47785620826a195911c144522b6aa481..a0f1f9999b430b318fec0182c15618bd83a60a14 100644 --- a/src/main/java/com/syncleus/grail/graph/action/Action.java +++ b/src/main/java/com/syncleus/grail/graph/action/Action.java @@ -20,8 +20,21 @@ package com.syncleus.grail.graph.action; import java.lang.annotation.*; +/** + * Graph object methods can be annotated with an Action annotation to indicate methods which process the internal state + * of a node or edge. Using reflection these methods may be triggered by other objects in the graph such as ActionNodes. + * An action node graph will coordinate the firing of actions across a graph. + * + * @since 0.1 + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Action { + /** + * The name to be given to the action. This allows an action node to select which action to trigger on an object. + * + * @return the action name. + * @since 0.1 + */ String value(); } diff --git a/src/main/java/com/syncleus/grail/graph/action/ActionTrigger.java b/src/main/java/com/syncleus/grail/graph/action/ActionTrigger.java index 5e741771bd8ef57e81fc0c529e7db20bb1900f03..a5a1a186b14e7111684820507835304d108e8609 100644 --- a/src/main/java/com/syncleus/grail/graph/action/ActionTrigger.java +++ b/src/main/java/com/syncleus/grail/graph/action/ActionTrigger.java @@ -21,40 +21,92 @@ package com.syncleus.grail.graph.action; import com.syncleus.grail.graph.*; import com.tinkerpop.frames.*; +/** + * An ActionTrigger is a graph node which coordinates the firing of action methods across a graph. Action triggers have + * trigger edges which define the node to be triggered, and the name of the action on the node which is to be triggered. + * ActionTriggers can be implemented to define various schemes for triggering actions including the order in which + * actions are triggered as well as if those actions can be triggered in parallel or in serial. ActionTrigger classes + * can also be chained together to create more elaborate patterns. + * + * @since 0.1 + */ public interface ActionTrigger extends Node { + /** + * This will initiate the execution of the action's triggered by this node. The trigger method is also annotated as + * an action with label actionTrigger. This allows for multiple ActionTrigger classes to be chained together. + * + * @since 0.1 + */ @Action("actionTrigger") void trigger(); + /** + * All the nodes in the graph triggered by this Node. + * + * @return an iterable collection of nodes to be triggered. + * @since 0.1 + */ @Adjacency(label="triggers") Iterable<? extends Node> getTriggers(); + /** + * All the nodes in the graph of the specified type which are triggered by this node. + * + * @param type The type to be retrieved, only triggered nodes of this type of its subtypes will be returned. + * @param <N> The class type. + * @return an iterable collection of nodes to be triggered of the specified type. + */ @TypedAdjacency(label="triggers") <N extends Node> Iterable<? extends N> getTriggers(Class<? extends N> type); - @Adjacency(label="triggers") - void setTriggers(Iterable<? extends Node> targets); - + /** + * Remove a node from being triggered. This will remove the trigger edge connecting to the specified node. + * + * @param target node which is to be removed. + * @since 0.1 + */ @Adjacency(label="triggers") void removeTrigger(Node target); - @Adjacency(label="triggers") - <N extends Node> N addTrigger(N target); - - @Adjacency(label="triggers") - Node addTrigger(); - - @TypedAdjacency(label="triggers") - <N extends Node> N addTrigger(Class<? extends N> type); - + /** + * All edges in the graph which connect to nodes being triggered by this node. + * + * @return an iterable collection of trigger edges. + * @since 0.1 + */ @Incidence(label = "triggers") Iterable<? extends ActionTriggerEdge> getTriggerEdges(); + /** + * All edges in the graph which connect to nodes being triggered by this node. However this method will only return + * edges that are of the specified type or a subclass of the type. + * + * @param type The class of edges to retrieve + * @param <E> The class type parameter. + * @return An iterable collection of ActionTriggerEdges + * @since 0.1 + */ @TypedIncidence(label="triggers") <E extends ActionTriggerEdge> Iterable<? extends E> getTriggerEdges(Class<? extends E> type); + /** + * Adds a new edge indicating that the target node should be triggered by this node. + * + * @param target The new ActionTriggerEdge to add to the graph. + * @param <E> The type of ActionTriggerEdge + * @return the same value as the target which was pased in. + * @since 0.1 + */ @Incidence(label = "triggers") <E extends ActionTriggerEdge> E addTriggerEdge(E target); + /** + * Removes the specified AcionTriggerEdge from the graph. The target of the edge will no longer be triggered by this + * node. + * + * @param target The ActionTriggerEdge to remove from the graph. + * @since 0.1 + */ @Incidence(label = "triggers") void removeTriggerEdge(ActionTriggerEdge target); } diff --git a/src/main/java/com/syncleus/grail/graph/action/ActionTriggerEdge.java b/src/main/java/com/syncleus/grail/graph/action/ActionTriggerEdge.java index fd6e8e74f7cd68ee883f4a8eb57753fbd915127b..2c2d5f818c7db854514b32cb980e2d170d837643 100644 --- a/src/main/java/com/syncleus/grail/graph/action/ActionTriggerEdge.java +++ b/src/main/java/com/syncleus/grail/graph/action/ActionTriggerEdge.java @@ -22,18 +22,49 @@ import com.syncleus.grail.graph.Node; import com.tinkerpop.frames.*; import com.tinkerpop.frames.modules.typedgraph.*; +/** + * A graph edge which connects an action trigger to the node which it triggers actions on. + * + * @since 0.1 + */ @TypeField("type") @TypeValue("ActionTriggerEdge") public interface ActionTriggerEdge extends EdgeFrame { + /** + * Gets the name of the action to be triggered. The target node must have at least one valid method annotated as an + * action with this name. + * + * @return The name of the action to trigger. + * @since 0.1 + */ @Property("triggerAction") String getTriggerAction(); + /** + * Sets the name of the action to be triggered. The target node must have at least one valid method annotated as an + * action with this name. + * + * @param triggerAction The new name for the action to be triggered. + * @since 0.1 + */ @Property("triggerAction") void setTriggerAction(String triggerAction); + /** + * The node to be triggered. + * + * @return the node to be triggered + * @since 0.1 + */ @InVertex Node getTarget(); + /** + * The action trigger capable of triggering the target node. + * + * @return the ActionTrigger + * @since 0.1 + */ @OutVertex ActionTrigger getSource(); } diff --git a/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTrigger.java b/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTrigger.java index b05e704307fb93ca5cb9ddc4ba381e7327d55583..2f7d1f79d656e9da57384103b1f3387988078703 100644 --- a/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTrigger.java +++ b/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTrigger.java @@ -22,6 +22,14 @@ import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy; import com.tinkerpop.frames.modules.javahandler.*; import com.tinkerpop.frames.modules.typedgraph.TypeValue; +/** + * An action trigger which triggers its actions in serial and ordered by their priority. Each out trigger edge from this + * node will be a PrioritySerialTriggerEdge which has a triggerPriority property. This property is an integer value + * which determines the priority of the edge, a higher value means preferential priority over a lower value. When + * triggered the actions associated with each edge will be triggered in series ordered by priority. + * + * @since 0.1 + */ @TypeValue("PrioritySerialTrigger") @JavaHandlerClass(AbstractPrioritySerialTrigger.class) public interface PrioritySerialTrigger extends ActionTrigger { @@ -30,7 +38,13 @@ public interface PrioritySerialTrigger extends ActionTrigger { @Override void trigger(); - //@GremlinGroovy(value="it.outE('triggers').order{it.a.triggerPriority<=>it.b.triggerPriority}._()") + /** + * Get all the prioritized trigger edges connecting to the target nodes to act on. These edges will be returned such + * that they are sorted from highest priority to the lowest. + * + * @return An iterable collection of PrioritySerialTriggerEdges from highest to lowest priority. + * @since 0.1 + */ @JavaHandler Iterable<? extends PrioritySerialTriggerEdge> getPrioritizedTriggerEdges(); } diff --git a/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTriggerEdge.java b/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTriggerEdge.java index 06f5790d43c60368387be39ed0168613fe90fbef..3c44b1ecfc88bd68dbcc92443b764fb40c33bec0 100644 --- a/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTriggerEdge.java +++ b/src/main/java/com/syncleus/grail/graph/action/PrioritySerialTriggerEdge.java @@ -22,17 +22,38 @@ import com.syncleus.grail.graph.Node; import com.tinkerpop.frames.*; import com.tinkerpop.frames.modules.typedgraph.TypeValue; +/** + * A prioritized trigger edge. These are used when trigger edges need to be executed in sequential order by a + * PrioritySerialTrigger. + * + * @since 0.1 + */ @TypeValue("PrioritySerialTriggerEdge") public interface PrioritySerialTriggerEdge extends ActionTriggerEdge { + /** + * Get the triggerPriority property, an integer value indicating the priority of this edge and its associated + * action. + * + * @return an integer value representing the trigger priority. + * @since 0.1 + */ @Property("triggerPriority") Integer getTriggerPriority(); + /** + * Set the triggerPriority property, an integer value indicating the priority of this edge and its associated + * action. + * @param triggerPriority the new priority value. + * @since 0.1 + */ @Property("triggerPriority") - void setTriggerPriority(int triggerAction); + void setTriggerPriority(int triggerPriority); + @Override @InVertex Node getTarget(); + @Override @OutVertex ActionTrigger getSource(); } diff --git a/src/main/java/com/syncleus/grail/package-info.java b/src/main/java/com/syncleus/grail/package-info.java index 56e54971973e0b2c852e665cdfc40420e217e109..fd15c47012050274bbc551d9dca432b8e6029103 100644 --- a/src/main/java/com/syncleus/grail/package-info.java +++ b/src/main/java/com/syncleus/grail/package-info.java @@ -16,4 +16,11 @@ * Philadelphia, PA 19148 * * * ******************************************************************************/ -package com.syncleus.grail; + +/** + * GRAIL is an Algorithm Implementation layer that allows arbitrary algorithms to be backed, and executed from, a graph + * database. The backing graph database can be either an on-disk server instance or a purely local in-memory instance. + * This allows generic tools to be interfaced to accomplish an assortment of extensions such as: distributed processing, + * visualizations, indexing, graph traversal, SPARQL queries and much more. + */ +package com.syncleus.grail; \ No newline at end of file diff --git a/src/test/java/com/syncleus/grail/neural/backprop/ActionTriggerXor3InputTest.java b/src/test/java/com/syncleus/grail/neural/backprop/ActionTriggerXor3InputTest.java index e02711fb6a661bda7de94ff13a56445d1c4bfb12..f97e9c02c86c25c8fe8a82a19be5fd3a5702403c 100644 --- a/src/test/java/com/syncleus/grail/neural/backprop/ActionTriggerXor3InputTest.java +++ b/src/test/java/com/syncleus/grail/neural/backprop/ActionTriggerXor3InputTest.java @@ -73,7 +73,7 @@ public class ActionTriggerXor3InputTest { final PrioritySerialTrigger propagateOutputTrigger = ActionTriggerXor3InputTest.createPrioritySerialTrigger(graph); //connect it to the output neuron with a priority of 0 (highest priority) final PrioritySerialTriggerEdge outputTriggerEdge = graph.addEdge(null, propagateOutputTrigger.asVertex(), newOutputNeuron.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - outputTriggerEdge.setTriggerPriority(0); + outputTriggerEdge.setTriggerPriority(1000); outputTriggerEdge.setTriggerAction("propagate"); //now lets handle the hidden layer for propagation @@ -82,13 +82,13 @@ public class ActionTriggerXor3InputTest { //connect it to each of the hidden neurons with a priority of 0 (highest priority) for (final BackpropNeuron hiddenNeuron : newHiddenNeurons) { final PrioritySerialTriggerEdge newEdge = graph.addEdge(null, propagateHiddenTrigger.asVertex(), hiddenNeuron.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - newEdge.setTriggerPriority(0); + newEdge.setTriggerPriority(1000); newEdge.setTriggerAction("propagate"); } //chain the prop[agation of the hidden layer to the propagation of the output layer, but make sure it has less of a priority than the other triggers final PrioritySerialTriggerEdge chainTriggerPropagateEdge = graph.addEdge(null, propagateHiddenTrigger.asVertex(), propagateOutputTrigger.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - chainTriggerPropagateEdge.setTriggerPriority(1000); + chainTriggerPropagateEdge.setTriggerPriority(0); chainTriggerPropagateEdge.setTriggerAction("actionTrigger"); //next lets handle the input layer for back propagation @@ -96,12 +96,12 @@ public class ActionTriggerXor3InputTest { //connect it to each of the input neurons for (final BackpropNeuron inputNeuron : newInputNeurons) { final PrioritySerialTriggerEdge newEdge = graph.addEdge(null, backpropInputTrigger.asVertex(), inputNeuron.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - newEdge.setTriggerPriority(0); + newEdge.setTriggerPriority(1000); newEdge.setTriggerAction("backpropagate"); } //also connect it to all the bias neurons final PrioritySerialTriggerEdge biasTriggerBackpropEdge = graph.addEdge(null, backpropInputTrigger.asVertex(), biasNeuron.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - biasTriggerBackpropEdge.setTriggerPriority(0); + biasTriggerBackpropEdge.setTriggerPriority(1000); biasTriggerBackpropEdge.setTriggerAction("backpropagate"); //create backpropagation trigger for the hidden layer @@ -110,13 +110,13 @@ public class ActionTriggerXor3InputTest { //connect it to each of the hidden neurons with a priority of 0 (highest priority) for (final BackpropNeuron hiddenNeuron : newHiddenNeurons) { final PrioritySerialTriggerEdge newEdge = graph.addEdge(null, backpropHiddenTrigger.asVertex(), hiddenNeuron.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - newEdge.setTriggerPriority(0); + newEdge.setTriggerPriority(1000); newEdge.setTriggerAction("backpropagate"); } //chain the hidden layers back propagation to the input layers trigger final PrioritySerialTriggerEdge chainTriggerBackpropEdge = graph.addEdge(null, backpropHiddenTrigger.asVertex(), backpropInputTrigger.asVertex(), "triggers", PrioritySerialTriggerEdge.class); - chainTriggerBackpropEdge.setTriggerPriority(1000); + chainTriggerBackpropEdge.setTriggerPriority(0); chainTriggerBackpropEdge.setTriggerAction("actionTrigger"); //commit everything