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

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


    Assert.assertEquals(2, i);
  }

  public void testFindSubject()
  {
    StmtIterator iter = model.listStatements(new SimpleSelector(null, null,
        RDFS.Resource));
    Assert.assertTrue(iter.hasNext());
    final Resource subject = iter.nextStatement().getSubject();
    iter = model.listStatements(new SimpleSelector(subject, null,
        (RDFNode) null));
    int i = 0;
    while (iter.hasNext())
    {
      i++;
View Full Code Here


  /**
   * A plain SimpleSelector must be simple.
   */
  public void testSimpleIsSimple()
  {
    Assert.assertTrue(new SimpleSelector(null, null, (RDFNode) null)
        .isSimple());
  }
View Full Code Here

  /**
   * A random sub-class of SimpleSelector must not be simple.
   */
  public void testSimpleSubclassIsntSimple()
  {
    Assert.assertFalse(new SimpleSelector(null, null, (RDFNode) null) {
    }.isSimple());
  }
View Full Code Here

  }

  public void testListWithLiteralSelector()
  {

    final StmtIterator it6 = model.listStatements(new SimpleSelector(null,
        null, tvStrings[1], langs[1]));
    final List<Statement> L6 = GraphTestBase.iteratorToList(it6);
    for (int i = 0; i < L6.size(); i += 1)
    {
      Assert.assertEquals(langs[1], L6.get(i).getLanguage());
View Full Code Here

    Assert.assertEquals(2, L6.size());
  }

  public void testListWithNullSelector()
  {
    final StmtIterator it1 = model.listStatements(new SimpleSelector(null,
        null, (RDFNode) null));
    final List<Statement> L1 = GraphTestBase.iteratorToList(it1);
    Assert.assertEquals(num * num * 7, L1.size());

  }
View Full Code Here

  }

  public void testListWithPredicateSelector()
  {

    final StmtIterator it3 = model.listStatements(new SimpleSelector(null,
        predicate[1], (RDFNode) null));
    final List<Statement> L3 = GraphTestBase.iteratorToList(it3);
    for (int i = 0; i < L3.size(); i += 1)
    {
      Assert.assertEquals(predicate[1], L3.get(i).getPredicate());
View Full Code Here

  // assertEquals( 2, L4.size() );

  public void testListWithRDFSelector()
  {

    final StmtIterator it5 = model.listStatements(new SimpleSelector(null,
        null, model.createTypedLiteral(false)));
    final List<Statement> L5 = GraphTestBase.iteratorToList(it5);
    for (int i = 0; i < L5.size(); i += 1)
    {
      Assert.assertEquals(false, L5.get(i).getBoolean());
View Full Code Here

    Assert.assertEquals(2, L5.size());
  }

  public void testListWithSubjectSelector()
  {
    final StmtIterator it2 = model.listStatements(new SimpleSelector(
        subject[0], null, (RDFNode) null));
    final List<Statement> L2 = GraphTestBase.iteratorToList(it2);
    for (int i = 0; i < L2.size(); i += 1)
    {
      Assert.assertEquals(subject[0], L2.get(i).getSubject());
View Full Code Here

     * compatability. It was be logged and has now become an exception.
     */
    try
    {
      final Literal lit = model.createLiteral(null, "");
      model.query(new SimpleSelector(null, null, lit));
      Assert.fail("SHould have thrown a null pointer exception");
    }
    catch (final NullPointerException expected)
    { // expected}
    }

    try
    {
      final Literal lit = model.createLiteral(null, "en");
      model.query(new SimpleSelector(null, null, lit));
      Assert.fail("SHould have thrown a null pointer exception");
    }
    catch (final NullPointerException expected)
    { // expected}
    }

    StmtIterator iter = model.listStatements(new SimpleSelector(null, null,
        (String) null));
    while (iter.hasNext())
    {
      iter.nextStatement().getObject();
    }

    iter = model.listStatements(new SimpleSelector(null, null,
        (Object) null));
    while (iter.hasNext())
    {
      iter.nextStatement().getObject();
    }
View Full Code Here

  }

  public void testQueryWithLiteralSelector()
  {
    Statement stmt;
    final Model mm = model.query(new SimpleSelector(null, null,
        tvStrings[0], langs[0]));
    Assert.assertEquals(2, mm.size());
    final StmtIterator iter = mm.listStatements();
    try
    {
View Full Code Here

TOP

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

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.