Package org.eclipse.rdf4j.model.impl
Class SimpleValueFactory
java.lang.Object
org.eclipse.rdf4j.model.base.AbstractValueFactory
org.eclipse.rdf4j.model.impl.SimpleValueFactory
- All Implemented Interfaces:
ValueFactory
- Direct Known Subclasses:
ValueStore
Default implementation of the
ValueFactory
interface.- Author:
- Arjohn Kampman
-
Constructor Summary
ModifierConstructorDescriptionprotected
Hidden constructor to enforce singleton pattern. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new bNode.createBNode
(String nodeID) Creates a new blank node with the given node identifier.protected Literal
createFPLiteral
(Number value, CoreDatatype.XSD datatype) protected Literal
createFPLiteral
(Number value, IRI datatype) CallscreateNumericLiteral(Number, IRI)
with the supplied value and datatype as parameters.protected Literal
createIntegerLiteral
(Number value, CoreDatatype.XSD datatype) protected Literal
createIntegerLiteral
(Number value, IRI datatype) CallscreateNumericLiteral(Number, IRI)
with the supplied value and datatype as parameters.Creates a new IRI from the supplied string-representation.Creates a new IRI from the supplied namespace and local name.createLiteral
(boolean b) Creates a new xsd:boolean-typed literal representing the specified value.createLiteral
(byte value) CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.BYTE
as parameters.createLiteral
(double value) CallscreateFPLiteral(Number, IRI)
with the supplied value andXSD.DOUBLE
as parameters.createLiteral
(float value) CallscreateFPLiteral(Number, IRI)
with the supplied value andXSD.FLOAT
as parameters.createLiteral
(int value) CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.INT
as parameters.createLiteral
(long value) CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.LONG
as parameters.createLiteral
(short value) CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.SHORT
as parameters.createLiteral
(String value) Creates a new literal with the supplied label.createLiteral
(String value, String language) Creates a new literal with the supplied label and language attribute.createLiteral
(String value, IRI datatype) Creates a new literal with the supplied label and datatype.createLiteral
(BigDecimal bigDecimal) Creates a new literal representing the specified bigDecimal that is typed as an xsd:decimal.createLiteral
(BigInteger bigInteger) Creates a new literal representing the specified bigInteger that is typed as an xsd:integer.createLiteral
(Date date) Converts the suppliedDate
to aXMLGregorianCalendar
, then callsValueFactory.createLiteral(XMLGregorianCalendar)
.createLiteral
(XMLGregorianCalendar calendar) CallsValueFactory.createLiteral(String, IRI)
with the String-value of the supplied calendar and the appropriate datatype as parameters.protected Literal
createNumericLiteral
(Number number, CoreDatatype datatype) protected Literal
createNumericLiteral
(Number number, IRI datatype) Creates specific optimized subtypes of SimpleLiteral for numeric datatypes.createStatement
(Resource subject, IRI predicate, Value object) Creates a new statement with the supplied subject, predicate and object.createStatement
(Resource subject, IRI predicate, Value object, Resource context) Creates a new statement with the supplied subject, predicate and object and associated context.createTriple
(Resource subject, IRI predicate, Value object) Creates a new RDF-star triple with the supplied subject, predicate and object.static SimpleValueFactory
Provide a single shared instance of a SimpleValueFactory.Methods inherited from class org.eclipse.rdf4j.model.base.AbstractValueFactory
createLiteral, createLiteral, createLiteral, createLiteral
-
Constructor Details
-
SimpleValueFactory
protected SimpleValueFactory()Hidden constructor to enforce singleton pattern.
-
-
Method Details
-
getInstance
Provide a single shared instance of a SimpleValueFactory.- Returns:
- a singleton instance of SimpleValueFactory.
-
createIRI
Description copied from interface:ValueFactory
Creates a new IRI from the supplied string-representation.- Specified by:
createIRI
in interfaceValueFactory
- Overrides:
createIRI
in classAbstractValueFactory
- Parameters:
iri
- A string-representation of a IRI.- Returns:
- An object representing the IRI.
-
createIRI
Description copied from interface:ValueFactory
Creates a new IRI from the supplied namespace and local name. Calling this method is funtionally equivalent to callingcreateIRI(namespace+localName)
, but allows the ValueFactory to reuse supplied namespace and local name strings whenever possible. Note that the values returned byIRI.getNamespace()
andIRI.getLocalName()
are not necessarily the same as the values that are supplied to this method.- Specified by:
createIRI
in interfaceValueFactory
- Overrides:
createIRI
in classAbstractValueFactory
- Parameters:
namespace
- The IRI's namespace.localName
- The IRI's local name.
-
createBNode
Description copied from interface:ValueFactory
Creates a new blank node with the given node identifier.- Specified by:
createBNode
in interfaceValueFactory
- Overrides:
createBNode
in classAbstractValueFactory
- Parameters:
nodeID
- The blank node identifier.- Returns:
- An object representing the blank node.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new literal with the supplied label. The return value ofLiteral.getDatatype()
for the returned object must bexsd:string
.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The literal's label, must not be null.- Returns:
- A literal for the specified value.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new literal with the supplied label and language attribute. The return value ofLiteral.getDatatype()
for the returned object must berdf:langString
.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The literal's label, must not be null.language
- The literal's language attribute, must not be null.- Returns:
- A literal for the specified value and language attribute.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new xsd:boolean-typed literal representing the specified value.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
b
- The value for the literal.- Returns:
- An xsd:boolean-typed literal for the specified value.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new literal with the supplied label and datatype.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The literal's label, must not be null.datatype
- The literal's datatype. If it is null, the datatypexsd:string
will be assigned to this literal.- Returns:
- A literal for the specified value and type.
-
createStatement
Description copied from interface:ValueFactory
Creates a new statement with the supplied subject, predicate and object.- Specified by:
createStatement
in interfaceValueFactory
- Overrides:
createStatement
in classAbstractValueFactory
- Parameters:
subject
- The statement's subject.predicate
- The statement's predicate.object
- The statement's object.- Returns:
- The created statement.
-
createStatement
Description copied from interface:ValueFactory
Creates a new statement with the supplied subject, predicate and object and associated context.- Specified by:
createStatement
in interfaceValueFactory
- Overrides:
createStatement
in classAbstractValueFactory
- Parameters:
subject
- The statement's subject.predicate
- The statement's predicate.object
- The statement's object.context
- The statement's context.- Returns:
- The created statement.
-
createTriple
Description copied from interface:ValueFactory
Creates a new RDF-star triple with the supplied subject, predicate and object.- Specified by:
createTriple
in interfaceValueFactory
- Overrides:
createTriple
in classAbstractValueFactory
- Parameters:
subject
- The statement's subject.predicate
- The statement's predicate.object
- The statement's object.- Returns:
- The created triple.
-
createBNode
Description copied from interface:ValueFactory
Creates a new bNode.- Specified by:
createBNode
in interfaceValueFactory
- Overrides:
createBNode
in classAbstractValueFactory
- Returns:
- An object representing the bNode.
-
createLiteral
CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.BYTE
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:byte-typed literal for the specified value.
-
createLiteral
CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.SHORT
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:short-typed literal for the specified value.
-
createLiteral
CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.INT
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:int-typed literal for the specified value.
-
createLiteral
CallscreateIntegerLiteral(Number, IRI)
with the supplied value andXSD.LONG
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:long-typed literal for the specified value.
-
createIntegerLiteral
CallscreateNumericLiteral(Number, IRI)
with the supplied value and datatype as parameters. -
createIntegerLiteral
-
createLiteral
CallscreateFPLiteral(Number, IRI)
with the supplied value andXSD.FLOAT
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:float-typed literal for the specified value.
-
createLiteral
CallscreateFPLiteral(Number, IRI)
with the supplied value andXSD.DOUBLE
as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
value
- The value for the literal.- Returns:
- An xsd:double-typed literal for the specified value.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new literal representing the specified bigInteger that is typed as an xsd:integer.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
bigInteger
- The value for the literal.- Returns:
- An xsd:integer-typed literal for the specified value.
-
createLiteral
Description copied from interface:ValueFactory
Creates a new literal representing the specified bigDecimal that is typed as an xsd:decimal.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
bigDecimal
- The value for the literal.- Returns:
- An xsd:decimal-typed literal for the specified value.
-
createFPLiteral
CallscreateNumericLiteral(Number, IRI)
with the supplied value and datatype as parameters. -
createFPLiteral
-
createNumericLiteral
-
createNumericLiteral
-
createLiteral
CallsValueFactory.createLiteral(String, IRI)
with the String-value of the supplied calendar and the appropriate datatype as parameters.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
calendar
- The value for the literal.- Returns:
- A typed literal for the specified calendar.
- See Also:
-
createLiteral
Converts the suppliedDate
to aXMLGregorianCalendar
, then callsValueFactory.createLiteral(XMLGregorianCalendar)
.- Specified by:
createLiteral
in interfaceValueFactory
- Overrides:
createLiteral
in classAbstractValueFactory
- Parameters:
date
- The value for the literal.- Returns:
- A typed literal for the specified date.
-