org.openrdf.model.impl
Class ValueFactoryBase

java.lang.Object
  extended by org.openrdf.model.impl.ValueFactoryBase
All Implemented Interfaces:
ValueFactory
Direct Known Subclasses:
MemValueFactory, RdbmsValueFactory, ValueFactoryImpl, ValueStore

public abstract class ValueFactoryBase
extends Object
implements ValueFactory

Abstract base class for ValueFactory implementations that implements the utility methods for creating literals for basic types by calling the generic ValueFactory.createLiteral(String, URI) with the appropriate value and datatype.

Author:
Arjohn Kampman

Constructor Summary
ValueFactoryBase()
           
 
Method Summary
 BNode createBNode()
          Creates a new bNode.
protected  Literal createFPLiteral(Number value, URI datatype)
          Calls createNumericLiteral(Number, URI) with the supplied value and datatype as parameters.
protected  Literal createIntegerLiteral(Number value, URI datatype)
          Calls createNumericLiteral(Number, URI) with the supplied value and datatype as parameters.
 Literal createLiteral(boolean b)
          Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied value and XMLSchema.BOOLEAN as parameters.
 Literal createLiteral(byte value)
          Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.BYTE as parameters.
 Literal createLiteral(double value)
          Calls createFPLiteral(Number, URI) with the supplied value and XMLSchema.DOUBLE as parameters.
 Literal createLiteral(float value)
          Calls createFPLiteral(Number, URI) with the supplied value and XMLSchema.FLOAT as parameters.
 Literal createLiteral(int value)
          Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.INT as parameters.
 Literal createLiteral(long value)
          Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.LONG as parameters.
 Literal createLiteral(short value)
          Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.SHORT as parameters.
 Literal createLiteral(XMLGregorianCalendar calendar)
          Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied calendar and the appropriate datatype as parameters.
protected  Literal createNumericLiteral(Number number, URI datatype)
          Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied number and the supplied datatype as parameters.
protected  void initBNodeParams()
          Generates a new bnode prefix based on currentTimeMillis() and resets _nextBNodeID to 1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.ValueFactory
createBNode, createLiteral, createLiteral, createLiteral, createStatement, createStatement, createURI, createURI
 

Constructor Detail

ValueFactoryBase

public ValueFactoryBase()
Method Detail

initBNodeParams

protected void initBNodeParams()
Generates a new bnode prefix based on currentTimeMillis() and resets _nextBNodeID to 1.


createBNode

public BNode createBNode()
Description copied from interface: ValueFactory
Creates a new bNode.

Specified by:
createBNode in interface ValueFactory
Returns:
An object representing the bNode.

createLiteral

public Literal createLiteral(boolean b)
Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied value and XMLSchema.BOOLEAN as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
b - The value for the literal.
Returns:
An xsd:boolean-typed literal for the specified value.

createLiteral

public Literal createLiteral(byte value)
Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.BYTE as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:byte-typed literal for the specified value.

createLiteral

public Literal createLiteral(short value)
Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.SHORT as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:short-typed literal for the specified value.

createLiteral

public Literal createLiteral(int value)
Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.INT as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:int-typed literal for the specified value.

createLiteral

public Literal createLiteral(long value)
Calls #createIntegerLiteral(long, URI) with the supplied value and XMLSchema.LONG as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:long-typed literal for the specified value.

createIntegerLiteral

protected Literal createIntegerLiteral(Number value,
                                       URI datatype)
Calls createNumericLiteral(Number, URI) with the supplied value and datatype as parameters.


createLiteral

public Literal createLiteral(float value)
Calls createFPLiteral(Number, URI) with the supplied value and XMLSchema.FLOAT as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:float-typed literal for the specified value.

createLiteral

public Literal createLiteral(double value)
Calls createFPLiteral(Number, URI) with the supplied value and XMLSchema.DOUBLE as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
value - The value for the literal.
Returns:
An xsd:double-typed literal for the specified value.

createFPLiteral

protected Literal createFPLiteral(Number value,
                                  URI datatype)
Calls createNumericLiteral(Number, URI) with the supplied value and datatype as parameters.


createNumericLiteral

protected Literal createNumericLiteral(Number number,
                                       URI datatype)
Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied number and the supplied datatype as parameters.


createLiteral

public Literal createLiteral(XMLGregorianCalendar calendar)
Calls ValueFactory.createLiteral(String, URI) with the String-value of the supplied calendar and the appropriate datatype as parameters.

Specified by:
createLiteral in interface ValueFactory
Parameters:
calendar - The value for the literal.
Returns:
An typed literal for the specified calendar.
See Also:
XMLGregorianCalendar.toXMLFormat(), XMLGregorianCalendar.getXMLSchemaType(), XMLDatatypeUtil.qnameToURI(javax.xml.namespace.QName)


Copyright © 2001-2008 Aduna. All Rights Reserved.