Package org.jrdf.graph

Examples of org.jrdf.graph.Resource


        }
        return hasNext;
    }

    private Resource getNextNode() {
        Resource resource = null;
        if (iterator201.hasNext()) {
            resource = getNextOSPElement();
            if (resource == null) {
                return getNextNode();
            }
View Full Code Here


        throw new UnsupportedOperationException();
    }

    protected Resource getNextResource() {
        //for the first time retrieve the current one as well as the next one
        final Resource resource;
        if (nextResource == null) {
            throw new NoSuchElementException();
        } else {
            resource = nextResource;
            nextResource = getNextNode();
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    private void addResource(GraphElementFactory elementFactory, Triple triple) throws GraphElementFactoryException {
        Resource resource = elementFactory.createResource(triple.getSubject());
        graphs.add(resource);
        long id = getId(resource);
        graphNameToId.put(getName(resource), id);
        if (id > highestId) {
            highestId = id;
View Full Code Here

    }

    public long addGraph(String name) {
        GraphElementFactory graphElementFactory = graph.getElementFactory();
        highestId++;
        Resource resource = tryAddGraph(name, highestId, graphElementFactory);
        graphs.add(resource);
        return highestId;
    }
View Full Code Here

        }
    }

    private Resource tryAddGraph(String name, Long id, GraphElementFactory graphElementFactory) {
        try {
            Resource resource = graphElementFactory.createResource();
            resource.addValue(RDF.TYPE, GRAPH);
            resource.addValue(NAME, name);
            resource.addValue(ID, id);
            graphNameToId.put(name, id);
            return resource;
        } catch (GraphException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        Graph fooGraph = JRDF_FACTORY.getNewGraph("foo");
        Graph barGraph = JRDF_FACTORY.getNewGraph("bar");
        GraphElementFactory barElementFactory = barGraph.getElementFactory();
        URI uri1 = URI.create("urn:hello");
        URI uri2 = URI.create("urn:there");
        Resource resource = barElementFactory.createResource(uri1);
        resource.addValue(uri1, uri2);
        resource.addValue(uri2, uri2);
        GraphElementFactory fooElementFactory = fooGraph.getElementFactory();
        Resource blankResource = fooElementFactory.createResource();
        blankResource.addValue(uri1, uri2);
        blankResource.addValue(uri1, uri1);
        blankResource.addValue(uri2, uri2);
    }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.Resource

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.