Package org.jrdf.graph

Examples of org.jrdf.graph.GraphException


            createNewGraph(set);
            mapper.replaceObjectNode(node, newNode);
            set.clear();
            return newNode;
        } catch (GraphElementFactoryException e) {
            throw new GraphException("Cannot copy RDF graph with object node", e);
        }
    }
View Full Code Here


                if (!triple.isGrounded()) {
                    mapper.updateBlankNodes(triple);
                }
            }
        } catch (Exception e) {
            throw new GraphException("Cannot read RDF graph", e);
        } finally {
            if (triples instanceof ClosableIterator) {
                ((ClosableIterator<Triple>) triples).close();
            }
        }
View Full Code Here

    public void remove(T... node) throws GraphException {
        // find the sub index
        Map<T, Set<T>> subIndex = index.get(node[0]);
        // check that the subindex exists
        if (null == subIndex) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        // find the final group
        Set<T> group = subIndex.get(node[1]);
        // check that the group exists
        if (null == group) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        // remove from the group, report error if it didn't exist
        if (!group.remove(node[2])) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        // clean up the graph
        if (group.isEmpty()) {
            subIndex.remove(node[1]);
            if (subIndex.isEmpty()) {
View Full Code Here

            return triple;
        }
        // TODO Work out if this needs to be kept.
        addObjectNodeIfBlank(triple);
        if (!graph.contains(triple)) {
            throw new GraphException("Cannot find triple: " + triple);
        } else {
            findNextLevelOfNodes(new HashSet<BlankNode>(asList((BlankNode) triple.getSubject())));
            return currentTriple;
        }
    }
View Full Code Here

            if (AbstractBlankNode.isBlankNode(sub) && mapContainsBNode(rootTripleMap, sub)) {
                return rootTripleMap.get(sub);
            }

        }
        throw new GraphException("Cannot find the linking triple for parent : " + parentMolecule +
                "\nand submolecule" + molecule);
    }
View Full Code Here

                }
            }
        } finally {
            iterator.close();
        }
        throw new GraphException("Cannot add new triple to molecule");
    }
View Full Code Here

                }
            }
        } finally {
            iterator.close();
        }
        throw new GraphException("Cannot remove triple from molecule");
    }
View Full Code Here

            longIndexes[1].add(values[1], values[2], values[0]);
            longIndexes[2].add(values[2], values[0], values[1]);
        } catch (ExternalBlankNodeException e) {
            throw new ExternalBlankNodeException(MESSAGE, e);
        } catch (GraphException ge) {
            throw new GraphException(MESSAGE, ge);
        }
    }
View Full Code Here

    // TODO Cover the other graph exceptions in tests - currently only the first one is test driven.
    // Search for Unable to remove nonexistent statement.
    public void remove(Long... quin) throws GraphException {
        ClosableMap<Long, ClosableMap<Long, ClosableMap<Long, Set<Long>>>> mids = index.get(quin[0]);
        if (null == mids) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        ClosableMap<Long, ClosableMap<Long, Set<Long>>> subjectIndex = mids.get(quin[1]);
        if (null == subjectIndex) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        Map<Long, Set<Long>> predicateIndex = subjectIndex.get(quin[2]);
        if (null == predicateIndex) {
            throw new GraphException("Failed to remove nonexistent triple");
        }
        Set<Long> objectIndex = predicateIndex.get(quin[3]);
        if (null == objectIndex) {
            throw new GraphException("Unable to remove nonexistent statement");
        }
        if (!objectIndex.remove(quin[4])) {
            throw new GraphException("Unable to remove nonexistent statement");
        }
        if (objectIndex.isEmpty()) {
            predicateIndex.remove(quin[3]);
            if (predicateIndex.isEmpty()) {
                subjectIndex.remove(quin[2]);
View Full Code Here

                }
            }
        } finally {
            index.close();
        }
        throw new GraphException("Cannot find triple:  " + asList(triple));
    }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.GraphException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.