Package com.hp.hpl.jena.sparql.lang.sparql_11

Examples of com.hp.hpl.jena.sparql.lang.sparql_11.TokenMgrError


        _parse(sink, r) ;
    }
   
    private void _parse(UpdateSink sink, Reader r)
    {
        SPARQLParser11 parser = null ;
        try {
            parser = new SPARQLParser11(r) ;
            parser.setUpdateSink(sink) ;
            parser.UpdateUnit() ;
        }
        catch (com.hp.hpl.jena.sparql.lang.sparql_11.ParseException ex)
        {
            throw new QueryParseException(ex.getMessage(),
                                          ex.currentToken.beginLine,
View Full Code Here


     *            Arguments
     * @throws ParseException
     *             Thrown if the expression string is not valid syntax
     */
    public void add(String uri, String expr, List<Var> args) throws ParseException {
        Expr e = new SPARQLParser11(new StringReader(expr)).Expression();
        if (!preserveDependencies) {
            // If not allowing dependencies expand expression fully
            e = ExprTransformer.transform(new ExprTransformExpand(this.definitions), e);
        }

View Full Code Here

   
    // All throwable handling.
    private static void perform(Query query, String string, Action action)
    {
        Reader in = new StringReader(string) ;
        SPARQLParser11 parser = new SPARQLParser11(in) ;

        try {
            query.setStrict(true) ;
            parser.setQuery(query) ;
            action.exec(parser) ;
        }
        catch (com.hp.hpl.jena.sparql.lang.sparql_11.ParseException ex)
        {
            throw new QueryParseException(ex.getMessage(),
View Full Code Here

     *            Arguments
     * @throws ParseException
     *             Thrown if the expression string is not valid syntax
     */
    public void add(String uri, String expr, List<Var> args) throws ParseException {
        Expr e = new SPARQLParser11(new StringReader(expr)).Expression();
        if (!preserveDependencies) {
            // If not allowing dependencies expand expression fully
            e = ExprTransformer.transform(new ExprTransformExpand(this.definitions), e);
        }

View Full Code Here

   
    // All throwable handling.
    private static void perform(Query query, String string, Action action)
    {
        Reader in = new StringReader(string) ;
        SPARQLParser11 parser = new SPARQLParser11(in) ;

        try {
            query.setStrict(true) ;
            parser.setQuery(query) ;
            action.exec(parser) ;
        }
        catch (com.hp.hpl.jena.sparql.lang.sparql_11.ParseException ex)
        {
            throw new QueryParseException(ex.getMessage(),
View Full Code Here

        return _parse(update, r) ;
    }
   
    private UpdateRequest _parse(UpdateRequest update, Reader r)
    {
        SPARQLParser11 parser = null ;
        try {
            parser = new SPARQLParser11(r) ;
            parser.setUpdateRequest(update) ;
            parser.UpdateUnit() ;
            validateParsedUpdate(update) ;
            return update ;
        }
        catch (com.hp.hpl.jena.sparql.lang.sparql_11.ParseException ex)
        {
View Full Code Here

     * @param expr Expression String (in SPARQL syntax)
     * @param args Arguments
     * @throws ParseException Thrown if the expression string is not valid syntax
     */
    public void add(String uri, String expr, List<Var> args) throws ParseException {
        Expr e = new SPARQLParser11(new StringReader(expr)).Expression();
        if (!preserveDependencies) {
            //If not allowing dependencies expand expression fully
            e = ExprTransformer.transform(new ExprTransformExpand(this.definitions), e);
       
       
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

TOP

Related Classes of com.hp.hpl.jena.sparql.lang.sparql_11.TokenMgrError

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.