Module org.apache.jena.ontapi
Package org.apache.jena.ontapi.common
Class OntObjectPersonalityBuilder
java.lang.Object
org.apache.jena.ontapi.common.OntObjectPersonalityBuilder
An
OntPersonality
builder.
This must be the only place to create various OntPersonality
objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(Class<? extends OntObject> type, EnhNodeFactory factory) add
(OntObjectPersonalityBuilder other) Adds all factories from the specified builder.addPersonality
(org.apache.jena.enhanced.Personality<org.apache.jena.rdf.model.RDFNode> from) Adds everything from the specifiedJena Personality
to the existing internal collection.build()
Builds a new personality configuration.copy()
Makes a full copy of this builder.static OntObjectPersonalityBuilder
from
(OntPersonality from) Makes a full copy of the givenOntPersonality
in the form of modifiablebuilder
.Removes object factory.setBuiltins
(OntPersonality.Builtins builtins) Sets a new builtins personality vocabulary.Sets config, which controls OntModel behaviour.Sets identifier of language profile ("OWL", "RDF").setPunnings
(OntPersonality.Punnings punnings) Sets a new punnings personality vocabulary.setReserved
(OntPersonality.Reserved reserved) Sets a new reserved personality vocabulary.
-
Constructor Details
-
OntObjectPersonalityBuilder
public OntObjectPersonalityBuilder()
-
-
Method Details
-
from
Makes a full copy of the givenOntPersonality
in the form of modifiablebuilder
.- Parameters:
from
-OntPersonality
to copy settings, notnull
- Returns:
OntObjectPersonalityBuilder
-
copy
Makes a full copy of this builder.- Returns:
OntObjectPersonalityBuilder
, a copy
-
add
Adds all factories from the specified builder.- Parameters:
other
-OntObjectPersonalityBuilder
- Returns:
- this builder
-
add
Associates the specifiedfactory
with the specifiedobject
type. If the builder previously contained a mapping for the object type, the old factory is replaced by the specified factory.Note: the
factory
must not explicitly refer to another factory, instead it may contain implicit references throughOntEnhGraph.asPersonalityModel(EnhGraph)
method. For example, if you need a check, that somenode
is an OWL-Class inside your factory, you can useOntEnhGraph.canAs(Class, Node, EnhGraph)
with the typeOntClass.Named
.- Parameters:
type
-Class
-type of the concreteOntObject
.factory
-EnhNodeFactory
the factory to produce the instances of thetype
- Returns:
- this builder
-
add
public OntObjectPersonalityBuilder add(Class<? extends OntObject> type, Function<OntConfig, EnhNodeFactory> factory) Associates the specifiedfactory
producer with the specifiedobject
type. If the builder previously contained a mapping for the object type, the old factory is replaced by the specified factory.Note: the
factory
must not explicitly refer to another factory, instead it may contain implicit references throughOntEnhGraph.asPersonalityModel(EnhGraph)
method. For example, if you need a check, that somenode
is an OWL-Class inside your factory, you can useOntEnhGraph.canAs(Class, Node, EnhGraph)
with the typeOntClass.Named
.- Parameters:
type
-Class
-type of the concreteOntObject
.factory
-Function
, providingEnhNodeFactory
by theOntConfig
- Returns:
- this builder
-
remove
Removes object factory.- Parameters:
type
-Class
-type ofOntObject
- Returns:
- this builder
-
addPersonality
public OntObjectPersonalityBuilder addPersonality(org.apache.jena.enhanced.Personality<org.apache.jena.rdf.model.RDFNode> from) Adds everything from the specifiedJena Personality
to the existing internal collection.- Parameters:
from
-Personality
with generic typeRDFNode
, notnull
- Returns:
- this builder
- See Also:
-
Personality.add(Personality)
-
setName
Sets identifier of language profile ("OWL", "RDF").- Parameters:
profileName
- String, can benull
- Returns:
- this builder
-
setPunnings
Sets a new punnings personality vocabulary.- Parameters:
punnings
-OntPersonality.Punnings
, notnull
- Returns:
- this builder
-
setBuiltins
Sets a new builtins personality vocabulary.- Parameters:
builtins
-OntPersonality.Builtins
, notnull
- Returns:
- this builder
-
setReserved
Sets a new reserved personality vocabulary.- Parameters:
reserved
-OntPersonality.Reserved
, notnull
- Returns:
- this builder
-
setConfig
Sets config, which controls OntModel behaviour.- Parameters:
config
-OntConfig
, notnull
- Returns:
- this builder
-
build
Builds a new personality configuration.- Returns:
OntPersonality
, fresh instance- Throws:
IllegalStateException
- in case the builder does not contain require components
-