當前位置: 首頁>>代碼示例>>Java>>正文


Java Direction.OUTGOING屬性代碼示例

本文整理匯總了Java中org.neo4j.graphdb.Direction.OUTGOING屬性的典型用法代碼示例。如果您正苦於以下問題:Java Direction.OUTGOING屬性的具體用法?Java Direction.OUTGOING怎麽用?Java Direction.OUTGOING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.neo4j.graphdb.Direction的用法示例。


在下文中一共展示了Direction.OUTGOING屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resolveRelationships

private Set<DirectedRelationshipType> resolveRelationships(String key, String value) {
  Set<DirectedRelationshipType> rels = new HashSet<>();
  String cypherIn = String.format("[%s:%s]", key, value);
  String cypherOut = cypherUtil.resolveRelationships(cypherIn);
  Matcher m = ENTAILMENT_PATTERN.matcher(cypherOut);
  while (m.find()) {
    String types = m.group(2);
    String[] cypherRels = types.split("\\|");
    for (String cypherRel : cypherRels) {
      String unquotedCypherRel = cypherRel.replaceAll("^`|`$","");
      RelationshipType relType = RelationshipType.withName(unquotedCypherRel);
      DirectedRelationshipType dirRelType = new DirectedRelationshipType(relType, Direction.OUTGOING);
      rels.add(dirRelType);
    }
  }
  return rels;
}
 
開發者ID:SciGraph,項目名稱:golr-loader,代碼行數:17,代碼來源:GolrLoader.java

示例2: closures_areReturned

@Test
public void closures_areReturned() {
  DirectedRelationshipType type = new DirectedRelationshipType(OwlRelationships.RDFS_SUBCLASS_OF, Direction.OUTGOING);
  Set<DirectedRelationshipType> types = newHashSet(type);
  Closure closure = closureUtil.getClosure(c, types);
  assertThat(closure.getCurie(), is("X:c"));
  assertThat(closure.getLabel(), is("C"));
  assertThat(closure.getCuries(), contains("X:c", "X:b", "X:a"));
  assertThat(closure.getLabels(), contains("C", "X:b", "A"));
  closure = closureUtil.getClosure(b, types);
  assertThat(closure.getCurie(), is("X:b"));
  assertThat(closure.getLabel(), is("X:b"));
  assertThat(closure.getCuries(), contains("X:b", "X:a"));
  assertThat(closure.getLabels(), contains("X:b", "A"));
  closure = closureUtil.getClosure(a, types);
  assertThat(closure.getCurie(), is("X:a"));
  assertThat(closure.getLabel(), is("A"));
  assertThat(closure.getCuries(), contains("X:a"));
  assertThat(closure.getLabels(), contains("A"));
}
 
開發者ID:SciGraph,項目名稱:golr-loader,代碼行數:20,代碼來源:ClosureTest.java

示例3: getDirectionFrom

/**
    * Get the direction in which relationships are discovered using this
    * relationship pattern from the specified node. May be
    * {@link Direction#OUTGOING outgoing}, {@link Direction#INCOMING incoming},
    * or {@link Direction#BOTH both}.
    *
    * @param fromNode the pattern node to find the direction of this pattern
    *            relationship from.
    * @return the direction to discover relationships matching this pattern in.
    */
public Direction getDirectionFrom( PatternNode fromNode )
   {
       if ( !directed )
       {
           return Direction.BOTH;
       }
    if ( fromNode.equals( firstNode ) )
    {
    	return Direction.OUTGOING;
    }
    if ( fromNode.equals( secondNode ) )
    {
    	return Direction.INCOMING;
    }
    throw new RuntimeException( fromNode + " not in " + this );
   }
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:26,代碼來源:PatternRelationship.java

示例4: getDirection

/**
 * @return The direction to use when searching for relations/edges
 */
