public class BigdataValueFactoryImpl extends Object implements BigdataValueFactory
BigdataValue
s and BigdataStatement
s.
Values constructed using this factory do NOT have term identifiers assigned.
Statements constructed using this factory do NOT have statement identifiers
assigned. Those metadata can be resolved against the various indices and then
set on the returned values and statements.Modifier and Type | Field and Description |
---|---|
static String |
NAMESPACE_XSD |
static String |
xsd |
Constructor and Description |
---|
BigdataValueFactoryImpl()
WARNING: Use
getInstance(String) NOT this constructor. |
Modifier and Type | Method and Description |
---|---|
BigdataBNode |
asValue(org.openrdf.model.BNode v)
Strongly typed for
BNode s. |
BigdataLiteral |
asValue(org.openrdf.model.Literal v)
Strongly typed for
Literal s. |
BigdataResource |
asValue(org.openrdf.model.Resource v)
Strongly typed for
Resource s. |
BigdataURI |
asValue(org.openrdf.model.URI v)
Strongly typed for
URI s. |
BigdataValue |
asValue(org.openrdf.model.Value v)
Converts a
Value into a BigdataValue . |
BigdataBNodeImpl |
createBNode()
Returns a new blank node with a globally unique blank node ID based on a
UUID . |
BigdataBNodeImpl |
createBNode(BigdataStatement stmt) |
BigdataBNodeImpl |
createBNode(String id) |
BigdataLiteralImpl |
createLiteral(boolean arg0) |
BigdataLiteralImpl |
createLiteral(byte arg0) |
BigdataLiteralImpl |
createLiteral(byte arg0,
boolean unsigned) |
BigdataLiteralImpl |
createLiteral(Date date) |
BigdataLiteralImpl |
createLiteral(double arg0) |
BigdataLiteralImpl |
createLiteral(float arg0) |
BigdataLiteralImpl |
createLiteral(int arg0) |
BigdataLiteralImpl |
createLiteral(int arg0,
boolean unsigned) |
BigdataLiteralImpl |
createLiteral(long arg0) |
BigdataLiteralImpl |
createLiteral(long arg0,
boolean unsigned) |
BigdataLiteralImpl |
createLiteral(short arg0) |
BigdataLiteralImpl |
createLiteral(short arg0,
boolean unsigned) |
BigdataLiteralImpl |
createLiteral(String label) |
BigdataLiteralImpl |
createLiteral(String label,
String language) |
BigdataLiteralImpl |
createLiteral(String label,
org.openrdf.model.URI datatype) |
BigdataLiteralImpl |
createLiteral(String label,
org.openrdf.model.URI datatype,
String language) |
BigdataLiteralImpl |
createLiteral(XMLGregorianCalendar arg0) |
BigdataStatementImpl |
createStatement(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Create a statement whose
StatementEnum is NOT specified. |
BigdataStatementImpl |
createStatement(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
org.openrdf.model.Resource c)
Create a statement whose
StatementEnum is NOT specified. |
BigdataStatementImpl |
createStatement(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
org.openrdf.model.Resource c,
StatementEnum type)
Create a statement (core impl).
|
BigdataStatementImpl |
createStatement(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
org.openrdf.model.Resource c,
StatementEnum type,
boolean userFlag)
Create a statement (core impl).
|
BigdataURIImpl |
createURI(String uriString) |
BigdataURIImpl |
createURI(String namespace,
String localName) |
BigdataLiteralImpl |
createXSDDateTime(long timestamp) |
static BigdataValueFactory |
getInstance(String namespace)
Return the instance associated with the namespace.
|
String |
getNamespace()
The namespace of the KB instance associated with the value factory.
|
BigdataValueSerializer<BigdataValue> |
getValueSerializer()
An object that can efficiently (de-)serialize
Value s using this
ValueFactory . |
BNodeContextFactory |
newBNodeContext()
Returns a factory that will assign its blank node IDs within a globally
unique namespace.
|
protected String |
nextID()
Returns a blank node identifier (ID) based on a random
UUID . |
void |
remove()
Remove a
BigdataValueFactoryImpl from the canonicalizing mapping. |
String |
toString() |
public static final transient String NAMESPACE_XSD
public static final transient String xsd
public BigdataValueFactoryImpl()
getInstance(String)
NOT this constructor.
WARNING: This constructor provides 'headless' (not associated with any
namespace) instance of the BigdataValueFactory
, which is used for
query/update parsing. It SHOULD NOT be used in code working with
triple-store.
(remove "headless" BigdataValueFactory impl class)
,
(SPARQL Query/Update parser should not use db connection)
public String getNamespace()
BigdataValueFactory
getNamespace
in interface BigdataValueFactory
public static BigdataValueFactory getInstance(String namespace)
Note: This canonicalizing mapping for BigdataValueFactoryImpl
s is
based on the namespace of the LexiconRelation
. This makes the
instances canonical within a JVM instance, which is all that we care
about. The actual assignments of term identifiers to BigdataValue
s is performed by the LexiconRelation
itself and is globally
consistent for a given lexicon.
namespace
- The namespace of the LexiconRelation
.
TODO This method introduces the possibility that two journals
in the same JVM would share the same
BigdataValueFactory
for a kb with the same namespace.
This is doubtless not desired. A workaround is to use the
UUID
of the Journal as part of the namespace of the
KB, which would serve to make sure that all KB instances have
distinct namespaces.public void remove()
BigdataValueFactoryImpl
from the canonicalizing mapping.
Entries in this canonicalizing mapping for a LexiconRelation
MUST
be #remove(String)
ed if the LexiconRelation
is destroyed
in case a distinct lexicon is subsequently creating with the same
namespace. There is no need to discard an entry during abort processing.
remove
in interface BigdataValueFactory
public BNodeContextFactory newBNodeContext()
BigdataValueFactory
BigdataValue
s are
actually created by this factory, it is only the semantics of
blank node ID generation that are overridden.newBNodeContext
in interface BigdataValueFactory
BNodeContextFactory
public BigdataBNodeImpl createBNode()
UUID
.
Note: Since the blank node IDs are random, they tend to be uniformly
distributed across the index partition(s). More efficient ordered writes
may be realized using newBNodeContext()
to obtain a derived
BigdataValueFactory
instance that is specific to a document that
is being loaded into the RDF DB.
createBNode
in interface BigdataValueFactory
createBNode
in interface org.openrdf.model.ValueFactory
newBNodeContext()
public BigdataBNodeImpl createBNode(String id)
createBNode
in interface BigdataValueFactory
createBNode
in interface org.openrdf.model.ValueFactory
public BigdataBNodeImpl createBNode(BigdataStatement stmt)
createBNode
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(String label)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(boolean arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(byte arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(byte arg0, boolean unsigned)
createLiteral
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(short arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(short arg0, boolean unsigned)
createLiteral
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(int arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(int arg0, boolean unsigned)
createLiteral
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(long arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(long arg0, boolean unsigned)
createLiteral
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(float arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(double arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(Date date)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(XMLGregorianCalendar arg0)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createXSDDateTime(long timestamp)
createXSDDateTime
in interface BigdataValueFactory
public BigdataLiteralImpl createLiteral(String label, String language)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(String label, org.openrdf.model.URI datatype)
createLiteral
in interface BigdataValueFactory
createLiteral
in interface org.openrdf.model.ValueFactory
public BigdataLiteralImpl createLiteral(String label, org.openrdf.model.URI datatype, String language)
createLiteral
in interface BigdataValueFactory
public BigdataURIImpl createURI(String uriString)
createURI
in interface BigdataValueFactory
createURI
in interface org.openrdf.model.ValueFactory
public BigdataURIImpl createURI(String namespace, String localName)
createURI
in interface BigdataValueFactory
createURI
in interface org.openrdf.model.ValueFactory
public BigdataStatementImpl createStatement(org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o)
BigdataValueFactory
StatementEnum
is NOT specified.createStatement
in interface BigdataValueFactory
createStatement
in interface org.openrdf.model.ValueFactory
public BigdataStatementImpl createStatement(org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o, org.openrdf.model.Resource c)
BigdataValueFactory
StatementEnum
is NOT specified.createStatement
in interface BigdataValueFactory
createStatement
in interface org.openrdf.model.ValueFactory
public BigdataStatementImpl createStatement(org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o, org.openrdf.model.Resource c, StatementEnum type)
BigdataValueFactory
BigdataValueFactory
using
BigdataValueFactory.asValue(Value)
.createStatement
in interface BigdataValueFactory
s
- The subject.p
- The predicate.o
- The object.c
- The context (optional). Note: When non-null
and statement identifiers are enabled, then this will be a
blank node whose term identifier is the statement identifier.type
- The statement type (optional).public BigdataStatementImpl createStatement(org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o, org.openrdf.model.Resource c, StatementEnum type, boolean userFlag)
BigdataValueFactory
BigdataValueFactory
using
BigdataValueFactory.asValue(Value)
.createStatement
in interface BigdataValueFactory
s
- The subject.p
- The predicate.o
- The object.c
- The context (optional). Note: When non-null
and statement identifiers are enabled, then this will be a
blank node whose term identifier is the statement identifier.type
- The statement type (optional).userFlag
- The user flagpublic final BigdataValue asValue(org.openrdf.model.Value v)
BigdataValueFactory
Value
into a BigdataValue
. If the value is
already a BigdataValue
and it was allocated by this
BigdataValueFactoryImpl
then it is returned unchanged. Otherwise a
new BigdataValue
will be creating using the same data as the
given value and the term identifier on the new BigdataValue
will
be initialized to IRawTripleStore#NULL
.
All BigdataValue
s created by a BigdataValueFactoryImpl
internally store a transient reference to the BigdataValueFactoryImpl
.
This reference is used to decide if a BigdataValue
MIGHT have
been created by a different lexicon (term identifiers generated by
different lexicons CAN NOT be used interchangeably). This has the effect
of protecting against incorrect use of the term identifier with a
database backed by a different lexicon while allowing reuse of the
BigdataValue
s when possible.
asValue
in interface BigdataValueFactory
v
- The value.BigdataValue
with the same data. If the value is
null
then null
is returned.public BigdataValueSerializer<BigdataValue> getValueSerializer()
BigdataValueFactory
Value
s using this
ValueFactory
. When the values are de-serialized they will have a
reference to this BigdataValueFactoryImpl
. That reference can be
used to identify when two BigdataValue
s MIGHT be from different
lexicons.getValueSerializer
in interface BigdataValueFactory
public BigdataResource asValue(org.openrdf.model.Resource v)
BigdataValueFactory
Resource
s.asValue
in interface BigdataValueFactory
public BigdataURI asValue(org.openrdf.model.URI v)
BigdataValueFactory
URI
s.asValue
in interface BigdataValueFactory
public BigdataLiteral asValue(org.openrdf.model.Literal v)
BigdataValueFactory
Literal
s.asValue
in interface BigdataValueFactory
public BigdataBNode asValue(org.openrdf.model.BNode v)
BigdataValueFactory
BNode
s.asValue
in interface BigdataValueFactory
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.