1 6 7 package com.hp.hpl.jena.rdf.model.impl; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.rdf.model.*; 11 import com.hp.hpl.jena.util.iterator.*; 12 13 16 public class ModelMakerImpl implements ModelMaker 17 { 18 protected GraphMaker maker; 19 protected Model description; 20 21 public ModelMakerImpl( GraphMaker maker ) 22 { this.maker = maker; } 23 24 public GraphMaker getGraphMaker() 25 { return maker; } 26 27 public void close() 28 { maker.close(); } 29 30 protected Model makeModel( Graph g ) 31 { return new ModelCom( g ); } 32 33 public Model openModelIfPresent( String name ) 34 { return maker.hasGraph( name ) ? openModel( name ) : null; } 35 36 public Model openModel( String name, boolean strict ) 37 { return makeModel( maker.openGraph( name, strict ) ); } 38 39 public Model openModel( String name ) 40 { return openModel( name, false ); } 41 42 public Model createModel( String name, boolean strict ) 43 { return makeModel( maker.createGraph( name, strict ) ); } 44 45 public Model createModel( String name ) 46 { return createModel( name, false ); } 47 48 public Model createModelOver( String name ) 49 { return createModel( name ); } 50 51 public Model createModel() 52 { return makeModel( maker.createGraph() ); } 53 54 public Model getModel() 55 { return makeModel( maker.getGraph() ); } 56 57 public Model getDescription() 58 { 59 if (description == null) description = makeModel( maker.getDescription() ); 60 return description; 61 } 62 63 public Model getDescription( Resource root ) 64 { return makeModel( maker.getDescription( root.asNode() ) ); } 65 66 public Model addDescription( Model m, Resource self ) 67 { return makeModel( maker.addDescription( m.getGraph(), self.asNode() ) ); } 68 69 public void removeModel( String name ) 70 { maker.removeGraph( name ); } 71 72 public boolean hasModel( String name ) 73 { return maker.hasGraph( name ); } 74 75 public ExtendedIterator listModels() 76 { return maker.listGraphs(); } 77 } 78 79 | Popular Tags |