Package com.hp.hpl.jena.n3

Examples of com.hp.hpl.jena.n3.N3JenaWriterCommon


   
    @Override
        protected void runTest() throws Throwable
    {
            TurtleParser parser = new TurtleParser(new StringReader(testString)) ;
            parser.setEventHandler(new TurtleEventNull()) ;
            parser.getPrefixMapping().setNsPrefix("a", "http://host/a#") ;
            parser.getPrefixMapping().setNsPrefix("x", "http://host/a#") ;
            // Unicode 00E9 is e-acute
            // Unicode 03B1 is alpha
            parser.getPrefixMapping().setNsPrefix("\u00E9", "http://host/e-acute/") ;
View Full Code Here


  protected void dealWithThrowable(final Throwable e, final EvaluationMode mode, final boolean queryOrRif) {
    if (this.dealWithThrowableFromQueryParser(e, mode, queryOrRif)) {
      return;
    }
    if (e instanceof TurtleParseException) {
      final TurtleParseException n3e = (TurtleParseException) e;
      this.displayDataErrorMessage(n3e.getMessage(), false);

      // create the pattern to match
      // and create a matcher against the string
      final Pattern pattern = Pattern.compile("\\[(\\d+):(\\d+)\\]");
      final Matcher matcher = pattern.matcher(n3e.getMessage());

      final Pattern pattern2 = Pattern.compile("Line (\\d+): ");
      final Matcher matcher2 = pattern2.matcher(n3e.getMessage());

      int line = -1;
      int column = -1;

      // try to find the pattern in the message...
View Full Code Here

            parser.setEventHandler(new Turtle2NTriples(System.out)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }
        catch (ParseException ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
        catch (TokenMgrError tErr)
        { throw new TurtleParseException(tErr.getMessage()) ; }

        catch (TurtleParseException ex) { throw ex ; }

        catch (JenaException ex)  { throw new TurtleParseException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            throw new TurtleParseException(err.getMessage() , err) ;
        }
        catch (Throwable th)
        {
            throw new TurtleParseException(th.getMessage(), th) ;
        }
    }
View Full Code Here

            parser.setEventHandler(new Turtle2NTriples(System.out)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }
        catch (ParseException ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
        catch (TokenMgrError tErr)
        { throw new TurtleParseException(tErr.getMessage()) ; }

        catch (TurtleParseException ex) { throw ex ; }

        catch (JenaException ex)  { throw new TurtleParseException(ex.getMessage(), ex) ; }
        catch (Error err)
        {
            throw new TurtleParseException(err.getMessage() , err) ;
        }
        catch (Throwable th)
        {
            throw new TurtleParseException(th.getMessage(), th) ;
        }
    }
View Full Code Here

   
    @Override
    public void runTest()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new TurtleReader() ;
        try {
            if ( baseIRI != null )
                t.read(model, FileManager.get().open(input), baseIRI) ;
            else
                t.read(model, input)
            // "http://www.w3.org/2001/sw/DataAccess/df1/tests/rdfq-results.ttl"

            String syntax = FileUtils.guessLang(output, FileUtils.langNTriple) ;
           
            Model results = FileManager.get().loadModel(output, syntax);
View Full Code Here

   
    @Override
    public void runTest()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new TurtleReader() ;
        try {
            t.read(model, uri) ;
        } catch (TurtleParseException ex)
        {
            throw ex ;   
        }
    }
View Full Code Here

   
    @Override
    public void runTest()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new TurtleReader() ;
        try {
            t.read(model, uri) ;
            fail("Bad syntax test succeed in parsing the file") ;
        } catch (TurtleParseException ex)
        {
            return ;   
        }
View Full Code Here

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

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

    return null;
  }

  public static Map<String, String> retrievePrefixes(final Reader arg0)
      throws ParseException {
    final TurtleParser parser = new TurtleParser(arg0);
    final HashMap<String, String> map = new HashMap<String, String>();
    parser.setEventHandler(new BasicHandler() {

      @Override
      public void prefix(final int arg0, final int arg1,
          final String arg2, final String arg3) {
        map.put(arg2, arg3);
      }

    });
    parser.parse();
    return map;
  }
View Full Code Here

   * bei lexikalischem Fehler wird ein "LE" vor die Fehlermeldung angehaengt
   */
  @Override
  public String handleException(final String document) {
    try {
      final TurtleParser parser = new TurtleParser(new StringReader(
          document));
      parser.setEventHandler(new TurtleEventHandler() {

        @Override
        public void triple(final int line, final int col, final Triple triple) {
        }

        @Override
        public void startFormula(final int line, final int col) {
        }

        @Override
        public void prefix(final int line, final int col, final String prefix, final String iri) {
        }

        @Override
        public void endFormula(final int line, final int col) {
        }
      });
      parser.parse();
      return "NE";

    } catch (final ParseException e1) {
      return "PE " + e1.toString();
    } catch (final Error re) {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.n3.N3JenaWriterCommon

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.