Package com.hp.hpl.jena.graph

Examples of com.hp.hpl.jena.graph.Graph.find()


    @Test public void gr_union_05()
    {
        List<Node> gnodes = list() ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(0, x) ;
    }
   
    @Test public void gr_union_06()
    {
View Full Code Here


   
    @Test public void gr_union_06()
    {
        List<Node> gnodes = list(gn1, gn1) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        long x = Iter.count(g.find(null, null, null)) ;
        assertEquals(2, x) ;
    }

    static <T> List<T> list(/* Java 7 @SuppressWarnings("unchecked")*/ T...x)
    {
View Full Code Here

    private static GNode parse(String str)
    {
        Model m = ModelFactory.createDefaultModel() ;
        m.read(new StringReader(str), null, "TTL") ;
        Graph graph = m.getGraph() ;
        Triple t = graph.find(r, p, Node.ANY).next() ;
        return new GNode(graph, t.getObject()) ;
    }
   
    private static Node node1 = NodeFactory.createLiteral("1", "", XSDDatatype.XSDinteger) ;
    private static Node node2 = NodeFactory.createLiteral("2", "", XSDDatatype.XSDinteger) ;
View Full Code Here

    protected Iter<Quad> findInSpecificNamedGraph(Node g, Node s, Node p , Node o)
    {
        Graph graph = fetchGraph(g) ;
        if ( g == null )
            return Iter.nullIter() ;
        return triples2quads(g, graph.find(s, p, o)) ;
    }

    @Override
    protected Iterator<Quad> findInAnyNamedGraphs(Node s, Node p, Node o)
    {
View Full Code Here

    Graph jGraph = JenaToClerezzaConverter.clerezzaMGraphToJenaGraph(mGraph);
   
    /*
     * Print all the triples contained in the Jena Graph.
     */
    ExtendedIterator<com.hp.hpl.jena.graph.Triple> tripleIt = jGraph.find(null, null, null);
    while(tripleIt.hasNext()){
      com.hp.hpl.jena.graph.Triple triple = tripleIt.next();
      log.info(triple.toString());
    }
  }
View Full Code Here

       
        // An optimization to prevent concatenating the two find() operations together every time through the outer loop
        boolean onFirstIterator = true;

        // It's possible there are triples (old wossname old) that are in triples twice. It doesn't matter.
        ExtendedIterator<Triple> it = rawGraph.find(resAsNode, Node.ANY, Node.ANY) ;
        try
        {
            if ( !it.hasNext() )
            {
                it.close() ;
View Full Code Here

        {
            if ( !it.hasNext() )
            {
                it.close() ;
                onFirstIterator = false ;
                it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
            }
            changeOccured = it.hasNext() ;

            while ( it.hasNext() )
            {
View Full Code Here

                   
                    rawGraph.add(Triple.create(newS, t.getPredicate(), newO));
                }
                triples.clear();

                it = onFirstIterator ? rawGraph.find(resAsNode, Node.ANY, Node.ANY) : rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                if ( onFirstIterator && !it.hasNext() )
                {
                    it.close() ;
                    onFirstIterator = false ;
                    it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
View Full Code Here

                   
                    rawGraph.add(Triple.create(newS, t.getPredicate(), newO));
                }
                triples.clear();

                it = onFirstIterator ? rawGraph.find(resAsNode, Node.ANY, Node.ANY) : rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                if ( onFirstIterator && !it.hasNext() )
                {
                    it.close() ;
                    onFirstIterator = false ;
                    it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
View Full Code Here

                it = onFirstIterator ? rawGraph.find(resAsNode, Node.ANY, Node.ANY) : rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                if ( onFirstIterator && !it.hasNext() )
                {
                    it.close() ;
                    onFirstIterator = false ;
                    it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
                }
            }
        }
        finally
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.