java.lang.Object
org.apache.jena.ontology.models.ModelMakerImpl
- All Implemented Interfaces:
ModelGetter,ModelMaker,ModelSource
A ModelMakerImpl implements a ModelMaker over a GraphMaker.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the factory - no more requests need be honoured, and any clean-up can be done.Answer this ModelSource's default model.Answer a Model that satisfies this ModelSource's shape.createModel(String name) Create a Model with the given name if no such model exists.createModel(String name, boolean strict) Create a new Model associated with the given name.createModelOver(String name) Answer a GraphMaker that makes graphs the same way this ModelMaker makes models.ModelGetter implementation component.getModel(String URL, ModelReader loadIfAbsent) Answer a model appropriate forURL, If none is to hand, and it's possible to create one, create it and load it usingloadIfAbsent.booleanreturn true iff the factory has a Model with the given nameAnswer an [extended] iterator where each element is the name of a model in the maker, and the complete sequence exhausts the set of names.Answer a model.Find an existing Model that this factory knows about under the given name.openModelIfPresent(String name) Answer the model named bystringin this ModelSource, if it [still] has one, ornullif there isn't one.voidremoveModel(String name) Remove the association between the name and the Model. create will now be able to create a Model with that name, and open will no longer be able to find it.
-
Constructor Details
-
ModelMakerImpl
-
-
Method Details
-
getGraphMaker
Description copied from interface:ModelMakerAnswer a GraphMaker that makes graphs the same way this ModelMaker makes models. In general this will be an underlying GraphMaker.- Specified by:
getGraphMakerin interfaceModelMaker
-
close
public void close()Description copied from interface:ModelMakerClose the factory - no more requests need be honoured, and any clean-up can be done.- Specified by:
closein interfaceModelMaker
-
openModel
-
openModelIfPresent
Description copied from interface:ModelSourceAnswer the model named bystringin this ModelSource, if it [still] has one, ornullif there isn't one. The ModelSource should not create a fresh model if it doesn't already have one.- Specified by:
openModelIfPresentin interfaceModelSource
-
openModel
Description copied from interface:ModelMakerFind an existing Model that this factory knows about under the given name. If such a Model exists, return it. Otherwise, ifstrictis false, create a new Model, associate it with the name, and return it. Otherwise throw a DoesNotExistException.When called with
strict=false, is equivalent to the ancestoropenModel(String)method.- Specified by:
openModelin interfaceModelMaker- Parameters:
name- the name of the Model to find and returnstrict- false to create a new one if one doesn't already exist
-
openModel
Description copied from interface:ModelSourceAnswer a model. Different ModelSources may implement this in very different ways - ModelSource imposes few constraints other than the result is a proper Model. A ModelSource may use the name to identify an existing Model and re-use it, or it may create a fresh Model each time.It is expected that uses of different names will answer different models (different in the strong sense of not having the same underlying graph, too).
If the ModelSource does not have a model with this name, and if it is not prepared to create one, it should throw a DoesNotExistException. This method never returns
null.- Specified by:
openModelin interfaceModelSource
-
createModel
Description copied from interface:ModelMakerCreate a new Model associated with the given name. If there is no such association, create one and return it. If one exists butstrictis false, return the associated Model. Otherwise throw an AlreadyExistsException.- Specified by:
createModelin interfaceModelMaker- Parameters:
name- the name to give to the new Modelstrict- true to cause existing bindings to throw an exception
-
createModel
Description copied from interface:ModelMakerCreate a Model with the given name if no such model exists. Otherwise, answer the existing model. Equivalent tocreateModel( name, false ).- Specified by:
createModelin interfaceModelMaker
-
createModelOver
-
createFreshModel
Description copied from interface:ModelSourceAnswer a Model that satisfies this ModelSource's shape. Different calls return different models - they are not permitted to return the same model. (Doing this on a database model will create new, pseudo-anonymous, models.) This method never returnsnull.- Specified by:
createFreshModelin interfaceModelSource
-
createDefaultModel
Description copied from interface:ModelSourceAnswer this ModelSource's default model. Every ModelSource has a default model. That model need not exist until the first call on createDefaultModel. Multiple calls of getModel will yield the *same* model. This method never returnsnull.- Specified by:
createDefaultModelin interfaceModelSource
-
removeModel
Description copied from interface:ModelMakerRemove the association between the name and the Model. create will now be able to create a Model with that name, and open will no longer be able to find it. Throws an exception if there's no such Model. The Model itself is not touched.- Specified by:
removeModelin interfaceModelMaker- Parameters:
name- the name to disassociate
-
hasModel
Description copied from interface:ModelMakerreturn true iff the factory has a Model with the given name- Specified by:
hasModelin interfaceModelMaker- Parameters:
name- the name of the Model to look for- Returns:
- true iff there's a Model with that name
-
listModels
Description copied from interface:ModelMakerAnswer an [extended] iterator where each element is the name of a model in the maker, and the complete sequence exhausts the set of names. No particular order is expected from the list.- Specified by:
listModelsin interfaceModelMaker- Returns:
- an extended iterator over the names of models known to this Maker.
-
getModel
ModelGetter implementation component.- Specified by:
getModelin interfaceModelGetter
-
getModel
Description copied from interface:ModelGetterAnswer a model appropriate forURL, If none is to hand, and it's possible to create one, create it and load it usingloadIfAbsent. Otherwise throw CannotCreateException. This method never returns null.- Specified by:
getModelin interfaceModelGetter
-