Package org.openrdf.query.parser.sparql.ast

Examples of org.openrdf.query.parser.sparql.ast.ASTIRI


      if (namespace == null) {
        throw new VisitorException("QName '" + qname + "' uses an undefined prefix");
      }

      // Replace the qname node with a new IRI node in the parent node
      ASTIRI iriNode = new ASTIRI(SyntaxTreeBuilderTreeConstants.JJTIRI);
      iriNode.setValue(namespace + localName);
      qnameNode.jjtReplaceWith(iriNode);

      return null;
    }
View Full Code Here


    if (!datasetClauses.isEmpty()) {
      dataset = new DatasetImpl();

      for (ASTDatasetClause dc : datasetClauses) {
        ASTIRI astIri = dc.jjtGetChild(ASTIRI.class);

        try {
          URI uri = new URIImpl(astIri.getValue());
          if (dc.isNamed()) {
            dataset.addNamedGraph(uri);
          }
          else {
            dataset.addDefaultGraph(uri);
View Full Code Here

  public ValueConstant visit(ASTRDFLiteral node, Object data)
    throws VisitorException
  {
    String label = (String)node.getLabel().jjtAccept(this, null);
    String lang = node.getLang();
    ASTIRI datatypeNode = node.getDatatype();

    Literal literal;
    if (datatypeNode != null) {
      URI datatype;
      try {
        datatype = valueFactory.createURI(datatypeNode.getValue());
      }
      catch (IllegalArgumentException e) {
        // invalid URI
        throw new VisitorException(e.getMessage());
      }
View Full Code Here

    if (!datasetClauses.isEmpty()) {
      dataset = new DatasetImpl();

      for (ASTDatasetClause dc : datasetClauses) {
        ASTIRI astIri = dc.jjtGetChild(ASTIRI.class);

        try {
          URI uri = new URIImpl(astIri.getValue());
          if (dc.isNamed()) {
            dataset.addNamedGraph(uri);
          }
          else {
            dataset.addDefaultGraph(uri);
View Full Code Here

      if (namespace == null) {
        throw new VisitorException("QName '" + qname + "' uses an undefined prefix");
      }

      // Replace the qname node with a new IRI node in the parent node
      ASTIRI iriNode = new ASTIRI(SyntaxTreeBuilderTreeConstants.JJTIRI);
      iriNode.setValue(namespace + localName);
      qnameNode.jjtReplaceWith(iriNode);

      return null;
    }
View Full Code Here

  public ValueConstant visit(ASTRDFLiteral node, Object data)
    throws VisitorException
  {
    String label = (String)node.getLabel().jjtAccept(this, null);
    String lang = node.getLang();
    ASTIRI datatypeNode = node.getDatatype();

    Literal literal;
    if (datatypeNode != null) {
      URI datatype = valueFactory.createURI(datatypeNode.getValue());
      literal = valueFactory.createLiteral(label, datatype);
    }
    else if (lang != null) {
      literal = valueFactory.createLiteral(label, lang);
    }
View Full Code Here

TOP

Related Classes of org.openrdf.query.parser.sparql.ast.ASTIRI

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.