当前位置: 首页>>代码示例>>Java>>正文


Java Path.endNode方法代码示例

本文整理汇总了Java中org.neo4j.graphdb.Path.endNode方法的典型用法代码示例。如果您正苦于以下问题:Java Path.endNode方法的具体用法?Java Path.endNode怎么用?Java Path.endNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.neo4j.graphdb.Path的用法示例。


在下文中一共展示了Path.endNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的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 &lt; 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;
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:27,代码来源:ClusterEvaluator.java

示例2: call

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
@Override
public Map<String, Set<Long>> call() throws Exception {
  logger.info("Processsing " + category);
  Map<String, Set<Long>> map = new HashMap<String, Set<Long>>();
  Set<Long> nodeSet = new HashSet<Long>();
  Transaction tx = graphDb.beginTx();
  try {
    for (Path position : graphDb.traversalDescription().uniqueness(Uniqueness.NODE_GLOBAL).depthFirst()
        .relationships(OwlRelationships.RDFS_SUBCLASS_OF, Direction.INCOMING).relationships(OwlRelationships.RDF_TYPE, Direction.INCOMING)
        .relationships(OwlRelationships.OWL_EQUIVALENT_CLASS, Direction.BOTH).relationships(OwlRelationships.OWL_SAME_AS, Direction.BOTH)
        .traverse(root)) {
      Node end = position.endNode();
      nodeSet.add(end.getId());
    }
    logger.info("Discovered " + nodeSet.size() + " nodes for " + category);
    map.put(category, nodeSet);
  } catch (Exception e) {
    logger.warning("IRI not found for category: " + category);
  } finally {
    tx.success();
    tx.close();
  }
  return map;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:25,代码来源:CategoryProcessor.java

示例3: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
@Override
public StepEvaluationResult evaluate( Path path, int stepState )
{
    Node startNode = path.endNode();
    int currentStepState = stepState + 1;
    RepetitionState repetitionState = getRepetitionState( stepState );

    switch ( repetitionState )
    {
    case TOO_LOW:
        if ( isMatch( startNode ) )
            return StepEvaluationResult.acceptStayExcludeContinue( currentStepState );
        else
            return StepEvaluationResult.REJECT_STAY_EXCLUDE_PRUNE;
    case ONLY_IN_RANGE:
        if ( isMatch( startNode ) )
            return StepEvaluationResult.ACCEPT_ADVANCE_EXCLUDE_CONTINUE;
        else
            return StepEvaluationResult.REJECT_STAY_EXCLUDE_PRUNE;
    case TOO_HIGH:
        return StepEvaluationResult.REJECT_STAY_EXCLUDE_PRUNE;
    default:
        throw new RuntimeException( "Should never get here" );
    }
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:26,代码来源:StepsBuilder.java

示例4: buildStepExpander

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
private StepExpander buildStepExpander( RelationshipFilterDescriptor relationshipDescriptor )
{
    List<PropertyContainerPredicate> relationshipPredicateList = relationshipDescriptor.getFilterPredicates();

    final PredicateGroup<PropertyContainer> relationshipPredicates = ( relationshipPredicateList.isEmpty() ) ? null
            : new PredicateGroup<PropertyContainer>(
                    relationshipPredicateList.toArray( new PropertyContainerPredicate[relationshipPredicateList.size()] ) );

    final Function<Node, Iterator<Relationship>> expandFun = relationshipDescriptor.expandFun();

    return new StepExpander()
    {
        @Override
        public Iterable<Relationship> expand( Path path, BranchState<StepState> state )
        {
            final Node startNode = path.endNode();
            Iterator<Relationship> relationships = ( null == relationshipPredicates ) ? expandFun.apply( startNode )
                    : Iterators.filter( expandFun.apply( startNode ), relationshipPredicates );
            return ImmutableList.copyOf( relationships );
        }
    };
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:23,代码来源:StepsBuilder.java

示例5: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的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;
}
 
开发者ID:maxdemarzi,项目名称:neo_airlines,代码行数:11,代码来源:ReachedDestinationEvaluator.java

示例6: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的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;
}
 
开发者ID:maxdemarzi,项目名称:neo_airlines,代码行数:15,代码来源:ReachedDestinationAtEvaluator.java

示例7: getOrthologs

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
Collection<Node> getOrthologs(Node source) throws IOException {
  Collection<Node> orthologs = new HashSet<>();
  for (Path path : orthologDescription.traverse(source)) {
    if (path.endNode().hasLabel(GENE_LABEL) && path.endNode() != source) {
      orthologs.add(path.endNode());
    }
  }
  return orthologs;
}
 
开发者ID:SciGraph,项目名称:golr-loader,代码行数:10,代码来源:GolrLoader.java

示例8: determineKeyEntities

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
private static void determineKeyEntities(final GraphDatabaseService graphDB, final AttributePath commonAttributePath,
                                         final ContentSchema prefixedContentSchema, final Map<Long, CSEntity> csEntities, final Node... csEntityNodesArray) {

	for (final AttributePath keyAttributePath : prefixedContentSchema.getKeyAttributePaths()) {

		final Optional<LinkedList<Attribute>> optionalRelativeKeyAttributePath = determineRelativeAttributePath(keyAttributePath,
				commonAttributePath);

		if (optionalRelativeKeyAttributePath.isPresent()) {

			final LinkedList<Attribute> relativeKeyAttributePath = optionalRelativeKeyAttributePath.get();

			final Iterable<Path> relativeKeyPaths = graphDB.traversalDescription().depthFirst()
					.evaluator(Evaluators.toDepth(relativeKeyAttributePath.size())).evaluator(new EntityEvaluator(relativeKeyAttributePath))
					.traverse(csEntityNodesArray);

			for (final Path relativeKeyPath : relativeKeyPaths) {

				final Node keyNode = relativeKeyPath.endNode();
				final Node csEntityNode = relativeKeyPath.startNode();
				final String keyValue = (String) keyNode.getProperty(GraphStatics.VALUE_PROPERTY, null);
				final KeyEntity keyEntity = new KeyEntity(keyNode.getId(), keyValue);
				csEntities.get(csEntityNode.getId()).addKeyEntity(keyEntity);
			}
		} else {

			LOG.debug("couldn't determine relative key attribute path for key attribute path '{}' and common attribute path ''",
					keyAttributePath.toString(), commonAttributePath.toString());
		}
	}
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:32,代码来源:GraphDBUtil.java

示例9: determineValueEntities

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
private static void determineValueEntities(final GraphDatabaseService graphDB, final AttributePath commonAttributePath,
                                           final ContentSchema contentSchema, final Map<Long, CSEntity> csEntities, final Node... csEntityNodesArray) {

	final AttributePath valueAttributePath = contentSchema.getValueAttributePath();

	final Optional<LinkedList<Attribute>> optionalRelativeValueAttributePath = determineRelativeAttributePath(
			valueAttributePath,
			commonAttributePath);

	if (optionalRelativeValueAttributePath.isPresent()) {

		final LinkedList<Attribute> relativeValueAttributePath = optionalRelativeValueAttributePath.get();

		final Iterable<Path> relativeValuePaths = graphDB.traversalDescription().depthFirst()
				.evaluator(Evaluators.toDepth(relativeValueAttributePath.size())).evaluator(new EntityEvaluator(relativeValueAttributePath))
				.traverse(csEntityNodesArray);

		for (final Path relativeValuePath : relativeValuePaths) {

			final Node valueNode = relativeValuePath.endNode();
			final Node csEntityNode = relativeValuePath.startNode();
			final String valueValue = (String) valueNode.getProperty(GraphStatics.VALUE_PROPERTY, null);
			final Long valueOrder = (Long) relativeValuePath.lastRelationship().getProperty(GraphStatics.ORDER_PROPERTY, null);
			final ValueEntity valueEntity = new ValueEntity(valueNode.getId(), valueValue, valueOrder);
			csEntities.get(csEntityNode.getId()).addValueEntity(valueEntity);
		}
	} else {

		LOG.debug("couldn't determine relative value attribute path for value attribute path '{}' and common attribute path ''",
				valueAttributePath.toString(), commonAttributePath.toString());
	}
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:33,代码来源:GraphDBUtil.java

示例10: nodes

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
public Iterable<Node> nodes()
{
    return new IterableWrapper<Node, Path>( this )
    {
        @Override
        protected Node underlyingObjectToObject( Path position )
        {
            return position.endNode();
        }
    };
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:12,代码来源:TraverserImpl.java

示例11: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的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;
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:13,代码来源:ChunkingEvaluator.java

示例12: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
  Node end = path.endNode();
  Rank r = Rank.values()[(int) end.getProperty(NeoProperties.RANK, Rank.UNRANKED.ordinal())];
  return r.isLinnean() ? Evaluation.INCLUDE_AND_CONTINUE : Evaluation.EXCLUDE_AND_CONTINUE;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:7,代码来源:LinneanRankEvaluator.java

示例13: evaluate

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
@Override
public Evaluation evaluate(Path path) {
  Node end = path.endNode();
  return end.hasLabel(Labels.SYNONYM) ? Evaluation.EXCLUDE_AND_CONTINUE : Evaluation.INCLUDE_AND_CONTINUE;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:6,代码来源:AcceptedOnlyEvaluator.java

示例14: endsWithNode

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
/**
 * Verifies that the actual {@link org.neo4j.graphdb.Path} ends with the given node<br/>
 * <p>
 * Example:
 * 
 * <pre>
 * GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
 * // [...]
 * Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName(&quot;LOVES&quot;));
 * // PathExpander bellyExpander = [...]
 * Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
 * 
 * assertThat(homerToDoughnutPath).endsWithNode(doughnutNode);
 * </pre>
 * 
 * If the <code>node</code> is {@code null}, an {@link IllegalArgumentException} is thrown.
 * <p>
 * 
 * @param node the expected end node of the actual {@link org.neo4j.graphdb.Path}
 * @return this {@link org.assertj.neo4j.api.PathAssert} for assertions chaining
 * 
 * @throws IllegalArgumentException if <code>node</code> is {@code null}.
 * @throws AssertionError if the actual {@link org.neo4j.graphdb.Path} does not end with the given node
 */
public PathAssert endsWithNode(Node node) {
  Objects.instance().assertNotNull(info, actual);

  Path actualPath = getActual();
  Node actualEnd = actualPath.endNode();
  checkNullEndNodes(actualEnd, node);

  if (!actualEnd.equals(node)) {
    throw Failures.instance().failure(info, shouldEndWithNode(actualPath, node));
  }
  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-neo4j,代码行数:37,代码来源:PathAssert.java

示例15: doesNotEndWithNode

import org.neo4j.graphdb.Path; //导入方法依赖的package包/类
/**
 * Verifies that the given node is not the last one of the actual {@link org.neo4j.graphdb.Path}<br/>
 * <p>
 * Example:
 *
 * <pre>
 * GraphDatabaseService graph = new TestGraphDatabaseFactory().newImpermanentDatabase();
 * // [...]
 * Relationship love = homerNode.createRelationshipTo(doughnutNode, DynamicRelationshipType.withName(&quot;LOVES&quot;));
 * // PathExpander bellyExpander = [...]
 * Path homerToDoughnutPath = GraphAlgoFactory.shortestPath(bellyExpander, 2).findSinglePath(homerNode, doughnutNode);
 *
 * assertThat(homerToDoughnutPath).doesNotEndWithNode(saladNode);
 * </pre>
 *
 * If the <code>node</code> is {@code null}, an {@link IllegalArgumentException} is thrown.
 * <p>
 *
 * @param node the expected last node of the actual {@link org.neo4j.graphdb.Path}
 * @return this {@link org.assertj.neo4j.api.PathAssert} for assertions chaining
 *
 * @throws IllegalArgumentException if <code>node</code> is {@code null}.
 * @throws AssertionError if the actual {@link org.neo4j.graphdb.Path} ends with this node
 */
public PathAssert doesNotEndWithNode(Node node) {
  Objects.instance().assertNotNull(info, actual);

  Path actualPath = getActual();
  Node actualEnd = actualPath.endNode();
  checkNullEndNodes(actualEnd, node);

  if (actualEnd.equals(node)) {
    throw Failures.instance().failure(info, shouldNotEndWithNode(actualPath, node));
  }
  return this;
}
 
开发者ID:joel-costigliola,项目名称:assertj-neo4j,代码行数:37,代码来源:PathAssert.java


注:本文中的org.neo4j.graphdb.Path.endNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。