Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.RDFReader


    private Model parseToModelNTriples(String string)
    {
        StringReader r = new StringReader(string) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderNTriples2() ;
        reader.read(model, r, null) ;
        return model ;
    }
View Full Code Here


    private Model parseToModelRdfJson(String string)
    {
        StringReader r = new StringReader(string) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderRdfJson() ;
        reader.read(model, r, null) ;
        return model ;
    }
View Full Code Here

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

    {
        String s = "_:a <p> 'foo' . " ;
        StringReader r = new StringReader(s) ;
        Model m = ModelFactory.createDefaultModel() ;
       
        RDFReader reader = new JenaReaderNTriples2() ;
        reader.read(m, r, null) ;
        assertEquals(1, m.size()) ;
       
        String x = m.listStatements().next().getSubject().getId().getLabelString() ;
        assertNotEquals(x, "a") ;
       
        // reset - reread -  new bNode.
        r = new StringReader(s) ;
        reader.read(m, r, null) ;
        assertEquals(2, m.size()) ;
    }
View Full Code Here

    protected Model parseToModel(String string)
    {
        StringReader r = new StringReader(string) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderNTriples2() ;
        reader.read(model, r, null) ;
        return model ;
    }
View Full Code Here

   
    @Override
    public void runTest()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new JenaReaderTurtle2() ;
        try {
            if ( baseIRI != null )
            {
                InputStream in =  FileManager.get().open(input) ;
                Reader r = PeekReader.makeUTF8(in) ;
                t.read(model, r, 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 JenaReaderTurtle2() ;
        try {
            t.read(model, uri) ;
        } catch (RiotParseException ex)
        {
            throw ex ;   
        }
    }
View Full Code Here

    {
        String s = "_:a <http://example/p> 'foo' . " ;
        StringReader r = new StringReader(s) ;
        Model m = ModelFactory.createDefaultModel() ;
       
        RDFReader reader = new JenaReaderTurtle2() ;
        readProtected(reader,m, r, null) ;
        assertEquals(1, m.size()) ;
       
        String x = m.listStatements().next().getSubject().getId().getLabelString() ;
        assertNotEquals(x, "a") ;

        // reset - reread - new bNode.
        r = new StringReader(s) ;
        reader.read(m, r, null) ;
        assertEquals(2, m.size()) ;
    }
View Full Code Here

    {
        // Duplicate.
        String s = "_:a <http://example/p> 'foo' . _:a <http://example/p> 'foo' ." ;
        StringReader r = new StringReader(s) ;
        Model m = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderTurtle2() ;
        readProtected(reader,m, r, null) ;
        assertEquals(1, m.size()) ;
    }
View Full Code Here

    }
   
    private void testJenaReaderRdfJson()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new JenaReaderRdfJson() ;
        try {
            if ( baseIRI != null )
            {
                InputStream in =  FileManager.get().open(input) ;
                Reader r = PeekReader.makeUTF8(in) ;
                t.read(model, r, baseIRI) ;
            }
            else
                t.read(model, input)

            Model results = FileManager.get().loadModel(output) ;

            boolean b = model.isIsomorphicWith(results) ;
            if ( !b )
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.RDFReader

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.