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


Java Iterables.asList方法代码示例

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


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

示例1: testProParteSynonym

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
/**
 * Pro parte synonyms should exist as a single synonym node with multiple synonym relations
 */
@Test
public void testProParteSynonym() throws Exception {
  ClasspathSourceList src = ClasspathSourceList.source(15, 16);
  build(src);

  NubUsage u = assertCanonical("Poa pubescens", "Lej.", null, Rank.SPECIES, Origin.SOURCE, TaxonomicStatus.PROPARTE_SYNONYM, null);
  assertEquals(3, u.sourceIds.size());

  NameUsage nu = dao.readUsage(u.node, true);
  assertEquals("Poa pratensis L.", nu.getAccepted());

  List<Relationship> rels = Iterables.asList(u.node.getRelationships(RelType.PROPARTE_SYNONYM_OF, Direction.OUTGOING));
  Relationship acc = Iterables.single(u.node.getRelationships(RelType.SYNONYM_OF, Direction.OUTGOING));
  assertEquals(1, rels.size());
  assertNotEquals(rels.get(0).getEndNode(), acc.getEndNode());

  assertTree("15 16.txt");
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:22,代码来源:NubBuilderIT.java

示例2: removeNodeFromIndex

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
private void removeNodeFromIndex(Node node, String entityLabel) {
	List<Label> labels = Iterables.asList(node.getLabels());
	if(labels.contains(LABEL_ENTITY_TYPE_CLASS)) {
		graphdb.index().forNodes(ENTITY_TYPE_CLASS).remove(node);
	}
	if(labels.contains(LABEL_PROPERTY_ENTITY_TYPE)) {
		graphdb.index().forNodes(PROPERTY_ENTITY_TYPE).remove(node);
	}
	if(labels.contains(Label.label(entityLabel))) {
		graphdb.index().forNodes(entityLabel).remove(node);
	}
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:13,代码来源:Neo4jAOM.java

示例3: findEntityByIDAndEntityType

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
private Node findEntityByIDAndEntityType(Object id, IEntityType entityType) throws EsfingeAOMException {
	ResourceIterator<Node> findNodes = graphdb.findNodes(Label.label(entityType.getName()));
	for (Node entityTypeGraphNode : findNodes.stream().collect(Collectors.toList())) {
		Iterable<Relationship> typeObjectsRelationships = entityTypeGraphNode.getRelationships(RELATIONSHIP_ENTITY_TYPE_OBJECT);
		for (Relationship relationship : Iterables.asList(typeObjectsRelationships)) {
			Node entityGraphNode = relationship.getEndNode();
			if(entityGraphNode.getProperty(ID_FIELD_NAME).equals(id)){
				return entityGraphNode;
			}
		}
	}
	return null;
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:14,代码来源:Neo4jAOM.java

示例4: existsRelationshipForPropertyType

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
private boolean existsRelationshipForPropertyType(Node entityTypeGraphNode, String propertyTypeName) {
	List<Relationship> relationships = Iterables.asList(entityTypeGraphNode.getRelationships());
	for (Relationship relationship : relationships) {
		Node propertyTypeGraphNode = relationship.getEndNode();
		if(propertyTypeGraphNode.hasProperty(PROPERTY_TYPE_NAME) &&
		   propertyTypeGraphNode.getProperty(PROPERTY_TYPE_NAME).equals(propertyTypeName)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:12,代码来源:Neo4jAOM.java

示例5: parents

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
/**
 * @return the parent (or accepted) nodes for a given node.
 */
public List<Node> parents(Node n) {
  return Iterables.asList(Traversals.PARENTS
      .relationships(RelType.SYNONYM_OF, Direction.OUTGOING)
      .traverse(n)
      .nodes());
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:NubDb.java

示例6: testListSources

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
/**
 * Test reading the source list
 */
@Test
public void testListSources() throws Exception {
  List<NubSource> sources = Iterables.asList(src);
  assertEquals(3, sources.size());
  assertEquals(Rank.PHYLUM, sources.get(0).ignoreRanksAbove);
  assertEquals(Rank.FAMILY, sources.get(1).ignoreRanksAbove);
  assertEquals(Rank.FAMILY, sources.get(2).ignoreRanksAbove);
  assertEquals(CHECKLIST_KEY, sources.get(0).key);
  assertEquals(oldDKey, sources.get(1).key);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:14,代码来源:ClbSourceListTest.java

示例7: testListSources

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
@Test
public void testListSources() throws Exception {
  ClasspathSourceList src = ClasspathSourceList.source(1, 2, 3, 4, 5, 10, 11, 23, 12, 31);
  src.setSourceRank(23, Rank.KINGDOM);
  List<NubSource> sources = Iterables.asList(src);
  assertEquals(10, sources.size());
  assertEquals(Rank.FAMILY, sources.get(0).ignoreRanksAbove);
  assertEquals(Rank.KINGDOM, sources.get(7).ignoreRanksAbove);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:10,代码来源:ClasspathSourceListTest.java

示例8: testNeoIndices

import org.neo4j.helpers.collection.Iterables; //导入方法依赖的package包/类
@Test
public void testNeoIndices() throws Exception {
  final UUID datasetKey = datasetKey(1);

  Normalizer norm = Normalizer.create(cfg, datasetKey);
  norm.run();

  openDb(datasetKey);
  compareStats(norm.getStats());

  Set<String> taxonIndices = Sets.newHashSet();
  taxonIndices.add(NeoProperties.TAXON_ID);
  taxonIndices.add(NeoProperties.SCIENTIFIC_NAME);
  taxonIndices.add(NeoProperties.CANONICAL_NAME);
  try (Transaction tx = beginTx()) {
    Schema schema = dao.getNeo().schema();
    for (IndexDefinition idf : schema.getIndexes(Labels.TAXON)) {
      List<String> idxProps = Iterables.asList(idf.getPropertyKeys());
      assertTrue(idxProps.size() == 1);
      assertTrue(taxonIndices.remove(idxProps.get(0)));
    }

    assertNotNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.TAXON_ID, "1001")));
    assertNotNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.SCIENTIFIC_NAME, "Crepis bakeri Greene")));
    assertNotNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.CANONICAL_NAME, "Crepis bakeri")));

    assertNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.TAXON_ID, "x1001")));
    assertNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.SCIENTIFIC_NAME, "xCrepis bakeri Greene")));
    assertNull(Iterators.singleOrNull(dao.getNeo().findNodes(Labels.TAXON, NeoProperties.CANONICAL_NAME, "xCrepis bakeri")));
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:32,代码来源:NormalizerTest.java


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