Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.NodeIterator


  }

  public void testObjectsOfPropertyAndValue()
  {
    NodeIterator iter;
    final boolean[] object = new boolean[num];
    final Resource subj = model.createResource();
    for (int i = 0; i < num; i++)
    {
      model.addLiteral(subj, RDF.value, i);
      object[i] = false;
    }

    iter = model.listObjectsOfProperty(subj, RDF.value);
    while (iter.hasNext())
    {
      final int i = ((Literal) iter.nextNode()).getInt();
      object[i] = true;
    }
    for (int i = 0; i < (num); i++)
    {
      Assert.assertTrue(object[i]);
View Full Code Here


    super(modelFactory, name);
  }

  protected void checkNumericContent( final Container cont2, final int num )
  {
    final NodeIterator nit = cont2.iterator();
    for (int i = 0; i < num; i += 1)
    {
      Assert.assertEquals(i, ((Literal) nit.nextNode()).getInt());
    }
    Assert.assertFalse(nit.hasNext());
  }
View Full Code Here

  }

  protected void retainOnlySpecified( final Container cont2, final int num,
      final boolean[] retain )
  {
    final NodeIterator nit = cont2.iterator();
    for (int i = 0; i < num; i++)
    {
      nit.nextNode();
      if (retain[i] == false)
      {
        nit.remove();
      }
    }
    Assert.assertFalse(nit.hasNext());
  }
View Full Code Here

    Assert.assertFalse(nit.hasNext());
  }

  protected void seeWhatsThere( final Container cont2, final boolean[] found )
  {
    final NodeIterator nit = cont2.iterator();
    while (nit.hasNext())
    {
      final int v = ((Literal) nit.nextNode()).getInt();
      Assert.assertFalse(found[v]);
      found[v] = true;
    }
  }
View Full Code Here

  public void testListObjectsNoRemove()
  {
    final Model m = ModelHelper.modelWithStatements(this,
        "a P b; b Q c; c R a");
    final NodeIterator it = m.listObjects();
    it.next();
    try
    {
      it.remove();
      Assert.fail("listObjects should not support .remove()");
    }
    catch (final UnsupportedOperationException e)
    {
      JenaTestBase.pass();
View Full Code Here

       
        Iterator<RDFNode> iter = new Map1Iterator<HitLARQ, RDFNode>(converter, search(queryString)) ;
        if ( scoreLimit > 0 )
            iter = new IteratorTruncate<RDFNode>(new ScoreTest(scoreLimit), iter) ;
       
        NodeIterator nIter = new NodeIteratorImpl(iter, null) ;
        return nIter ;
    }
View Full Code Here

                    Resource b = m.createResource( "http://foo/bar#b" );
                    OntProperty p = m.createOntProperty( "http://foo/bar#p" );
                    Literal l = m.createTypedLiteral( false );
                    m.add( a, p, b );
                    m.add( a, p, l );
                    NodeIterator ni = a.listPropertyValues( p );

                    while (ni.hasNext()) {
                        RDFNode n = ni.nextNode();
                        if (n.isResource()) {
                            assertEquals( b, n );
                            assertTrue( "Return value should be an OntResource", n instanceof OntResource );
                        }
                    }
View Full Code Here

    }
  }

  public Set<IDoapCategory> getAll() throws SimalRepositoryException {
    Model model = ((JenaSimalRepository) getRepository()).getModel();
      NodeIterator itr = model.listObjectsOfProperty(Doap.CATEGORY);
      Set<IDoapCategory> categories = new HashSet<IDoapCategory>();
      while (itr.hasNext()) {
        String uri = itr.nextNode().toString();
        categories.add(new Category(model.getResource(uri)));
      }
      return categories;
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.NodeIterator

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.