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


Java EntityNotFoundException类代码示例

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


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

示例1: processEntry

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
private void processEntry(Work work, ReadOperations ops) throws EntityNotFoundException, InterruptedException, IOException {
    relationshipIterator = ops.nodeGetRelationships(work.getNodeId(), org.neo4j.graphdb.Direction.BOTH);

    while (relationshipIterator.hasNext()) {
        c = ops.relationshipCursor(relationshipIterator.next());
        if (c.next()
                && (boolean) c.get().getProperty( Energization.propertyIncomingSwitchOn)
                && (boolean) c.get().getProperty( Energization.propertyOutgoingSwitchOn)) {
            long otherNodeId = c.get().otherNode(work.getNodeId());
            if (!energized2.contains((int) otherNodeId)) {
                double newVoltage = (double) ops.nodeGetProperty(otherNodeId,  Energization.propertyVoltage);
                if (newVoltage <= (double) work.getVoltage()) {
                    if(energized2.checkedAdd((int) otherNodeId)) {
                        results.add((String) ops.nodeGetProperty(otherNodeId, Energization.propertyEquipmentId));
                        processQueue.put(new Work(otherNodeId, newVoltage));
                    }
                }
            }
        }
    }
}
 
开发者ID:maxdemarzi,项目名称:power_grid,代码行数:22,代码来源:Worker.java

