java.lang.Object
org.apache.jena.rdf.model.impl.ModelMakerImpl
- All Implemented Interfaces:
ModelGetter
,ModelMaker
,ModelSource
A ModelMakerImpl implements a ModelMaker over a GraphMaker.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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
.boolean
return 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 bystring
in this ModelSource, if it [still] has one, ornull
if there isn't one.void
removeModel
(String name) Remove the association between the name and the Model.
-
Constructor Details
-
ModelMakerImpl
-
-
Method Details
-
getGraphMaker
Description copied from interface:ModelMaker
Answer a GraphMaker that makes graphs the same way this ModelMaker makes models. In general this will be an underlying GraphMaker.- Specified by:
getGraphMaker
in interfaceModelMaker
-
close
public void close()Description copied from interface:ModelMaker
Close the factory - no more requests need be honoured, and any clean-up can be done.- Specified by:
close
in interfaceModelMaker
-
openModel
-
openModelIfPresent
Description copied from interface:ModelSource
Answer the model named bystring
in this ModelSource, if it [still] has one, ornull
if there isn't one. The ModelSource should not create a fresh model if it doesn't already have one.- Specified by:
openModelIfPresent
in interfaceModelSource
-
openModel
Description copied from interface:ModelMaker
Find an existing Model that this factory knows about under the given name. If such a Model exists, return it. Otherwise, ifstrict
is 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:
openModel
in 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:ModelSource
Answer 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:
openModel
in interfaceModelSource
-
createModel
Description copied from interface:ModelMaker
Create a new Model associated with the given name. If there is no such association, create one and return it. If one exists butstrict
is false, return the associated Model. Otherwise throw an AlreadyExistsException.- Specified by:
createModel
in 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:ModelMaker
Create a Model with the given name if no such model exists. Otherwise, answer the existing model. Equivalent tocreateModel( name, false )
.- Specified by:
createModel
in interfaceModelMaker
-
createModelOver
-
createFreshModel
Description copied from interface:ModelSource
Answer 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:
createFreshModel
in interfaceModelSource
-
createDefaultModel
Description copied from interface:ModelSource
Answer 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:
createDefaultModel
in interfaceModelSource
-
removeModel
Description copied from interface:ModelMaker
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. Throws an exception if there's no such Model. The Model itself is not touched.- Specified by:
removeModel
in interfaceModelMaker
- Parameters:
name
- the name to disassociate
-
hasModel
Description copied from interface:ModelMaker
return true iff the factory has a Model with the given name- Specified by:
hasModel
in 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:ModelMaker
Answer 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:
listModels
in interfaceModelMaker
- Returns:
- an extended iterator over the names of models known to this Maker.
-
getModel
ModelGetter implementation component.- Specified by:
getModel
in interfaceModelGetter
-
getModel
Description copied from interface:ModelGetter
Answer 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:
getModel
in interfaceModelGetter
-