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 Personalityto the existing internal collection.build()Builds a new personality configuration.copy()Makes a full copy of this builder.static OntObjectPersonalityBuilderfrom(OntPersonality from) Makes a full copy of the givenOntPersonalityin 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 givenOntPersonalityin the form of modifiablebuilder.- Parameters:
from-OntPersonalityto 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 specifiedfactorywith the specifiedobjecttype. If the builder previously contained a mapping for the object type, the old factory is replaced by the specified factory.Note: the
factorymust not explicitly refer to another factory, instead it may contain implicit references throughOntEnhGraph.asPersonalityModel(EnhGraph)method. For example, if you need a check, that somenodeis 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-EnhNodeFactorythe factory to produce the instances of thetype- Returns:
- this builder
-
add
public OntObjectPersonalityBuilder add(Class<? extends OntObject> type, Function<OntConfig, EnhNodeFactory> factory) Associates the specifiedfactoryproducer with the specifiedobjecttype. If the builder previously contained a mapping for the object type, the old factory is replaced by the specified factory.Note: the
factorymust not explicitly refer to another factory, instead it may contain implicit references throughOntEnhGraph.asPersonalityModel(EnhGraph)method. For example, if you need a check, that somenodeis 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, providingEnhNodeFactoryby 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 Personalityto the existing internal collection.- Parameters:
from-Personalitywith 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
-