Examples of ParsedURI


Examples of info.aduna.net.ParsedURI

   * Parses and normalizes the supplied URI-string and sets it as the base URI
   * for resolving relative URIs.
   */
  protected void setBaseURI(String uriSpec) {
    // Store normalized base URI
    ParsedURI baseURI = new ParsedURI(uriSpec);
    baseURI.normalize();
    setBaseURI(baseURI);
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

   */
  protected URI resolveURI(String uriSpec)
    throws RDFParseException
  {
    // Resolve relative URIs against base URI
    ParsedURI uri = new ParsedURI(uriSpec);

    if (uri.isRelative()) {
      if (baseURI == null) {
        reportFatalError("Unable to resolve URIs, no base URI has been set");
      }

      if (verifyData) {
        if (uri.isRelative() && !uri.isSelfReference() && baseURI.isOpaque()) {
          reportError("Relative URI '" + uriSpec + "' cannot be resolved using the opaque base URI '"
              + baseURI + "'");
        }
      }

      uri = baseURI.resolve(uri);
    }

    return createURI(uri.toString());
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

    xmlLiteralPrefixes.clear();
    unknownPrefixesInXMLLiteral.clear();
  }

  private ParsedURI createBaseURI(String uriString) {
    ParsedURI uri = new ParsedURI(uriString);
    uri.normalize();
    return uri;
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

   *         URI.
   */
  public static void process(ASTQueryContainer qc, String externalBaseURI)
    throws MalformedQueryException
  {
    ParsedURI parsedBaseURI = null;

    // Use the query model's own base URI, if available
    ASTBaseDecl baseDecl = qc.getBaseDecl();
    if (baseDecl != null) {
      parsedBaseURI = new ParsedURI(baseDecl.getIRI());

      if (!parsedBaseURI.isAbsolute()) {
        throw new MalformedQueryException("BASE IRI is not an absolute IRI: " + externalBaseURI);
      }
    }
    else if (externalBaseURI != null) {
      // Use external base URI if the query doesn't contain one itself
      parsedBaseURI = new ParsedURI(externalBaseURI);

      if (!parsedBaseURI.isAbsolute()) {
        throw new IllegalArgumentException("Supplied base URI is not an absolute IRI: " + externalBaseURI);
      }
    }
    else {
      // FIXME: use the "Default Base URI"?
View Full Code Here

Examples of info.aduna.net.ParsedURI

    @Override
    public Object visit(ASTIRI node, Object data)
      throws VisitorException
    {
      ParsedURI resolvedURI = parsedBaseURI.resolve(node.getValue());
      node.setValue(resolvedURI.toString());

      return super.visit(node, data);
    }
View Full Code Here

Examples of info.aduna.net.ParsedURI

   * Parses and normalizes the supplied URI-string and sets it as the base URI
   * for resolving relative URIs.
   */
  protected void setBaseURI(String uriSpec) {
    // Store normalized base URI
    ParsedURI baseURI = new ParsedURI(uriSpec);
    baseURI.normalize();
    setBaseURI(baseURI);
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

    if (baseURI == null) {
      reportFatalError("Unable to resolve URIs, no base URI has been set");
    }

    // Resolve relative URIs against base URI
    ParsedURI uri = new ParsedURI(uriSpec);

    if (verifyData) {
      if (uri.isRelative() && !uri.isSelfReference() && baseURI.isOpaque()) {
        reportError("Relative URI '" + uriSpec + "' cannot be resolved using the opaque base URI '"
            + baseURI + "'");
      }
    }

    uri = baseURI.resolve(uri);

    return createURI(uri.toString());
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

      // the rest as the path to enable 'correct' resolving of relative URIs
      int idx = uriString.indexOf('!');
      if (idx != -1) {
        String scheme = uriString.substring(0, idx + 1);
        String path = uriString.substring(idx + 1);
        return new ParsedURI(scheme, null, path, null, null);
      }
    }

    ParsedURI uri = new ParsedURI(uriString);
    uri.normalize();
    return uri;
  }
View Full Code Here

Examples of info.aduna.net.ParsedURI

    @Override
    public Object visit(ASTIRI node, Object data)
      throws VisitorException
    {
      ParsedURI resolvedURI = parsedBaseURI.resolve(node.getValue());
      node.setValue(resolvedURI.toString());

      return super.visit(node, data);
    }
View Full Code Here

Examples of info.aduna.net.ParsedURI

   *         URI.
   */
  public static void process(ASTQueryContainer qc, String externalBaseURI)
    throws MalformedQueryException
  {
    ParsedURI parsedBaseURI = null;

    // Use the query model's own base URI, if available
    ASTBaseDecl baseDecl = qc.getBaseDecl();
    if (baseDecl != null) {
      parsedBaseURI = new ParsedURI(baseDecl.getIRI());

      if (!parsedBaseURI.isAbsolute()) {
        throw new MalformedQueryException("BASE IRI is not an absolute IRI: " + externalBaseURI);
      }
    }
    else if (externalBaseURI != null) {
      // Use external base URI if the query doesn't contain one itself
      parsedBaseURI = new ParsedURI(externalBaseURI);

      if (!parsedBaseURI.isAbsolute()) {
        throw new IllegalArgumentException("Supplied base URI is not an absolute IRI: " + externalBaseURI);
      }
    }
    else {
      // FIXME: use the "Default Base URI"?
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.