Package com.hp.hpl.jena.graph.impl

Examples of com.hp.hpl.jena.graph.impl.FileGraph


        }
   
    public Model createFileModel( File fullName, String lang, boolean create, boolean strict )
        {
        NotifyOnClose notify = NotifyOnClose.ignore;
        Graph fileGraph = new FileGraph( notify, fullName, lang, create, strict );
        return ModelFactory.createModelForGraph( fileGraph );
        }
View Full Code Here


        {
        Graph initial = graphWith( "initial hasValue 42; also hasURI hello" );
        Graph extra = graphWith( "extra hasValue 17; also hasURI world" );
        File foo = FileUtils.tempFileName( "fileGraph", ".nt" );
       
        Graph g = new FileGraph( foo, true, true );
        GraphUtil.addInto( g, initial );
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, extra );
        g.getTransactionHandler().commit();
        Graph union = graphWith( "" );
        GraphUtil.addInto(union, initial );
        GraphUtil.addInto(union, extra );
        assertIsomorphic( union, g );
        Model inFile = ModelFactory.createDefaultModel();
View Full Code Here

    public void testTransactionAbort()
        {
        Graph initial = graphWith( "initial hasValue 42; also hasURI hello" );
        Graph extra = graphWith( "extra hasValue 17; also hasURI world" );
        File foo = FileUtils.tempFileName( "fileGraph", ".n3" );
        Graph g = new FileGraph( foo, true, true );
        GraphUtil.addInto( g, initial );
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, extra );
        g.getTransactionHandler().abort();
        assertIsomorphic( initial, g );
        }
View Full Code Here

    public void testTransactionCommitThenAbort()
        {
        Graph initial = graphWith( "A pings B; B pings C" );
        Graph extra = graphWith( "C pingedBy B; fileGraph rdf:type Graph" );
        File foo = FileUtils.tempFileName( "fileGraph", ".nt" );
        Graph g = new FileGraph( foo, true, true );
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, initial );
        g.getTransactionHandler().commit();
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, extra );
        g.getTransactionHandler().abort();
        assertIsomorphic( initial, g );
        Model inFile = ModelFactory.createDefaultModel();
        inFile.read( "file:///" + foo, "N-TRIPLES" );
        assertIsomorphic( initial, inFile.getGraph() );
        }
View Full Code Here

            @Override
            public void notifyClosed( File f )
                { history.add( f ); }
            };
        File file = FileUtils.tempFileName( "fileGraph", ".nt" );
        Graph g = new FileGraph( n, file, true, true );
        assertEquals( new ArrayList<File>(), history );
        g.close();
        assertEquals( oneElementList( file ), history );
        }
View Full Code Here

        @Override
        public void runTest()
            {
            File foo = FileUtils.tempFileName( prefix, suffix );
            Graph original = graphWith( content );
            Graph g = new FileGraph( foo, true, true );
            GraphUtil.addInto( g, original );
            g.close();
            Graph g2 = new FileGraph( foo, false, true );
            assertIsomorphic( original, g2 );
            g2.close();
            }
View Full Code Here

        {
        FileModelAssembler a = new FileModelAssembler();
        File x = FileUtils.tempFileName( "fileModelAssembler", ".n3" );
        Model m = a.createFileModel( x, "N3", true, false, ReificationStyle.Convenient );
        assertInstanceOf( FileGraph.class, m.getGraph() );
        FileGraph fg = (FileGraph) m.getGraph();
        assertEquals( x, fg.name );
        assertSame( ReificationStyle.Convenient, fg.getReifier().getStyle() );
        }
View Full Code Here

        {
        File scratch = FileUtils.getScratchDirectory( "jena-test-FileGraphMaker-already" );
        Graph content = graphWith( "something hasProperty someValue" );
        FileGraphMaker A = new FileGraphMaker( scratch.getPath(), true );
        FileGraphMaker B = new FileGraphMaker( scratch.getPath(), true );
        FileGraph gA = (FileGraph) A.createGraph( "already", true );
        GraphUtil.addInto( gA, content );
        gA.close();
        FileGraph gB = (FileGraph) B.openGraph( "already", false );
        assertIsomorphic( content, gB );
        gB.close();
        gB.delete();
        gA.delete();
        }
View Full Code Here

        {
        Graph initial = graphWith( "initial hasValue 42; also hasURI hello" );
        Graph extra = graphWith( "extra hasValue 17; also hasURI world" );
        File foo = FileUtils.tempFileName( "fileGraph", ".nt" );
       
        Graph g = new FileGraph( foo, true, true );
        GraphUtil.addInto( g, initial );
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, extra );
        g.getTransactionHandler().commit();
        Graph union = graphWith( "" );
        GraphUtil.addInto(union, initial );
        GraphUtil.addInto(union, extra );
        assertIsomorphic( union, g );
        Model inFile = ModelFactory.createDefaultModel();
View Full Code Here

    public void testTransactionAbort()
        {
        Graph initial = graphWith( "initial hasValue 42; also hasURI hello" );
        Graph extra = graphWith( "extra hasValue 17; also hasURI world" );
        File foo = FileUtils.tempFileName( "fileGraph", ".n3" );
        Graph g = new FileGraph( foo, true, true );
        GraphUtil.addInto( g, initial );
        g.getTransactionHandler().begin();
        GraphUtil.addInto( g, extra );
        g.getTransactionHandler().abort();
        assertIsomorphic( initial, g );
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.graph.impl.FileGraph

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.