Package org.openrdf.model

Examples of org.openrdf.model.Namespace


      RepositoryResult<Namespace> namespaces;
      namespaces = getDelegate().getNamespaces();
      List<String> prefix = new ArrayList<String>();
      try {
        while (namespaces.hasNext()) {
          Namespace ns = namespaces.next();
          prefix.add(ns.getPrefix());
        }
      } finally {
        namespaces.close();
      }
      getDelegate().clearNamespaces();
View Full Code Here


        try {
          if (namespaces.hasNext()) {
            writeln("+----------");
            while (namespaces.hasNext()) {
              Namespace ns = namespaces.next();
              writeln("|" + ns.getPrefix() + "  " + ns.getName());
            }
            writeln("+----------");
          }
          else {
            writeln("--no namespaces found--");
View Full Code Here

    con.commit();

    CloseableIteration<? extends Namespace, SailException> namespaces = con.getNamespaces();
    try {
      assertTrue(namespaces.hasNext());
      Namespace rdf = namespaces.next();
      assertEquals("rdf", rdf.getPrefix());
      assertEquals(RDF.NAMESPACE, rdf.getName());
      assertTrue(!namespaces.hasNext());
    }
    finally {
      namespaces.close();
    }
View Full Code Here

    try {
      CloseableIteration<? extends Namespace, RepositoryException> iter = repositoryCon.getNamespaces();

      try {
        while (iter.hasNext()) {
          Namespace ns = iter.next();

          Literal prefix = new LiteralImpl(ns.getPrefix());
          Literal namespace = new LiteralImpl(ns.getName());

          BindingSet bindingSet = new ListBindingSet(columnNames, prefix, namespace);
          namespaces.add(bindingSet);
        }
      }
View Full Code Here

    namespaces.clearPrefixes();
  }

  @Override
  protected String getNamespaceInternal(String prefix) throws SailException {
    Namespace ns = namespaces.findByPrefix(prefix);
    if (ns == null)
      return null;
    return ns.getName();
  }
View Full Code Here

    try {
      Map<String, String> map = new HashMap<String, String>();
      int nsCount = 0;
      while (nsIter.hasNext()) {
        nsCount++;
        Namespace ns = nsIter.next();
        map.put(ns.getPrefix(), ns.getName());
      }

      assertEquals("There should be exactly three namespaces", 3, nsCount);
      assertTrue("namespace for prefix 'example' should exist", map.containsKey("example"));
      assertTrue("namespace for prefix 'rdfs' should exist", map.containsKey("rdfs"));
View Full Code Here

        Collector<Namespace> coll = new Collector<Namespace>();
        mc.getNamespaces().writeTo(coll);
        int max = 0;
        int j = 0;
        for (Object aColl : coll) {
            Namespace ns = (Namespace) aColl;
            prefixesToNames.put(ns.getPrefix(), ns.getName());

            int len = (ns.getPrefix() + j).length();
            if (len > max) {
                max = len;
            }
            j++;
        }
View Full Code Here

    // Export namespace information
    RepositoryResult<Namespace> nsIt = getNamespaces();
    try {
      while (nsIt.hasNext()) {
        Namespace ns = nsIt.next();
        handler.handleNamespace(ns.getPrefix(), ns.getName());
      }
    }
    finally {
      nsIt.close();
    }
View Full Code Here

      // begin at onset one
      while (rs.next()) {
        String prefix = rs.getString(1);
        String name = rs.getString(2);
        if (name != null && prefix != null) {
          Namespace ns = new NamespaceImpl(prefix, name);
          namespaceList.add(ns);
        }
      }
                        rs.close();
                        stmt.close();
View Full Code Here

        ok = false;
      }
      endTest((ok && exists)); // should return true

      // test getNamespace
      Namespace testns = null;
      RepositoryResult<Namespace> namespaces = null;
      boolean hasNamespaces = false;

      try {
        namespaces = con.getNamespaces();
        hasNamespaces = namespaces.hasNext();
        while (namespaces.hasNext()) {
          Namespace ns = namespaces.next();
          // LOG("Namespace found: (" + ns.getName() + " " + ns.getPrefix() + ")");
          testns = ns;
        }
      }
      catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.openrdf.model.Namespace

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.