protected Direction getDirection()
{
    if ( backwards )
    {
        if ( relationDirection.equals( Direction.INCOMING ) )
        {
            return Direction.OUTGOING;
        }
        if ( relationDirection.equals( Direction.OUTGOING ) )
        {
            return Direction.INCOMING;
        }
    }
    return relationDirection;
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:18,代碼來源:Dijkstra.java

示例5: multipleRelationships_areFollowed

@Test
public void multipleRelationships_areFollowed() {
  DirectedRelationshipType type1 = new DirectedRelationshipType(OwlRelationships.RDFS_SUBCLASS_OF, Direction.OUTGOING);
  DirectedRelationshipType type2 = new DirectedRelationshipType(OwlRelationships.RDF_TYPE, Direction.OUTGOING);
  Set<DirectedRelationshipType> types = newHashSet(type1, type2);
  Closure closure = closureUtil.getClosure(d, types);
  assertThat(closure.getCurie(), is("X:d"));
  assertThat(closure.getCurie(), is("X:d"));
  assertThat(closure.getCuries(), contains("X:d", "X:c", "X:b", "X:a"));
  assertThat(closure.getLabels(), contains("X:d", "C", "X:b", "A"));
}
 
開發者ID:SciGraph,項目名稱:golr-loader,代碼行數:11,代碼來源:ClosureTest.java

示例6: isConnected

public static boolean isConnected(final Node source, final Node target, final RelationshipType relationshipType) {
	final int sourceDegree = source.getDegree(relationshipType, Direction.OUTGOING);
	final int targetDegree = target.getDegree(relationshipType, Direction.INCOMING);
	
	final Direction searchDirection;
	final Node searchSource;
	final Node searchTarget;
	if (sourceDegree <= targetDegree) {
		searchDirection = Direction.OUTGOING;
		searchSource = source;
		searchTarget = target;
	} else {
		searchDirection = Direction.INCOMING;
		searchSource = target;
		searchTarget = source;
	}
	
	final Iterator<Relationship> edges = searchSource.getRelationships(searchDirection, relationshipType).iterator();
	while (edges.hasNext()) {
		final Relationship edge = edges.next();
		final Node otherNode = edge.getOtherNode(searchSource);
		if (searchTarget.equals(otherNode)) {
			return true;
		}
	}

	return false;
}
 
開發者ID:FTSRG,項目名稱:trainbenchmark,代碼行數:28,代碼來源:Neo4jUtil.java

示例7: shouldCalculateOutDegreeCentralityArrayStorageSPI

@Test
public void shouldCalculateOutDegreeCentralityArrayStorageSPI() throws IOException {
    DegreeArrayStorageParallelSPI outDegree = new DegreeArrayStorageParallelSPI(db, pool, Direction.OUTGOING);
    outDegree.compute("Person", "ACTED_IN", 1);
    long id = (long) getPersonEntry("Tom Hanks", db).get("id");
    assertTrue("outDegree Centrality calculted incorrectly", 12 == outDegree.getResult(id));
}
 
開發者ID:maxdemarzi,項目名稱:graph_processing,代碼行數:7,代碼來源:DegreeCentralityTest.java

示例8: getNextElement

private void getNextElement()
{
    while ( nextElement == null && relItr.hasNext() )
    {
        Relationship possibleRel =
            graphDbService.getRelationshipById( relItr.next() );
        if ( dir == Direction.OUTGOING &&
            possibleRel.getEndNode().getId() == nodeId )
        {
            continue;
        }
        if ( dir == Direction.INCOMING &&
            possibleRel.getStartNode().getId() == nodeId )
        {
            continue;
        }
        if ( types != null )
        {
            for ( RelationshipType type : types )
            {
                if ( type.name().equals(
                    possibleRel.getType().name() ) )
                {
                    nextElement = possibleRel;
                    break;
                }
            }
        }
        else
        {
            nextElement = possibleRel;
        }
    }
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:34,代碼來源:BatchGraphDatabaseImpl.java

示例9: hasNext

public boolean hasNext()
{
    if ( nextElement != null )
    {
        return true;
    }
    do
    {
        // if ( nextPosition < relIds.length )
        if ( relIds.hasNext() )
        {
            int nextId = relIds.next();
            try
            {
                Relationship possibleElement = nodeManager
                    .getRelationshipById( nextId );
                if ( direction == Direction.INCOMING
                    && possibleElement.getEndNode().equals( fromNode ) )
                {
                    nextElement = possibleElement;
                }
                else if ( direction == Direction.OUTGOING
                    && possibleElement.getStartNode().equals( fromNode ) )
                {
                    nextElement = possibleElement;
                }
                else if ( direction == Direction.BOTH )
                {
                    nextElement = possibleElement;
                }
            }
            catch ( Throwable t )
            {
                log.log( Level.FINE,
                    "Unable to get relationship " + nextId, t );
            }
        }
    }
    while ( nextElement == null && relIds.hasNext() );
    return nextElement != null;
}
 
開發者ID:neo4j-contrib,項目名稱:neo4j-mobile-android,代碼行數:41,代碼來源:RelationshipArrayIntSetIterator.java


注:本文中的org.neo4j.graphdb.Direction.OUTGOING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。