com.bigdata.rdf.internal.impl.uri
Class URIExtensionIV<V extends BigdataURI>

java.lang.Object
  extended by com.bigdata.rdf.internal.impl.AbstractIV<V,T>
      extended by com.bigdata.rdf.internal.impl.AbstractInlineIV<V,T>
          extended by com.bigdata.rdf.internal.impl.AbstractInlineExtensionIV<V,Object>
              extended by com.bigdata.rdf.internal.impl.uri.URIExtensionIV<V>
Type Parameters:
V -
All Implemented Interfaces:
IExtensionIV, IV<V,Object>, IVCache<V,Object>, Serializable, Comparable<IV>, Resource, URI, Value

public class URIExtensionIV<V extends BigdataURI>
extends AbstractInlineExtensionIV<V,Object>
implements URI

Class provides support for fully inline URIs for which a Vocabulary item was registered for the URI namespace . An URIExtensionIV always has the inline and extension bits set. URIExtensionIV are fully inline since the namespace can be materialized from the Vocabulary and the localName is directly inline.

Version:
$Id: URIExtensionIV.java 6116 2012-03-13 20:39:17Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.bigdata.rdf.internal.impl.AbstractIV
flags
 
Constructor Summary
URIExtensionIV(FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV, IV<?,?> namespaceIV)
           
 
Method Summary
 int _compareTo(IV o)
          Compare two IVs having the same intrinsic datatype.
 V asValue(LexiconRelation lex)
          Defer to the ILexiconConfiguration which has specific knowledge of how to generate an RDF value from this general purpose extension IV.
 int byteLength()
          Return the length of the namespace IV plus the length of the localName IV.
 IV<V,Object> clone(boolean clearCache)
          Return a copy of this IV.
 boolean equals(Object o)
          Return true iff the two values are the same point in the same value space.
 IV<BigdataURI,?> getExtensionIV()
          Extension IV is the namespace for the URI.
 Object getInlineValue()
          Return the Java Object corresponding to the inline value.
 String getLocalName()
           
 AbstractLiteralIV<BigdataLiteral,?> getLocalNameIV()
           
 String getNamespace()
           
 int hashCode()
          Return a hash code based on the value of the point in the value space.
 boolean needsMaterialization()
          Even though Literal extension IVs are fully inline (no data in the lexicon indices), we do need materialization to answer the openrdf Literal interface correctly.
 String stringValue()
           
 
Methods inherited from class com.bigdata.rdf.internal.impl.AbstractInlineIV
isInline
 
Methods inherited from class com.bigdata.rdf.internal.impl.AbstractIV
compareTo, encode, flags, getDTE, getInternalDataTypeEnum, getInternalValueTypeEnum, getValue, getValueCache, getVTE, getVTE, hasValue, isBigNumeric, isBNode, isExtension, isExtension, isFixedNumeric, isFloatingPointNumeric, isInline, isLiteral, isNullIV, isNumeric, isResource, isSignedNumeric, isStatement, isUnsignedNumeric, isURI, isVocabulary, setValue, toFlags
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.URI
toString
 

Constructor Detail

URIExtensionIV

public URIExtensionIV(FullyInlineTypedLiteralIV<BigdataLiteral> localNameIV,
                      IV<?,?> namespaceIV)
Parameters:
localNameIV - The IV which represents the localName.
namespaceIV - The IV which represents the namespace. This MUST be a fully inline IV declared by the Vocabulary.
Method Detail

clone

public IV<V,Object> clone(boolean clearCache)
Return a copy of this IV.

Note: This method exists to defeat the hard reference from the IV to the cached BigdataValue in order to avoid a memory leak when the IV is used as the key in a weak value cache whose value is the BigdataValue. Therefore, certain IV implementations MAY return this when they are used for limited collections. The vocabulary IVs are the primary example. For the same reason, we do not need to recursively break the link from the IV to the BigdataValue for IVs which embed other IVs.

Note: The extensionIV and delegateIV are NOT cloned. The rationale is that we are only cloning to break the hard reference from the IV to to cached value. If that needs to be done for the extensionIV and delegateIV, then it will be done separately for those objects when they are inserted into the termsCache.

Specified by:
clone in interface IVCache<V extends BigdataURI,Object>
Parameters:
clearCache - When true the cached reference (if any) will NOT be set on the copy.
Returns:
The copy.
See Also:
(Thread-local cache combined with unbounded thread pools causes effective memory leak)

needsMaterialization

public boolean needsMaterialization()
Even though Literal extension IVs are fully inline (no data in the lexicon indices), we do need materialization to answer the openrdf Literal interface correctly. We cannot properly interpret what the delegate IV means without the materialized value.

Specified by:
needsMaterialization in interface IV<V extends BigdataURI,Object>

getLocalNameIV

public AbstractLiteralIV<BigdataLiteral,?> getLocalNameIV()

getInlineValue

public Object getInlineValue()
Description copied from interface: IV
Return the Java Object corresponding to the inline value.

Specified by:
getInlineValue in interface IV<V extends BigdataURI,Object>
Returns:
The Object.

getExtensionIV

public IV<BigdataURI,?> getExtensionIV()
Extension IV is the namespace for the URI.

Specified by:
getExtensionIV in interface IExtensionIV

hashCode

public int hashCode()
Description copied from class: AbstractIV
Return a hash code based on the value of the point in the value space.

Specified by:
hashCode in interface URI
Specified by:
hashCode in class AbstractIV<V extends BigdataURI,Object>

equals

public boolean equals(Object o)
Description copied from class: AbstractIV
Return true iff the two values are the same point in the same value space. Points in different value spaces (as identified by different datatype URIs) are NOT equal even if they have the same value in the corresponding primitive data type.

Specified by:
equals in interface URI
Specified by:
equals in class AbstractIV<V extends BigdataURI,Object>

_compareTo

public int _compareTo(IV o)
Description copied from class: AbstractIV
Compare two IVs having the same intrinsic datatype.

Specified by:
_compareTo in class AbstractIV<V extends BigdataURI,Object>

byteLength

public int byteLength()
Return the length of the namespace IV plus the length of the localName IV.

Specified by:
byteLength in interface IV<V extends BigdataURI,Object>

asValue

public V asValue(LexiconRelation lex)
Defer to the ILexiconConfiguration which has specific knowledge of how to generate an RDF value from this general purpose extension IV.

If the value is not already cached, then inflate an inline RDF value to a BigdataValue and cache it on a private field.

Note: Query plans are responsible for ensuring that IVs have been materialized before operators are evaluated which invoke this method. This pattern ensures that efficient batch operators are used to materialize Values, and thereby avoids heavy RMI overhead in scale-out, and provides operators which use IVCache.getValue() with a simple method signature which does not require access to the lexicon. Query plans are also responsible for dropping variables once they are no longer needed or, in the case of large values and BLOBs, dropping the cached BigdataValue when possible in order to avoid excess network and heap overhead.

Specified by:
asValue in interface IVCache<V extends BigdataURI,Object>
Parameters:
lex - The lexicon relation (this is required in order to access the BigdataValueFactory for the namespace associated with lexicon when we materialize an inline IV).
Returns:
The corresponding BigdataValue.

stringValue

public String stringValue()
Specified by:
stringValue in interface Value

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface URI

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface URI


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.