public class Values extends Object
Value
objects ( IRI
, Literal
, BNode
, and
Triple
) without having to create a ValueFactory
first.
Example usage:
import static org.eclipse.rdf4j.model.util.Values.iri; ... IRI foo = iri("http://example.org/foo");
Statements
Modifier and Type | Method and Description |
---|---|
static BNode |
bnode()
Creates a new
BNode |
static BNode |
bnode(String nodeId)
Creates a new
BNode with the supplied node identifier. |
static BNode |
bnode(ValueFactory vf)
Creates a new
BNode |
static BNode |
bnode(ValueFactory vf,
String nodeId)
Creates a new
BNode with the supplied node identifier. |
static ValueFactory |
getValueFactory()
Get a
ValueFactory . |
static IRI |
iri(String iri)
Create a new
IRI using the supplied iri string |
static IRI |
iri(String namespace,
String localName)
Create a new
IRI using the supplied namespace and local name |
static IRI |
iri(ValueFactory vf,
String iri)
Create a new
IRI using the supplied iri string |
static IRI |
iri(ValueFactory vf,
String namespace,
String localName)
Create a new
IRI using the supplied namespace and local name |
static Literal |
literal(BigDecimal bigDecimal)
Creates a new
Literal with the supplied BigDecimal value |
static Literal |
literal(BigInteger bigInteger)
Creates a new
Literal with the supplied BigInteger value |
static Literal |
literal(boolean booleanValue)
Creates a new
Literal with the supplied boolean value |
static Literal |
literal(byte byteValue)
Creates a new
Literal with the supplied byte value |
static Literal |
literal(double doubleValue)
Creates a new
Literal with the supplied double value |
static Literal |
literal(float floatValue)
Creates a new
Literal with the supplied float value |
static Literal |
literal(int intValue)
Creates a new
Literal with the supplied int value |
static Literal |
literal(long longValue)
Creates a new
Literal with the supplied long value |
static Literal |
literal(Object object)
|
static Literal |
literal(Object object,
boolean failOnUnknownType)
|
static Literal |
literal(short shortValue)
Creates a new
Literal with the supplied short value |
static Literal |
literal(String lexicalValue)
Creates a new
Literal with the supplied lexical value. |
static Literal |
literal(String lexicalValue,
IRI datatype)
Creates a new
Literal with the supplied lexical value and datatype. |
static Literal |
literal(java.time.temporal.TemporalAccessor value)
Creates a new
Literal with the supplied TemporalAccessor value |
static Literal |
literal(ValueFactory vf,
BigDecimal bigDecimal)
Creates a new
Literal with the supplied BigDecimal value |
static Literal |
literal(ValueFactory vf,
BigInteger bigInteger)
Creates a new
Literal with the supplied BigInteger value |
static Literal |
literal(ValueFactory vf,
boolean booleanValue)
Creates a new
Literal with the supplied boolean value |
static Literal |
literal(ValueFactory vf,
byte byteValue)
Creates a new
Literal with the supplied byte value |
static Literal |
literal(ValueFactory vf,
double doubleValue)
Creates a new
Literal with the supplied double value |
static Literal |
literal(ValueFactory vf,
float floatValue)
Creates a new
Literal with the supplied float value |
static Literal |
literal(ValueFactory vf,
int intValue)
Creates a new
Literal with the supplied int value |
static Literal |
literal(ValueFactory vf,
long longValue)
Creates a new
Literal with the supplied long value |
static Literal |
literal(ValueFactory vf,
Object object,
boolean failOnUnknownType)
|
static Literal |
literal(ValueFactory vf,
short shortValue)
Creates a new
Literal with the supplied short value |
static Literal |
literal(ValueFactory vf,
String lexicalValue)
Creates a new
Literal with the supplied lexical value. |
static Literal |
literal(ValueFactory vf,
String lexicalValue,
IRI datatype)
Creates a new
Literal with the supplied lexical value and datatype. |
static Literal |
literal(ValueFactory vf,
java.time.temporal.TemporalAccessor value)
Creates a new
Literal with the supplied TemporalAccessor value |
static Triple |
triple(Resource subject,
IRI predicate,
Value object)
Creates a new
RDF* embedded triple with the supplied subject, predicate, and object. |
static Triple |
triple(Statement statement)
Creates a new
RDF* embedded triple using the subject, predicate and object from the supplied
Statement . |
static Triple |
triple(ValueFactory vf,
Resource subject,
IRI predicate,
Value object)
Creates a new
RDF* embedded triple with the supplied subject, predicate, and object. |
static Triple |
triple(ValueFactory vf,
Statement statement)
Creates a new
RDF* embedded triple using the subject, predicate and object from the supplied
Statement . |
public static IRI iri(String iri) throws IllegalArgumentException
IRI
using the supplied iri stringiri
- a string representing a valid (absolute) iriIRI
object for the supplied iri string.NullPointerException
- if the suppplied iri is null
IllegalArgumentException
- if the supplied iri string can not be parsed as a legal IRI.public static IRI iri(ValueFactory vf, String iri) throws IllegalArgumentException
IRI
using the supplied iri stringvf
- the ValueFactory
to use for creation of the IRI.iri
- a string representing a valid (absolute) iriIRI
object for the supplied iri string.NullPointerException
- if any of the input parameters is null
IllegalArgumentException
- if the supplied iri string can not be parsed as a legal IRI by the supplied
ValueFactory
.public static IRI iri(String namespace, String localName) throws IllegalArgumentException
IRI
using the supplied namespace and local namenamespace
- the IRI's namespacelocalName
- the IRI's local nameIRI
object for the supplied IRI namespace and localName.NullPointerException
- if any of the input parameters is null
IllegalArgumentException
- if the supplied iri string can not be parsed as a legal IRI.public static IRI iri(ValueFactory vf, String namespace, String localName) throws IllegalArgumentException
IRI
using the supplied namespace and local namevf
- the ValueFactory
to use for creation of the IRI.namespace
- the IRI's namespacelocalName
- the IRI's local nameIRI
object for the supplied IRI namespace and localName.NullPointerException
- if any of the input parameters is null
IllegalArgumentException
- if the supplied iri string can not be parsed as a legal IRI by the supplied
ValueFactory
public static BNode bnode(ValueFactory vf)
BNode
vf
- the ValueFactory
to use for creation of the BNode
BNode
NullPointerException
- if any of the input parameters is null
public static BNode bnode(String nodeId) throws IllegalArgumentException
BNode
with the supplied node identifier.nodeId
- the node identifierBNode
NullPointerException
- if the supplied node identifier is null
.IllegalArgumentException
- if the supplied node identifier is not validpublic static BNode bnode(ValueFactory vf, String nodeId) throws IllegalArgumentException
BNode
with the supplied node identifier.vf
- the ValueFactory
to use for creation of the BNode
nodeId
- the node identifierBNode
NullPointerException
- if any of the input parameters is null
IllegalArgumentException
- if the supplied node identifier is not validpublic static Literal literal(String lexicalValue)
Literal
with the supplied lexical value.lexicalValue
- the lexical value for the literalLiteral
of type XSD.STRING
NullPointerException
- if the supplied lexical value is null
.public static Literal literal(ValueFactory vf, String lexicalValue)
Literal
with the supplied lexical value.vf
- the ValueFactory
to use for creation of the Literal
lexicalValue
- the lexical value for the literalLiteral
of type XSD.STRING
NullPointerException
- if any of the input parameters is null
public static Literal literal(String lexicalValue, IRI datatype) throws IllegalArgumentException
Literal
with the supplied lexical value and datatype.lexicalValue
- the lexical value for the literaldatatype
- the datatype URILiteral
with the supplied lexical value and datatypeNullPointerException
- if the supplied lexical value or datatype is null
.IllegalArgumentException
- if the supplied lexical value is not valid for the given datatypepublic static Literal literal(ValueFactory vf, String lexicalValue, IRI datatype) throws IllegalArgumentException
Literal
with the supplied lexical value and datatype.vf
- the ValueFactory
to use for creation of the Literal
lexicalValue
- the lexical value for the literaldatatype
- the datatype URILiteral
with the supplied lexical value and datatypeNullPointerException
- if any of the input parameters is null
.IllegalArgumentException
- if the supplied lexical value is not valid for the given datatypepublic static Literal literal(boolean booleanValue)
Literal
with the supplied boolean valuebooleanValue
- a boolean valueLiteral
of type XSD.BOOLEAN
with the supplied valuepublic static Literal literal(ValueFactory vf, boolean booleanValue)
Literal
with the supplied boolean valuevf
- the ValueFactory
to use for creation of the Literal
booleanValue
- a boolean valueLiteral
of type XSD.BOOLEAN
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(byte byteValue)
Literal
with the supplied byte valuepublic static Literal literal(ValueFactory vf, byte byteValue)
Literal
with the supplied byte valuevf
- the ValueFactory
to use for creation of the Literal
byteValue
- a byte valueLiteral
of type XSD.BYTE
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(short shortValue)
Literal
with the supplied short valuepublic static Literal literal(ValueFactory vf, short shortValue)
Literal
with the supplied short valuevf
- the ValueFactory
to use for creation of the Literal
shortValue
- a short valueLiteral
of type XSD.SHORT
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(int intValue)
Literal
with the supplied int valuepublic static Literal literal(ValueFactory vf, int intValue)
Literal
with the supplied int valuevf
- the ValueFactory
to use for creation of the Literal
intValue
- an int valueLiteral
of type XSD.INT
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(long longValue)
Literal
with the supplied long valuepublic static Literal literal(ValueFactory vf, long longValue)
Literal
with the supplied long valuevf
- the ValueFactory
to use for creation of the Literal
longValue
- a long valueLiteral
of type XSD.LONG
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(float floatValue)
Literal
with the supplied float valuepublic static Literal literal(ValueFactory vf, float floatValue)
Literal
with the supplied float valuevf
- the ValueFactory
to use for creation of the Literal
floatValue
- a float valueLiteral
of type XSD.FLOAT
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(double doubleValue)
Literal
with the supplied double valuedoubleValue
- a double valueLiteral
of type XSD.DOUBLE
with the supplied valuepublic static Literal literal(ValueFactory vf, double doubleValue)
Literal
with the supplied double valuevf
- the ValueFactory
to use for creation of the Literal
doubleValue
- a double valueLiteral
of type XSD.DOUBLE
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(BigDecimal bigDecimal)
Literal
with the supplied BigDecimal
valuebigDecimal
- a BigDecimal
valueLiteral
of type XSD.DECIMAL
with the supplied valueNullPointerException
- if the supplied bigDecimal is null
.public static Literal literal(ValueFactory vf, BigDecimal bigDecimal)
Literal
with the supplied BigDecimal
valuevf
- the ValueFactory
to use for creation of the Literal
bigDecimal
- a BigDecimal
valueLiteral
of type XSD.DECIMAL
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(BigInteger bigInteger)
Literal
with the supplied BigInteger
valuebigInteger
- a BigInteger
valueLiteral
of type XSD.INTEGER
with the supplied valueNullPointerException
- if the supplied bigInteger is null
.public static Literal literal(ValueFactory vf, BigInteger bigInteger)
Literal
with the supplied BigInteger
valuevf
- the ValueFactory
to use for creation of the Literal
bigInteger
- a BigInteger
valueLiteral
of type XSD.INTEGER
with the supplied valueNullPointerException
- if any of the input parameters is null
.public static Literal literal(java.time.temporal.TemporalAccessor value) throws IllegalArgumentException
Literal
with the supplied TemporalAccessor
valuevalue
- a TemporalAccessor
value.Literal
with the supplied calendar value and the appropriate XSD
date/time datatype for
the specific value.NullPointerException
- if the supplied TemporalAccessor
value is null
.IllegalArgumentException
- if value cannot be represented by an XML Schema date/time datatypepublic static Literal literal(ValueFactory vf, java.time.temporal.TemporalAccessor value) throws IllegalArgumentException
Literal
with the supplied TemporalAccessor
valuevf
- the ValueFactory
to use for creation of the Literal
value
- a TemporalAccessor
value.Literal
with the supplied calendar value and the appropriate XSD
date/time datatype for
the specific value.NullPointerException
- if any of the input parameters is null
..IllegalArgumentException
- if value cannot be represented by an XML Schema date/time datatypepublic static Literal literal(Object object)
Literal
out of the supplied object, mapping the runtime type of the object to the
appropriate XSD
datatype. If no mapping is available, the method returns a literal with the string
representation of the supplied object as the value, and XSD.STRING
as the datatype.
Recognized types are Boolean
, Byte
, Double
, Float
, Integer
, Long
,
Short
, XMLGregorianCalendar
, TemporalAccessor
and Date
.
object
- an object to be converted to a typed literal.NullPointerException
- if the input parameter is null
..public static Literal literal(Object object, boolean failOnUnknownType)
Literal
out of the supplied object, mapping the runtime type of the object to the
appropriate XSD
datatype.
Recognized types are Boolean
, Byte
, Double
, Float
, Integer
, Long
,
Short
, XMLGregorianCalendar
, TemporalAccessor
and Date
.
object
- an object to be converted to a typed literal.failOnUnknownType
- If no mapping is available and failOnUnknownType
is false
the
method returns a literal with the string representation of the supplied object as the
value, and XSD.STRING
as the datatype. If set to true
the method
throws an IllegalArgumentException
if no mapping available.NullPointerException
- if the input parameter is null
..public static Literal literal(ValueFactory vf, Object object, boolean failOnUnknownType)
Literal
out of the supplied object, mapping the runtime type of the object to the
appropriate XSD
datatype.
Recognized types are Boolean
, Byte
, Double
, Float
, Integer
, Long
,
Short
, XMLGregorianCalendar
, TemporalAccessor
and Date
.
valueFactory
- the ValueFactory
to use for creation of the Literal
object
- an object to be converted to a typed literal.failOnUnknownType
- If no mapping is available and failOnUnknownType
is false
the
method returns a literal with the string representation of the supplied object as the
value, and XSD.STRING
as the datatype. If set to true
the method
throws an IllegalArgumentException
if no mapping available.NullPointerException
- if any of the input parameters is null
.IllegalArgumentException
- if failOnUnknownType
is set to true
and the runtime
type of the supplied object could not be mapped.public static Triple triple(Resource subject, IRI predicate, Value object)
RDF* embedded triple
with the supplied subject, predicate, and object.subject
- the Triple subjectpredicate
- the Triple predicateobject
- the Triple objectTriple
with the supplied subject, predicate, and object.NullPointerException
- if any of the supplied input parameters is null
.public static Triple triple(ValueFactory vf, Resource subject, IRI predicate, Value object)
RDF* embedded triple
with the supplied subject, predicate, and object.vf
- the ValueFactory
to use for creation of the Triple
subject
- the Triple subjectpredicate
- the Triple predicateobject
- the Triple objectTriple
with the supplied subject, predicate, and object.NullPointerException
- if any of the supplied input parameters is null
.public static Triple triple(Statement statement)
RDF* embedded triple
using the subject, predicate and object from the supplied
Statement
.statement
- the Statement
from which to construct a Triple
Triple
with the same subject, predicate, and object as the supplied Statement.NullPointerException
- if statement is null
.public static Triple triple(ValueFactory vf, Statement statement)
RDF* embedded triple
using the subject, predicate and object from the supplied
Statement
.vf
- the ValueFactory
to use for creation of the Triple
statement
- the Statement
from which to construct a Triple
Triple
with the same subject, predicate, and object as the supplied Statement.NullPointerException
- if any of the supplied input parameters is null
.public static ValueFactory getValueFactory()
ValueFactory
.ValueFactory
.Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.