Package com.hp.hpl.jena.graph

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


    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 = Node.createLiteral("1", "", XSDDatatype.XSDinteger) ;
    private static Node node2 = Node.createLiteral("2", "", XSDDatatype.XSDinteger) ;
View Full Code Here


       
        //Set bindings = new HashSet() ;    // Use a Set if you want unique results.
        List<Binding> bindings = new ArrayList<Binding>() ;   // Use a list if you want counting results.
        Graph graph = execCxt.getActiveGraph() ;
       
        ExtendedIterator<Triple>iter = graph.find(Node.ANY, Node.ANY, Node.ANY) ;
        for ( ; iter.hasNext() ; )
        {
            Triple t = iter.next() ;
            slot(bindings, input, t.getSubject(),   subjVar, nodeLocalname) ;
            slot(bindings, input, t.getPredicate(), subjVar, nodeLocalname) ;
View Full Code Here

   
    private static Triple parseOneTriple(String ...strings)
    {
        Graph graph = parse(strings) ;
        assertEquals(1, graph.size()) ;
        return graph.find(null, null, null).next();
    }
   
//    private static void parseSilent(String string)
//    {
//        Reader reader = new StringReader(string) ;
View Full Code Here

        Node np = Node.createURI("p") ;
        Node nx1 = Node.createLiteral("0.50", null, dt) ;
        Node nx2 = Node.createLiteral("0.500", null, dt) ;
        Graph graph = Factory.createDefaultGraph() ;
        graph.add(new Triple(ns, np, nx1)) ;
        assertTrue( graph.find(Node.ANY, Node.ANY, nx2).hasNext() )
    }
   
    /**
     * Test the internal machinery of decimal normalization directly
     */
 
View Full Code Here

        Node np = Node.createURI("p") ;
        Node nx1 = Node.createLiteral("0.50", null, dt) ;
        Node nx2 = Node.createLiteral("0.500", null, dt) ;
        Graph graph = Factory.createDefaultGraph() ;
        graph.add(new Triple(ns, np, nx1)) ;
        assertTrue( graph.find(Node.ANY, Node.ANY, nx2).hasNext() )
    }
   
    /**
     * Test the internal machinery of decimal normalization directly
     */
 
View Full Code Here

                Graph g = graphWith( graph );
                int n = Integer.parseInt( size );
                Node literal = NodeCreateUtils.create( search );
            //
                assertEquals( "graph has wrong size", n, g.size() );
                Set<Node> got = g.find( Node.ANY, Node.ANY, literal ).mapWith( getObject ).toSet();
                assertEquals( nodeSet( results ), got );
                }
            };
        }
   
View Full Code Here

        Node P = NodeCreateUtils.create( "P" );
        g.add( Triple.create( SB, P, ab ) );
        g.add( Triple.create( SS, P, as ) );
        g.add( Triple.create( SI, P, ai ) );
        g.add( Triple.create( SL, P, al ) );
        assertEquals( 4, iteratorToSet( g.find( Node.ANY, P, NodeCreateUtils.create( "42" ) ) ).size() );
        }
    }
View Full Code Here

   
    private static Triple parseOneTriple(String ...strings)
    {
        Graph graph = parse(strings) ;
        assertEquals(1, graph.size()) ;
        return graph.find(null, null, null).next();
    }
   
//    private static void parseSilent(String string)
//    {
//        Reader reader = new StringReader(string) ;
View Full Code Here

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

    @Test public void gr_union_02()
    {
        List<Node> gnodes = list(gn1, gn2) ;
        Graph g = new GraphUnionRead(dsg, gnodes) ;
        Node s = Node.createURI("http://example/s") ;
        long x = Iter.count(g.find(s, null, null)) ;
        assertEquals(3, x) ;
    }

    @Test public void gr_union_03()
    {
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.