Package org.jrdf.graph

Examples of org.jrdf.graph.GraphException


    public void add(Long... node) throws GraphException {
        try {
            btree.insert(toBytes(node));
        } catch (IOException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here


    public void remove(Long... node) throws GraphException {
        try {
            boolean changed = RecordIteratorHelper.remove(btree, node);
            if (!changed) {
                throw new GraphException("Failed to remove nonexistent triple");
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    public Long localize(Node node) throws GraphException {
        if (ANY_SUBJECT_NODE != node && ANY_PREDICATE_NODE != node && ANY_OBJECT_NODE != node) {
            if (node instanceof LocalizedNode) {
                return getId(node);
            }
            throw new GraphException("Node id was not found in the graph: " + node);
        } else {
            return null;
        }
    }
View Full Code Here

            currentId = ((LocalizedNode) createLocalLiteral(escapedForm)).getId();
        }
    }

    public void visitNode(Node node) {
        exception = new GraphException("Unknown node type: " + node + " class: " + node.getClass());
    }
View Full Code Here

        currentId = null;
        node.accept(this);
        if (exception != null) {
            throw exception;
        } else if (currentId == null) {
            throw new GraphException("Node id was not found in the graph: " + node);
        } else {
            return currentId;
        }
    }
View Full Code Here

                    removeTriple(subIndex, group, node[0]);
                    return;
                }
            }
        }
        throw new GraphException("Failed to remove nonexistent triple");
    }
View Full Code Here

        readAndUpdateTripleIterator(triples);
        triples = newSourceGraph.find(ANY_SUBJECT_NODE, ANY_PREDICATE_NODE, ANY_OBJECT_NODE).iterator();
        try {
            mapper.createNewTriples(triples);
        } catch (Exception e) {
            throw new GraphException("Cannot create new triples.", e);
        } finally {
            triples.close();
        }
        return mapper.getGraph();
    }
View Full Code Here

        try {
            Set<Triple> set = tripleUtil.getAllTriplesForNode(node, newSourceGraph);
            createNewGraph(set);
            return newNode;
        } catch (Exception e) {
            throw new GraphException("Cannot copy RDF graph with node", e);
        }
    }
View Full Code Here

            if (mapper == null) {
                mapper = new GraphToGraphMapperImpl(newTargetGraph, mapFactory, setFactory);
            }
            mapper.replaceNode(oldNode, newNode);
        } catch (GraphException e) {
            throw new GraphException("Cannot replace old node: " + oldNode.toString(), e);
        }
    }
View Full Code Here

            createNewGraph(set);
            set.clear();
            mapper.replaceSubjectNode(node, newNode);
            return newNode;
        } catch (GraphElementFactoryException e) {
            throw new GraphException("Cannot copy RDF graph with subject node", e);
        }
    }
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.