Package org.openrdf.model

Examples of org.openrdf.model.Namespace


  public Map<String, String> asMap()
    throws StoreException
  {
    Map<String, String> map = new HashMap<String, String>();
    Namespace ns;
    while ((ns = next()) != null) {
      map.put(ns.getPrefix(), ns.getName());
    }
    return map;
  }
View Full Code Here


  }

  public String getNamespace(String prefix)
    throws StoreException
  {
    Namespace ns = namespaces.findByPrefix(prefix);
    if (ns == null) {
      return null;
    }
    return ns.getName();
  }
View Full Code Here

      handler.startRDF();
      // Export namespace information
      NamespaceResult nsIter = getNamespaces();
      try {
        while (nsIter.hasNext()) {
          Namespace ns = nsIter.next();
          handler.handleNamespace(ns.getPrefix(), ns.getName());
        }
      }
      finally {
        nsIter.close();
      }
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

    for (RepositoryConnection member : members) {
      NamespaceResult ns = member.getNamespaces();
      try {
        while (ns.hasNext()) {
          Namespace next = ns.next();
          String prefix = next.getPrefix();

          if (prefixes.add(prefix)) {
            namespaces.put(prefix, next);
          }
          else if (!next.equals(namespaces.get(prefix))) {
            namespaces.remove(prefix);
          }
        }
      }
      finally {
View Full Code Here

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

      NamespaceResult 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();
      }
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

  {
    con.setNamespace("rdf", RDF.NAMESPACE);

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

      NamespaceResult iter = getConnection().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

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.