Package com.hp.hpl.jena.n3.turtle

Examples of com.hp.hpl.jena.n3.turtle.Turtle2NTriples


    }
   
    // A test for resolved names that depend on where the tests are run.
    private void execTestMatch(String u, String base, String resultPattern)
    {
        IRIResolver resolver = new IRIResolver(base) ;
        String res = resolver.resolve(u) ;

        if (resultPattern == null )
        {
            assertNull("("+u+","+base+") => <null> :: Got: "+res, res) ;
            return ;
View Full Code Here


   
    private void execException(String u, String base, Class<?> ex)
    {
        String s = ex.getSimpleName() ;
        try {
            IRIResolver resolver = new IRIResolver(base) ;
            String res = resolver.resolve(u) ;
            if ( res == null )
                fail("("+u+","+base+") => <null> :: Expected exception: " +s) ;
            else
                fail("("+u+","+base+") => "+res+" :: Expected exception: " +s) ;
        } catch (Exception ex2)
View Full Code Here

    }
    private void execException(String base, Class<?> ex)
    {
        String s = ex.getSimpleName() ;
        try {
            new IRIResolver(base) ;
                 fail("("+base+") => OK :: Expected exception: " +s) ;
        } catch (Exception ex2)
        {
            // Shoudl test whether ex2 is a subclass of ex
            assertEquals(ex, ex2.getClass()) ;
View Full Code Here

    public void usePrologueFrom(Prologue other)
    {
        prefixMap = new PrefixMapping2(other.prefixMap) ;
        seenBaseURI = false ;
        if ( other.resolver != null )
            resolver = new IRIResolver(other.resolver.getBaseIRI()) ;
    }
View Full Code Here

        // New prefix mappings
        PrefixMapping ext = getPrefixMapping() ;
        if ( newMappings != null )
            ext = new PrefixMapping2(ext, newMappings) ;
        // New base.
        IRIResolver r = resolver ;
        if ( base != null )
            r = new IRIResolver(base) ;
        return new Prologue(ext, r) ;
    }
View Full Code Here

     * @param baseURI The baseURI to set.
     */
    public void setBaseURI(String baseURI)
    {
        this.seenBaseURI = true ;
        this.resolver = new IRIResolver(baseURI) ;
    }
View Full Code Here

    {
        Reader reader = FileUtils.asUTF8(in) ;
        try {
            TurtleParser parser = new TurtleParser(reader) ;
            //parser.setEventHandler(new TurtleEventDump()) ;
            parser.setEventHandler(new Turtle2NTriples(System.out)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }
        catch (ParseException ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
View Full Code Here

    {
        Reader reader = FileUtils.asUTF8(in) ;
        try {
            TurtleParser parser = new TurtleParser(reader) ;
            //parser.setEventHandler(new TurtleEventDump()) ;
            parser.setEventHandler(new Turtle2NTriples(System.out)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }
        catch (ParseException ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
View Full Code Here

  @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) {
        }
View Full Code Here

   
    @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

TOP

Related Classes of com.hp.hpl.jena.n3.turtle.Turtle2NTriples

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.