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


Java PropertyContainer类代码示例

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


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

示例1: doSomeRandomTestingWithFulltextIndex

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void doSomeRandomTestingWithFulltextIndex(
        Index<T> index,
        EntityCreator<T> creator )
{
    T entity1 = creator.create();
    T entity2 = creator.create();

    String key = "name";
    index.add( entity1, key, "The quick brown fox" );
    index.add( entity2, key, "brown fox jumped over" );

    for ( int i = 0; i < 2; i++ )
    {
        assertThat( index.get( key, "The quick brown fox" ), contains( entity1 ) );
        assertThat( index.get( key, "brown fox jumped over" ), contains( entity2 ) );
        assertThat( index.query( key, "quick" ), contains( entity1 ) );
        assertThat( index.query( key, "brown" ), contains( entity1, entity2 ) );
        assertThat( index.query( key, "quick OR jumped" ), contains( entity1, entity2 ) );
        assertThat( index.query( key, "brown AND fox" ), contains( entity1, entity2 ) );

        restartTx();
    }

    index.delete();
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:27,代码来源:TestLuceneIndex.java

示例2: sortedEntities

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
private List<PropertyContainer> sortedEntities( LinkedList<Pair<PropertyContainer, Long>> timestamps, final boolean reversed )
{
    List<Pair<PropertyContainer, Long>> sorted = new ArrayList<Pair<PropertyContainer,Long>>( timestamps );
    sort( sorted, new Comparator<Pair<PropertyContainer, Long>>()
    {
        @Override
        public int compare( Pair<PropertyContainer, Long> o1, Pair<PropertyContainer, Long> o2 )
        {
            return !reversed ? o1.other().compareTo( o2.other() ) : o2.other().compareTo( o1.other() );
        }
    } );

    List<PropertyContainer> result = new ArrayList<PropertyContainer>();
    for ( Pair<PropertyContainer, Long> timestamp : sorted )
    {
        result.add( timestamp.first() );
    }
    return result;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:20,代码来源:TestTimeline.java

示例3: makeSureUncommittedChangesAreSortedCorrectly

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
private void makeSureUncommittedChangesAreSortedCorrectly( EntityCreator<PropertyContainer> creator,
        TimelineIndex<PropertyContainer> timeline ) throws Exception
{
    LinkedList<Pair<PropertyContainer, Long>> timestamps = createTimestamps( creator, timeline,
            300000, 100000, 500000, 900000, 800000 );

    try( Transaction tx = db.beginTx() )
    {
        timestamps.addAll( createTimestamps( creator, timeline, 40000, 70000, 20000 ) );
        assertEquals( sortedEntities( timestamps, false ),
                asCollection( timeline.getBetween( null, null ).iterator() ) );
        tx.success();
    }

    try( Transaction ignore = db.beginTx() )
    {
        assertEquals( sortedEntities( timestamps, false ),
                asCollection( timeline.getBetween( null, null ).iterator() ) );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:21,代码来源:TestTimeline.java

示例4: copyProperties

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
void copyProperties(PropertyContainer container, Element element) {
  for (String key : container.getPropertyKeys()) {
    Object property = container.getProperty(key);
    if (property.getClass().isArray()) {
      List<Object> propertyList = new ArrayList<>();
      for (int i = 0; i < Array.getLength(property); i++) {
        propertyList.add(Array.get(property, i));
      }
      property = propertyList;
    }
    else if (key.equals(CommonProperties.IRI) && String.class.isAssignableFrom(property.getClass())) {
      property = curieUtil.getCurie((String)property).orElse((String)property);
    }
    element.setProperty(key, property);
  }
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:17,代码来源:TinkerGraphUtil.java

示例5: dump

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
public static String dump(Path data) {
    StringBuilder builder = new StringBuilder();
    builder.append("!Path ");
    Node node = null;
    char link = '[';
    for (PropertyContainer entity : data) {
        builder.append(link);
        if (entity instanceof Node) {
            node = (Node) entity;
            builder.append(dump(node));
        } else if (entity instanceof Relationship) {
            Relationship rel = (Relationship) entity;
            if (node != null) {
                long nodeID = node.getId();
                if (rel.getStartNode().getId() != nodeID && rel.getEndNode().getId() == nodeID) {
                    builder.append(dumpRev(rel));
                } else {
                    builder.append(dumpRel(rel));
                }
            }
        }
        link = ',';
    }
    builder.append(']');
    return builder.toString();
}
 
开发者ID:technige,项目名称:zerograph,代码行数:27,代码来源:YAML.java

示例6: getSampleProperties

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
public List<NeoProperty> getSampleProperties(NeoProfiler parent, PropertyContainer n) {
	List<NeoProperty> props = new ArrayList<NeoProperty>();
	
	try ( Transaction tx = parent.getDB().beginTx() ) {			 
		Iterator<String> propKeys = n.getPropertyKeys().iterator();
		
		while(propKeys.hasNext()) {
			String key = propKeys.next();
			Object val = n.getProperty(key);
			
			props.add(new NeoProperty(key, val.getClass().getSimpleName()));				
		}
		
	} // End try
	
	return props;
}
 
开发者ID:moxious,项目名称:neoprofiler,代码行数:18,代码来源:QueryRunner.java

示例7: handle

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
public PropertyContainer handle(Transaction tx, Request request) throws ClientError, ServerError {
    switch (request.getMethod()) {
        case "GET":
            return get(tx, request);
        case "PUT":
            return put(tx, request);
        case "PATCH":
            return patch(tx, request);
        case "POST":
            return post(tx, request);
        case "DELETE":
            return delete(tx, request);
        default:
            throw new ClientError(new Response(Response.METHOD_NOT_ALLOWED, request.getMethod()));
    }
}
 
开发者ID:TinderBackend,项目名称:neo4j-zmq-extension,代码行数:17,代码来源:Resource.java

示例8: buildStepExpander

import org.neo4j.graphdb.PropertyContainer; //导入依赖的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

示例9: pathString

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
public static String pathString(Path path) {
    StringBuilder sb = new StringBuilder();
    Node lastNode = null;
    for (PropertyContainer thing : path) {
        if (thing instanceof Node) {
            lastNode = (Node) thing;
            sb.append("(").append(
                    Sets.newHashSet(lastNode.getLabels()).toString().replace("[", "").replace("]", "")).append(
                    ")");
        }
        if (thing instanceof Relationship) {
            Relationship relationship = (Relationship) thing;
            if (relationship.getStartNode().equals(lastNode)) {
                sb.append("-[").append(relationship.getType().name()).append("]->");
            } else {
                sb.append("<-[").append(relationship.getType().name()).append("]-");
            }
        }
    }
    return sb.toString();
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:22,代码来源:StepsUtils.java

示例10: getFilterPredicates

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
@Override
public List<PropertyContainerPredicate> getFilterPredicates()
{
    List<PropertyContainerPredicate> propertyContainerPredicates = new ArrayList<PropertyContainerPredicate>();
    List<PropertyContainerPredicate> nodePredicates = new ArrayList<PropertyContainerPredicate>();
    if ( false == labels.isEmpty() )
    {
        final Label[] hasLabelsArray = labels.toArray( new Label[labels.size()] );
        nodePredicates.add( new PropertyContainerPredicate()
        {
            @Override
            public boolean apply( PropertyContainer node )
            {
                for ( int i = 0; i < hasLabelsArray.length; i++ )
                {
                    if ( ( (Node) node ).hasLabel( hasLabelsArray[i] ) ) return true;
                }
                return false;
            }

        } );
    }
    propertyContainerPredicates.addAll( nodePredicates );
    propertyContainerPredicates.addAll( propertyFilters.getFilterPredicates() );
    return propertyContainerPredicates;
}
 
开发者ID:alexaverbuch,项目名称:steps,代码行数:27,代码来源:NodeFilterDescriptor.java

示例11: checkProperties

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
private boolean checkProperties(
        AbstractPatternObject<? extends PropertyContainer> patternObject,
        PropertyContainer object )
{
    PropertyContainer associatedObject = patternObject.getAssociation();
    if ( associatedObject != null && !object.equals( associatedObject ) )
    {
        return false;
    }

    for ( Map.Entry<String, Collection<ValueMatcher>> matchers :
            patternObject.getPropertyConstraints() )
    {
        String key = matchers.getKey();
        Object propertyValue = object.getProperty( key, null );
        for (ValueMatcher matcher : matchers.getValue() )
        {
            if ( !matcher.matches( propertyValue ) )
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:27,代码来源:PatternFinder.java

示例12: constructSinglePathToNodeAsNodes

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
/**
 * Constructs a path to a given node, for a given set of predecessors
 * @param node
 *            The start node
 * @param predecessors
 *            The predecessors set
 * @param includeNode
 *            Boolean which determines if the start node should be included
 *            in the paths
 * @param backwards
 *            Boolean, if true the order of the nodes in the paths will be
 *            reversed
 * @return A path as a list of nodes.
 */
public static List<Node> constructSinglePathToNodeAsNodes( Node node,
    Map<Node,List<Relationship>> predecessors, boolean includeNode,
    boolean backwards )
{
    List<PropertyContainer> singlePathToNode = constructSinglePathToNode(
        node, predecessors, includeNode, backwards );
    Iterator<PropertyContainer> iterator = singlePathToNode.iterator();
    // When going backwards and not including the node the first element is
    // a relationship. Thus skip it.
    if ( backwards && !includeNode && iterator.hasNext() )
    {
        iterator.next();
    }
    LinkedList<Node> path = new LinkedList<Node>();
    while ( iterator.hasNext() )
    {
        path.addLast( (Node) iterator.next() );
        if ( iterator.hasNext() )
        {
            iterator.next();
        }
    }
    return path;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:39,代码来源:Util.java

示例13: constructSinglePathToNodeAsRelationships

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
/**
 * Constructs a path to a given node, for a given set of predecessors
 * @param node
 *            The start node
 * @param predecessors
 *            The predecessors set
 * @param backwards
 *            Boolean, if true the order of the nodes in the paths will be
 *            reversed
 * @return A path as a list of relationships.
 */
public static List<Relationship> constructSinglePathToNodeAsRelationships(
    Node node, Map<Node,List<Relationship>> predecessors, boolean backwards )
{
    List<PropertyContainer> singlePathToNode = constructSinglePathToNode(
        node, predecessors, true, backwards );
    Iterator<PropertyContainer> iterator = singlePathToNode.iterator();
    // Skip the first, it is a node
    if ( iterator.hasNext() )
    {
        iterator.next();
    }
    LinkedList<Relationship> path = new LinkedList<Relationship>();
    while ( iterator.hasNext() )
    {
        path.addLast( (Relationship) iterator.next() );
        if ( iterator.hasNext() )
        {
            iterator.next();
        }
    }
    return path;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:34,代码来源:Util.java

示例14: getPath

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
/**
 * @return One of the shortest paths found or null.
 */
public List<PropertyContainer> getPath()
{
    if ( startNode == null || endNode == null )
    {
        throw new RuntimeException( "Start or end node undefined." );
    }
    calculate();
    if ( foundPathsMiddleNodes == null || foundPathsMiddleNodes.size() == 0 )
    {
        return null;
    }
    Node middleNode = foundPathsMiddleNodes.iterator().next();
    LinkedList<PropertyContainer> path = new LinkedList<PropertyContainer>();
    path.addAll( Util.constructSinglePathToNode( middleNode, predecessors1,
            true, false ) );
    path.addAll( Util.constructSinglePathToNode( middleNode, predecessors2,
            false, true ) );
    return path;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:23,代码来源:Dijkstra.java

示例15: deleteIndex

import org.neo4j.graphdb.PropertyContainer; //导入依赖的package包/类
void deleteIndex( IndexIdentifier identifier, boolean recovery )
{
    closeWriter( identifier );
    deleteFileOrDirectory( getFileDirectory( baseStorePath, identifier ) );
    invalidateCache( identifier );
    boolean removeFromIndexStore = !recovery || (recovery &&
            indexStore.has( identifier.entityType.getType(), identifier.indexName ));
    if ( removeFromIndexStore )
    {
        indexStore.remove( identifier.entityType.getType(), identifier.indexName );
    }
    typeCache.invalidate( identifier );
    synchronized ( indexes )
    {
        LuceneIndex<? extends PropertyContainer> index = indexes.remove( identifier );
        if ( index != null )
        {
            index.markAsDeleted();
        }
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:22,代码来源:LuceneDataSource.java


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