Package org.xmldb.api.base

Examples of org.xmldb.api.base.Collection


         * Runs the test query.
         *
         * @return a Result containing the query result (ResourceSet) and elapsed time
         */
        public Result runQuery() throws Exception {
            Collection col = IndexedSearchTest.this.client.getCollection(IndexedSearchTest.INDEXED_SEARCH_TEST_COLLECTION_PATH);
            XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");

            org.apache.xindice.Stopwatch aStopwatch = new org.apache.xindice.Stopwatch("Non-indexed starts-with query", true);
            ResourceSet resultSet = xpathservice.query(itsTestQuery);
            aStopwatch.stop();
            return new Result(resultSet, aStopwatch.elapsed());
View Full Code Here


                "<first>Ben</first>" +
                "<last>Smith</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.updateResource("doc1", query);
        assertEquals(1, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
View Full Code Here

                "<first>Ben</first>" +
                "<last>Benton</last>" +
                "<phone type=\"work\">480-300-3003</phone>" +
                "</person>";

        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
        XUpdateQueryService service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

        long count = service.update(query);
        assertEquals(6, count);

        String doc = this.client.getDocument(TEST_COLLECTION_PATH, "doc1");
View Full Code Here

  public void testSimpleQuery() throws Exception
  {
    String query = "//person[last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
View Full Code Here

  public void testSimpleAndQuery() throws Exception
  {
    String query = "//person[first='John' and last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
View Full Code Here

  public void testSimpleOrQuery() throws Exception
  {
    String query = "//person[first='John' or last='Smith']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
View Full Code Here

  public void testMultipleOrQuery() throws Exception
  {
    String query = "//person[first='John' or first='Sally']";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
View Full Code Here

  public void testAndOrQuery() throws Exception
  {
    String query = "//person[last='Smith' and (first='John' or first='Sally')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();

    List res = asList(results);
View Full Code Here

  public void testSimpleWildcardSearchQuery() throws Exception
  {
    // search all records whose last name contains 'Smi'
    String query = "//person[contains(last, 'Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
View Full Code Here

    this.client.insertDocument(TEST_COLLECTION_PATH, "doc3", document3);

    // search all records whose last name begins with 'Smi'
    String query = "//person[(string-length(//person/last) >= 3) and (substring(//person/last, 1, 3)='Smi')]";

    Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
    XPathQueryService xpathservice = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = xpathservice.query(query);

    ResourceIterator results = resultSet.getIterator();
    List res = asList(results);
    assertEquals(2, res.size());
View Full Code Here

TOP

Related Classes of org.xmldb.api.base.Collection

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.