示例2: compute

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@Override
public void compute(String label, String type, int iterations) {
    degree = new int[nodeCount];
    Arrays.fill(degree, -1);

    try ( Transaction tx = db.beginTx()) {
        ThreadToStatementContextBridge ctx = this.db.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
        ReadOperations ops = ctx.get().readOperations();
        int labelId = ops.labelGetForName(label);
        int relationshipTypeId = ops.relationshipTypeGetForName(type);

        PrimitiveLongIterator it = ops.nodesGetForLabel(labelId);
        int totalCount = nodeCount;
        runOperations(pool, it, totalCount, ops, new OpsRunner() {
            public void run(int id) throws EntityNotFoundException {
                degree[id] = ops.nodeGetDegree(id, direction, relationshipTypeId);
            }
        });

        tx.success();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:maxdemarzi,项目名称:graph_processing,代码行数:25,代码来源:DegreeArrayStorageParallelSPI.java

示例3: compute

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@Override
public void compute(int iterations) {

    final int[] src = new int[nodeCount];
    dst = new AtomicIntegerArray(nodeCount);

    try ( Transaction tx = db.beginTx()) {

        ThreadToStatementContextBridge ctx = this.db.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
        final ReadOperations ops = ctx.get().readOperations();

        int[] degrees = computeDegrees(ops);

        final RelationshipVisitor<RuntimeException> visitor = new RelationshipVisitor<RuntimeException>() {
            public void visit(long relId, int relTypeId, long startNode, long endNode) throws RuntimeException {
                dst.addAndGet(((int) endNode), src[(int) startNode]);
            }
       };

        for (int iteration = 0; iteration < iterations; iteration++) {
            startIteration(src, dst, degrees);

            PrimitiveLongIterator rels = ops.relationshipsGetAll();
            runOperations(pool, rels, relCount , ops, new OpsRunner() {
                public void run(int id) throws EntityNotFoundException {
                    ops.relationshipVisit(id, visitor);
                }
            });
        }
        tx.success();
    } catch (EntityNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:maxdemarzi,项目名称:pagerank_spi,代码行数:35,代码来源:PageRankArrayStorageParallelSPI.java

示例4: computeDegrees

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
private int[] computeDegrees(final ReadOperations ops) throws EntityNotFoundException {
    final int[] degree = new int[nodeCount];
    Arrays.fill(degree, -1);
    PrimitiveLongIterator it = ops.nodesGetAll();
    int totalCount = nodeCount;
    runOperations(pool, it, totalCount, ops, new OpsRunner() {
        public void run(int id) throws EntityNotFoundException {
            degree[id] = ops.nodeGetDegree(id, Direction.OUTGOING);
        }
    });
    return degree;
}
 
开发者ID:maxdemarzi,项目名称:pagerank_spi,代码行数:13,代码来源:PageRankArrayStorageParallelSPI.java

示例5: run

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
public void run() {
    int notFound = 0;
    for (int i=0;i<offset;i++) {
        try {
            run((int) ids[i]);
        } catch (EntityNotFoundException e) {
            notFound++;
        }
    }
    if (notFound > 0 ) System.err.println("Entities not found "+notFound);
}
 
开发者ID:maxdemarzi,项目名称:pagerank_spi,代码行数:12,代码来源:BatchRunnable.java

示例6: compute

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@Override
public void compute(String label, String type, int iterations) {

    int[] src = new int[nodeCount];
    dst = new AtomicIntegerArray(nodeCount);

    try ( Transaction tx = db.beginTx()) {

        ThreadToStatementContextBridge ctx = this.db.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
        ReadOperations ops = ctx.get().readOperations();
        int labelId = ops.labelGetForName(label);
        int typeId = ops.relationshipTypeGetForName(type);

        int[] degrees = computeDegrees(ops,labelId, typeId);

        RelationshipVisitor<RuntimeException> visitor = new RelationshipVisitor<RuntimeException>() {
            public void visit(long relId, int relTypeId, long startNode, long endNode) throws RuntimeException {
                if (relTypeId == typeId) {
                    dst.addAndGet(((int) endNode),src[(int) startNode]);
                }
            }
        };

        for (int iteration = 0; iteration < iterations; iteration++) {
            startIteration(src, dst, degrees);

            PrimitiveLongIterator rels = ops.relationshipsGetAll();
            runOperations(pool, rels, relCount , ops, new OpsRunner() {
                public void run(int id) throws EntityNotFoundException {
                    ops.relationshipVisit(id, visitor);
                }
            });
        }
        tx.success();
    } catch (EntityNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:maxdemarzi,项目名称:graph_processing,代码行数:39,代码来源:PageRankArrayStorageParallelSPI.java

示例7: computeDegrees

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
private int[] computeDegrees(ReadOperations ops, int labelId, int relationshipId) throws EntityNotFoundException {
    int[] degree = new int[nodeCount];
    Arrays.fill(degree,-1);
    PrimitiveLongIterator it = ops.nodesGetForLabel(labelId);
    int totalCount = nodeCount;
    runOperations(pool, it, totalCount, ops, new OpsRunner() {
        public void run(int id) throws EntityNotFoundException {
            degree[id] = ops.nodeGetDegree(id, Direction.OUTGOING, relationshipId);
        }
    });
    return degree;
}
 
开发者ID:maxdemarzi,项目名称:graph_processing,代码行数:13,代码来源:PageRankArrayStorageParallelSPI.java

示例8: compute

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@Override
public void compute(String label, String type, int iterations) {

    float[] src = new float[nodes];
    dst = new float[nodes];

    try ( Transaction tx = db.beginTx()) {

        ThreadToStatementContextBridge ctx = this.db.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
        ReadOperations ops = ctx.get().readOperations();
        int labelId = ops.labelGetForName(label);
        int typeId = ops.relationshipTypeGetForName(type);

        int[] degrees = computeDegrees(ops,labelId, typeId);

        RelationshipVisitor<RuntimeException> visitor = new RelationshipVisitor<RuntimeException>() {
            public void visit(long relId, int relTypeId, long startNode, long endNode) throws RuntimeException {
                if (relTypeId == typeId) {
                    dst[((int) endNode)] += src[(int) startNode];
                }
            }
        };

        for (int iteration = 0; iteration < iterations; iteration++) {
            startIteration(src, dst, degrees);

            PrimitiveLongIterator rels = ops.relationshipsGetAll();
            while (rels.hasNext()) {
                ops.relationshipVisit(rels.next(), visitor);
            }
        }
        tx.success();
    } catch (EntityNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:maxdemarzi,项目名称:graph_processing,代码行数:37,代码来源:PageRankArrayStorageSPI.java

示例9: energizationSPI

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@POST
@Path("/spi")
public Response energizationSPI(String body, @Context GraphDatabaseService db) throws IndexNotFoundKernelException, IOException, SchemaRuleNotFoundException, IndexBrokenKernelException, EntityNotFoundException {
    HashMap input = Validators.getValidEquipmentIds(body);
    HashSet<String> results = new HashSet<>();

    try (Transaction tx = db.beginTx()) {
        ThreadToStatementContextBridge ctx = dbapi.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
        ReadOperations ops = ctx.get().readOperations();
        IndexDescriptor descriptor = ops.indexGetForLabelAndPropertyKey(equipmentLabelId, propertyEquipmentId);

        HashMap<Long, Double> equipmentMap = new HashMap<>();
        for (String equipmentId : (Collection<String>) input.get("ids")) {
            Cursor<NodeItem> nodes = ops.nodeCursorGetFromUniqueIndexSeek(descriptor, equipmentId);
            if (nodes.next()) {
                long equipmentNodeId = nodes.get().id();
                energized.add((int) equipmentNodeId);
                results.add(equipmentId);
                equipmentMap.put(equipmentNodeId, (double) ops.nodeGetProperty(equipmentNodeId, propertyVoltage));

                while (!equipmentMap.isEmpty()) {
                    Map.Entry<Long, Double> entry = equipmentMap.entrySet().iterator().next();
                    equipmentMap.remove(entry.getKey());
                    RelationshipIterator relationshipIterator = ops.nodeGetRelationships(entry.getKey(), org.neo4j.graphdb.Direction.BOTH);
                    Cursor<RelationshipItem> c;

                    while (relationshipIterator.hasNext()) {
                        c = ops.relationshipCursor(relationshipIterator.next());
                        if (c.next() && (boolean) c.get().getProperty(propertyIncomingSwitchOn) && (boolean) c.get().getProperty(propertyOutgoingSwitchOn)) {
                            long otherNodeId = c.get().otherNode(entry.getKey());
                            if (!energized.contains((int) otherNodeId)) {
                                double newVoltage = (double) ops.nodeGetProperty(otherNodeId, propertyVoltage);
                                if (newVoltage <= entry.getValue()) {
                                    results.add( (String)ops.nodeGetProperty(otherNodeId, propertyEquipmentId));
                                    energized.add((int) otherNodeId);
                                    equipmentMap.put(otherNodeId, newVoltage);
                                }
                            }
                        }
                    }
                }
            } else {
                System.out.println("none found");
            }
            nodes.close();
        }
        tx.success();
    }

    return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
 
开发者ID:maxdemarzi,项目名称:power_grid,代码行数:52,代码来源:Energization.java

示例10: energizationStreaming

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
@POST
@Path("/streaming")
public Response energizationStreaming(String body, @Context GraphDatabaseService db) throws IndexNotFoundKernelException, IOException, SchemaRuleNotFoundException, IndexBrokenKernelException, EntityNotFoundException {
    HashMap input = Validators.getValidEquipmentIds(body);
    StreamingOutput stream = os -> {
        JsonGenerator jg = objectMapper.getJsonFactory().createJsonGenerator(os, JsonEncoding.UTF8);
        jg.writeStartArray();

        try (Transaction tx = db.beginTx()) {
            ThreadToStatementContextBridge ctx = dbapi.getDependencyResolver().resolveDependency(ThreadToStatementContextBridge.class);
            ReadOperations ops = ctx.get().readOperations();
            IndexDescriptor descriptor = ops.indexGetForLabelAndPropertyKey(equipmentLabelId, propertyEquipmentId);

            HashMap<Long, Double> equipmentMap = new HashMap<>();
            for (String equipmentId : (Collection<String>) input.get("ids")) {
                Cursor<NodeItem> nodes = ops.nodeCursorGetFromUniqueIndexSeek(descriptor, equipmentId);
                if (nodes.next()) {
                    long equipmentNodeId = nodes.get().id();
                    energized.add((int) equipmentNodeId);
                    jg.writeString(equipmentId);
                    equipmentMap.put(equipmentNodeId, (double) ops.nodeGetProperty(equipmentNodeId, propertyVoltage));

                    while (!equipmentMap.isEmpty()) {
                        Map.Entry<Long, Double> entry = equipmentMap.entrySet().iterator().next();
                        equipmentMap.remove(entry.getKey());
                        RelationshipIterator relationshipIterator = ops.nodeGetRelationships(entry.getKey(), org.neo4j.graphdb.Direction.BOTH);
                        Cursor<RelationshipItem> c;

                        while (relationshipIterator.hasNext()) {
                            c = ops.relationshipCursor(relationshipIterator.next());
                            if (c.next() && (boolean) c.get().getProperty(propertyIncomingSwitchOn) && (boolean) c.get().getProperty(propertyOutgoingSwitchOn)) {
                                long otherNodeId = c.get().otherNode(entry.getKey());
                                if (!energized.contains((int) otherNodeId)) {
                                    double newVoltage = (double) ops.nodeGetProperty(otherNodeId, propertyVoltage);
                                    if (newVoltage <= entry.getValue()) {
                                        jg.writeString((String) ops.nodeGetProperty(otherNodeId, propertyEquipmentId));
                                        energized.add((int) otherNodeId);
                                        equipmentMap.put(otherNodeId, newVoltage);
                                    }
                                }
                            }
                        }
                    }
                }
                nodes.close();
            }
            tx.success();
        } catch (Exception e) {
            e.printStackTrace();
        }

        jg.writeEndArray();
        jg.flush();
        jg.close();
    };
    return Response.ok().entity(stream).type(MediaType.APPLICATION_JSON).build();
}
 
开发者ID:maxdemarzi,项目名称:power_grid,代码行数:58,代码来源:Energization.java

示例11: run

import org.neo4j.kernel.api.exceptions.EntityNotFoundException; //导入依赖的package包/类
void run(int node) throws EntityNotFoundException; 
开发者ID:maxdemarzi,项目名称:pagerank_spi,代码行数:2,代码来源:OpsRunner.java


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