Package org.openrdf.result

Examples of org.openrdf.result.ModelResult


    throws Exception
  {
    testCon.add(bob, name, nameBob);

    Statement st;
    ModelResult statements = testCon.match(bob, name, null, false);
    try {
      st = statements.next();
    }
    finally {
      statements.close();
    }

    Literal literal = (Literal)st.getObject();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here


  {
    testCon.add(bob, name, nameBob);
    testCon.add(alice, name, nameAlice);

    Model model;
    ModelResult statements = testCon.match(null, null, null, true);
    try {
      model = new LinkedHashModel(statements.asList());
    }
    finally {
      statements.close();
    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(baos);
    out.writeObject(model);
View Full Code Here

  private void testValueRoundTrip(Resource subj, URI pred, Value obj)
    throws Exception
  {
    testCon.add(subj, pred, obj);

    ModelResult stIter = testCon.match(null, null, null, false);

    try {
      assertTrue(stIter.hasNext());
      Statement st = stIter.next();
      assertEquals(subj, st.getSubject());
      assertEquals(pred, st.getPredicate());
      assertEquals(obj, st.getObject());
      assertFalse(stIter.hasNext());
    }
    finally {
      stIter.close();
    }

    stIter = testCon.match(subj, pred, obj, false);

    try {
      assertTrue(stIter.hasNext());
      Statement st = stIter.next();
      assertEquals(subj, st.getSubject());
      assertEquals(pred, st.getPredicate());
      assertEquals(obj, st.getObject());
      assertFalse(stIter.hasNext());
    }
    finally {
      stIter.close();
    }

    TupleQuery tupleQuery = testCon.prepareTupleQuery(QueryLanguage.SERQL,
        "SELECT S, P, O FROM {S} P {O} WHERE P = <" + pred.stringValue() + ">", null);
View Full Code Here

  }

  private int getTotalStatementCount(RepositoryConnection connection)
    throws StoreException
  {
    ModelResult iter = connection.match(null, null, null, true);

    try {
      int size = 0;

      while (iter.hasNext()) {
        iter.next();
        ++size;
      }

      return size;
    }
    finally {
      iter.close();
    }
  }
View Full Code Here

  }

  public void testExplicitFlag()
    throws Exception
  {
    ModelResult result = testCon.match(RDF.TYPE, RDF.TYPE, null, true);
    try {
      assertTrue("result should not be empty", result.hasNext());
    }
    finally {
      result.close();
    }

    result = testCon.match(RDF.TYPE, RDF.TYPE, null, false);
    try {
      assertFalse("result should be empty", result.hasNext());
    }
    finally {
      result.close();
    }
  }
View Full Code Here

  {
    ServerConnection con = getConnection();
    StatementPatternParams p = new StatementPatternParams(getRequest(), con.getValueFactory());

    try {
      ModelResult modelResult = getConnection().match(p.getSubject(), p.getPredicate(), p.getObject(),
          p.isIncludeInferred(), p.getContext());

      if (p.getOffset() > 0 || p.getLimit() > -1) {
        Cursor<Statement> cursor = modelResult;
View Full Code Here

    finally {
      nsIt.close();
    }

    // Export statements
    ModelResult stIt = match(subj, pred, obj, includeInferred, contexts);
    try {
      while (stIt.hasNext()) {
        handler.handleStatement(stIt.next());
      }
    }
    finally {
      stIt.close();
    }

    handler.endRDF();
    return handler;
  }
View Full Code Here

TOP

Related Classes of org.openrdf.result.ModelResult

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.