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

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


    super(modelFactory, name);
  }

  public void check( final Resource S, final Property P, final RDFNode O )
  {
    final Selector s = new SimpleSelector(S, P, O);
    Assert.assertTrue(s.isSimple());
    Assert.assertEquals(S, s.getSubject());
    Assert.assertEquals(P, s.getPredicate());
    Assert.assertEquals(O, s.getObject());
  }
View Full Code Here


  public void testListStatementsClever()
  {

    ModelHelper.modelAdd(model, "S P O; S P O2; S P2 O; S2 P O");
    final Selector sel = new SimpleSelector(null, null, (RDFNode) null) {
      @Override
      public boolean isSimple()
      {
        return false;
      }
View Full Code Here

        GraphTestBase.iteratorToSet(r.listProperties().mapWith(
            Statement.Util.getSubject)));
    //
    r.removeProperties();
    Assert.assertEquals(0,
        model.query(new SimpleSelector(r, null, (RDFNode) null)).size());
  }
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.