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

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


    public static void parse(String baseURI, InputStream in)
    {
        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()) ; }
        catch (TokenMgrError tErr)
        { throw new TurtleParseException(tErr.getMessage()) ; }
View Full Code Here


   
    public void parse(Graph graph, String baseURI, Reader reader)
    {
        // Nasty things happen if the reader is not UTF-8.
        try {
            TurtleParser parser = new TurtleParser(reader) ;
            parser.setEventHandler(new TurtleRDFGraphInserter(graph)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }

        catch (ParseException | TokenMgrError ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
View Full Code Here

   
    public void parse(Graph graph, String baseURI, Reader reader)
    {
        // Nasty things happen if the reader is not UTF-8.
        try {
            TurtleParser parser = new TurtleParser(reader) ;
            parser.setEventHandler(new TurtleRDFGraphInserter(graph)) ;
            parser.setBaseURI(baseURI) ;
            parser.parse() ;
        }

        catch (ParseException ex)
        { throw new TurtleParseException(ex.getMessage()) ; }
View Full Code Here

    public static void parse(String baseURI, InputStream in)
    {
        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()) ; }
        catch (TokenMgrError tErr)
        { throw new TurtleParseException(tErr.getMessage()) ; }
View Full Code Here

    Test(String s) { super(TestUtils.safeName(s)) ; testString = s ; }
   
    @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/") ;
            parser.getPrefixMapping().setNsPrefix("\u03B1", "http://host/alpha/") ;
            parser.getPrefixMapping().setNsPrefix("", "http://host/") ;
            parser.getPrefixMapping().setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ;
            parser.getPrefixMapping().setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#") ;
            parser.setBaseURI("http://base/") ;
            parser.parse() ;
    }
View Full Code Here

    Test(String s) { super(TestUtils.safeName(s)) ; testString = s ; }
   
    @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/") ;
            parser.getPrefixMapping().setNsPrefix("\u03B1", "http://host/alpha/") ;
            parser.getPrefixMapping().setNsPrefix("", "http://host/") ;
            parser.getPrefixMapping().setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ;
            parser.getPrefixMapping().setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#") ;
            parser.setBaseURI("http://base/") ;
            parser.parse() ;
    }
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.