本文整理汇总了Java中org.neo4j.graphdb.traversal.Evaluation类的典型用法代码示例。如果您正苦于以下问题:Java Evaluation类的具体用法?Java Evaluation怎么用?Java Evaluation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Evaluation类属于org.neo4j.graphdb.traversal包,在下文中一共展示了Evaluation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPatternMatch
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
private Traverser getPatternMatch(Node startNode, final List<String> patterns, final List<NodeLabel> nodeLabels, final List<LinkLabel> linkLabels) {
TraversalDescription td = database.traversalDescription()
.depthFirst()
.evaluator( new Evaluator() {
public Evaluation evaluate( final org.neo4j.graphdb.Path path ) {
if ( path.length() == 0 ) {
return Evaluation.EXCLUDE_AND_CONTINUE;
}
boolean isToken = path.endNode().hasLabel(NodeLabel.WordToken);
boolean included = isToken && (path.length() == 1 || nodeHasAnnotation(path.endNode(), linkLabels.get(path.length() - 1), patterns.get(path.length() - 1)));
boolean continued = path.length() < patterns.size();
return Evaluation.of( included, continued );
}
} )
.relationships(LinkLabel.NEXT, Direction.OUTGOING)
.relationships(LinkLabel.HAS_TYPE, Direction.INCOMING)
.relationships(LinkLabel.HAS_LEMMA, Direction.INCOMING)
.relationships(LinkLabel.HAS_POS_TAG, Direction.INCOMING)
.relationships(LinkLabel.HAS_HEAD, Direction.INCOMING);
return td.traverse(startNode);
}
示例2: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
/**
* Evaluates a node and determines whether to include and / or continue.
* Continues on and returns exactly those nodes that:
* <ul>
* <li>haven't been visited yet and</li>
* <li>are the start node
* <ul>
* <li>have a sequence < threshold (and thus belong to the same cluster)</li>
* </ul>
* </ul>
*/
@Override
public Evaluation evaluate(Path path) {
Node end = path.endNode();
int score = is.compute(new Neo4jScoreContainer(end));
end.setProperty(SequenceProperties.INTERESTINGNESS.name(), score);
String id = (String) end.getProperty(ID.name());
if (!visited.contains(id)
&& (path.startNode().getId() == path.endNode().getId()
|| score < threshold)) {
visited.add(id);
return Evaluation.INCLUDE_AND_CONTINUE;
}
return Evaluation.EXCLUDE_AND_PRUNE;
}
示例3: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
public Evaluation evaluate( Path position )
{
boolean includes = true;
boolean continues = true;
for ( Evaluator evaluator : this.evaluators )
{
Evaluation bla = evaluator.evaluate( position );
if ( !bla.includes() )
{
includes = false;
}
if ( !bla.continues() )
{
continues = false;
}
if ( !continues && !includes )
{
return Evaluation.EXCLUDE_AND_PRUNE;
}
}
return Evaluation.of( includes, continues );
}
示例4: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path, BranchState branchState) {
if (path.endNode().hasLabel(stopLabel)) {
return Evaluation.EXCLUDE_AND_PRUNE;
} else {
return Evaluation.INCLUDE_AND_CONTINUE;
}
}
示例5: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path, BranchState<Double> branchState) {
// Path with just the single node, ignore it and continue
if (path.length() == 0 ) {
return Evaluation.INCLUDE_AND_CONTINUE;
}
// Make sure last Equipment voltage is equal to or lower than previous voltage
Double voltage = (Double) path.endNode().getProperty("voltage", 999.0);
if (voltage <= branchState.getState()) {
return Evaluation.INCLUDE_AND_CONTINUE;
} else {
return Evaluation.EXCLUDE_AND_PRUNE;
}
}
示例6: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
Node lastNode = path.endNode();
if (!lastNode.hasLabel(Labels.AirportDay)){
return Evaluation.EXCLUDE_AND_CONTINUE;
} else if (destinations.contains( ((String)lastNode.getProperty("key")).substring(0,3) )) {
return Evaluation.INCLUDE_AND_PRUNE;
}
return Evaluation.EXCLUDE_AND_CONTINUE;
}
示例7: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
if (path.length() < length) {
return Evaluation.EXCLUDE_AND_CONTINUE;
}
Node lastNode = path.endNode();
if (!lastNode.hasLabel(Labels.AirportDay)){
return Evaluation.EXCLUDE_AND_CONTINUE;
} else if (destinations.contains( ((String)lastNode.getProperty("key")).substring(0,3) )) {
return Evaluation.INCLUDE_AND_PRUNE;
}
return Evaluation.EXCLUDE_AND_PRUNE;
}
示例8: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
if (!path.endNode().hasRelationship(Direction.OUTGOING)) {
leaves++;
depthSum += path.length();
}
return Evaluation.EXCLUDE_AND_CONTINUE;
}
示例9: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
long currentId = path.endNode().getId();
if (!nodePredicate.apply(path.endNode())) {
inMemoryIndex.get(currentId);
return Evaluation.EXCLUDE_AND_PRUNE;
}
long startId = path.startNode().getId(); // Vi
InOutList listPair = inMemoryIndex.get(currentId);
if (0 == path.length()) {
// first node in the traverse - add itself to the in-out list
listPair.getInList().add(currentId);
listPair.getOutList().add(currentId);
return Evaluation.INCLUDE_AND_CONTINUE;
}
else if (direction == Direction.INCOMING ) {
// doing reverse BFS
if (nodesAreConnected(currentId, startId)) {
return Evaluation.EXCLUDE_AND_PRUNE;
} else {
listPair.getOutList().add(startId);
return Evaluation.INCLUDE_AND_CONTINUE;
}
} else {
//doing BFS
if (nodesAreConnected(startId, currentId)) { // cur is w
return Evaluation.EXCLUDE_AND_PRUNE;
} else {
listPair.getInList().add(startId);
return Evaluation.INCLUDE_AND_CONTINUE;
}
}
}
示例10: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
public Evaluation evaluate( Path path )
{
// Before the Evaluator, when PruneEvaluator was used individually a PruneEvaluator
// was never called with the start node as argument. This condition mimics that behaviour.
if ( path.length() == 0 )
{
return Evaluation.INCLUDE_AND_CONTINUE;
}
return pruning.pruneAfter( path ) ? Evaluation.INCLUDE_AND_PRUNE : Evaluation.INCLUDE_AND_CONTINUE;
}
示例11: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
Node n = path.endNode();
UsageFacts facts = dao.readFacts(n.getId());
int size = facts == null ? -1 : facts.metrics.getNumDescendants() + facts.metrics.getNumSynonyms();
if (size > minChunkSize && (size < chunkSize || size - facts.metrics.getNumChildren() < minChunkSize)) {
chunkIds.add(n.getId());
return Evaluation.INCLUDE_AND_PRUNE;
} else {
return Evaluation.INCLUDE_AND_CONTINUE;
}
}
示例12: printResult
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
private Evaluation printResult( Evaluation evaluation )
{
System.out.print( String.format( " %s\n", evaluation.name() ) );
return evaluation;
}
示例13: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
public Evaluation evaluate( Path path )
{
printPath( path );
return printResult( innerEvaluator.evaluate( path ) );
}
示例14: evaluate
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
@Override
public Evaluation evaluate( Path path )
{
// TODO deal with this in better way
throw new UnsupportedOperationException();
}
示例15: evaluation
import org.neo4j.graphdb.traversal.Evaluation; //导入依赖的package包/类
public Evaluation evaluation()
{
return evaluation;
}