Package lupos.sparql1_1

Examples of lupos.sparql1_1.ASTSelectQuery


    this.operator = operator;
  }

  public void getUsedVariables(HashSet<Variable> variables) {
    try {
      SimpleNode node = SPARQL1_1Parser.parseOrderCondition(this.sortString, this.prefix.getPrefixNames());

      Operator.computeUsedVariables(node, variables);
    }
    catch(ParseException e) {
      e.printStackTrace();
View Full Code Here


    this.item = item;
  }

  public void addPredicate(RDFTerm child, String predicate) throws ModificationException {
    try {
      SimpleNode node = SPARQL1_1Parser.parseVerbWithoutVar(predicate, this.prefix.getPrefixNames());

      this.addPredicate(child, this.getItem(node));
    }
    catch(Throwable t) {
      this.handleParseError(t);
View Full Code Here

      if(this.predicates.get(child).size() == index) {
        this.predicates.get(child).add(null);
      }

      // parse new value...
      SimpleNode node = SPARQL1_1Parser.parseVerbWithoutVar(predicate, this.prefix.getPrefixNames());

      // remove old value...
      if(this.predicates.get(child).get(index) != null) {
        this.predicates.get(child).remove(index);
      }
View Full Code Here

    }
  }

  public void applyChange(String value) throws ModificationException {
    try {
      SimpleNode node = SPARQL1_1Parser.parseGraphTerm(value, this.prefix.getPrefixNames());

      this.item = this.getItem(node);
    }
    catch(Throwable t) {
      this.handleParseError(t);
View Full Code Here

    }
  }

  @Override
  public String visit(final ASTFilterConstraint node) {
    final Node n = new SimpleNode(0);
    final Node parent = node.jjtGetParent();
    n.jjtAddChild(node, 0);
    node.jjtSetParent(n);
    parent.replaceChild2(node, n);
    n.jjtSetParent(parent);
    this.applyRules(node);
    String ret = "";
    final String prefix = (parent instanceof ASTOrderConditions || parent instanceof ASTHaving)? "" : "FILTER";
    final String postfix = (parent instanceof ASTOrderConditions || parent instanceof ASTHaving)? "" : ".\n";
    final int numberOfChildren = n.jjtGetNumChildren();
    for (int i = 0; i < numberOfChildren; i++) {
      final Node currentChild=n.jjtGetChild(i);
      for(int j=0; j<currentChild.jjtGetNumChildren();j++){
        ret += prefix + "(" + this.visitChild(currentChild, j) + ")"+postfix;
      }
    }
    return ret;
View Full Code Here

      }
    }

   
    private Literal getLiteral(String content) throws ParseException {
        final SimpleNode node = SPARQL1_1Parser.parseGraphTerm(content, null);
        return LazyLiteral.getLiteral(node, false);
    }
View Full Code Here

    return new JAVACCParser(reader, new SPARQLParser(reader));
  }

  @Override
  public TOKEN getNextToken() {
    final Token token = this.parser.getNextToken();
    if(token==null){
      return null;
    } else {
      return new SPARQLToken(token);
    }
View Full Code Here

  }

  protected boolean dealWithThrowableFromQueryParser(final Throwable e,
      final EvaluationMode mode, final boolean queryOrRif) {
    if (e instanceof TokenMgrError) {
      final TokenMgrError tme = (TokenMgrError) e;
      this.displayErrorMessage(tme.getMessage(), false, queryOrRif);

      // create the pattern to match
      // and create a matcher against the string
      final Pattern pattern = Pattern
          .compile("line (\\d+), column (\\d+)");
      final Matcher matcher = pattern.matcher(tme.getMessage());

      // try to find the pattern in the message...
      if (matcher.find() == true) {
        // get matches...
        final int line = Integer.parseInt(matcher.group(1));
        final int column = Integer.parseInt(matcher.group(2));

        this.setErrorPosition(line, column, queryOrRif);
      }
      if (mode == EvaluationMode.DEMO) {
        this.enableOrDisableButtons(queryOrRif);
      }
      return true;
    } else  if (e instanceof lupos.rif.generated.parser.TokenMgrError) {
      final lupos.rif.generated.parser.TokenMgrError tme = (lupos.rif.generated.parser.TokenMgrError) e;
      this.displayErrorMessage(tme.getMessage(), false, queryOrRif);

      // create the pattern to match
      // and create a matcher against the string
      final Pattern pattern = Pattern
          .compile("line (\\d+), column (\\d+)");
      final Matcher matcher = pattern.matcher(tme.getMessage());

      // try to find the pattern in the message...
      if (matcher.find() == true) {
        // get matches...
        final int line = Integer.parseInt(matcher.group(1));
View Full Code Here

        line = pe.currentToken.next.beginLine;
        column = pe.currentToken.next.beginColumn;
      }
    }
    else if(t instanceof TokenMgrError) {
      TokenMgrError tme = (TokenMgrError) t;

      // create the pattern to match and create a matcher against the
      // string
      Pattern pattern = Pattern.compile("line (\\d+), column (\\d+)");
      Matcher matcher = pattern.matcher(tme.getMessage());

      if(matcher.find() == true) { // try to find the pattern in the
        // message...
        // get matches...
        line = Integer.parseInt(matcher.group(1));
View Full Code Here

      if(root==null){
        this.result = new Result();
        root_param.setSucceedingOperator(new OperatorIDTuple(this.result,0));
      } else {
        final IndexOperatorGraphGenerator spvi = IndexOperatorGraphGenerator.createOperatorGraphGenerator(root_param, this);
        spvi.visit((ASTQuery)root);

        this.result = spvi.getResult();
      }

      root_param.deleteParents();
      root_param.setParents();
      final CorrectOperatorgraphRulePackage recog = new CorrectOperatorgraphRulePackage();
View Full Code Here

TOP

Related Classes of lupos.sparql1_1.ASTSelectQuery

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.