org.openanzo.common.rdb.query
Class Literal

java.lang.Object
  extended by org.openanzo.common.rdb.query.Literal
All Implemented Interfaces:
IRdbTerm, ILiteralTerm, IPlainLiteralTerm, ITypedLiteralTerm, RDFTerm, TriplePatternComponent

public class Literal
extends java.lang.Object
implements IRdbTerm, ILiteralTerm, IPlainLiteralTerm, ITypedLiteralTerm

Implementation of ILiteralTerm that maps an Anzo Litera to a Glitter ILiteralTerm

Author:
Matthew Roy ( mroy@cambridgesemantics.com )

Constructor Summary
Literal(CompositeNodeLayout nodeLayout, long id)
          Create a new Literal for value stored in database with given ID
Literal(org.openrdf.model.Literal value)
          Create a new Literal
 
Method Summary
 void clear()
          Clear the cache data for this object
 int compareTo(TriplePatternComponent o)
          Compares to TriplePatternComponents for ordering.
 boolean equals(java.lang.Object other)
           
 java.net.URI getDatatype()
           
 long getId()
          Get the ID of this node in the database
 java.lang.String getLanguage()
           
 java.lang.String getLexicalForm()
           
 org.openrdf.model.Literal getLiteralNode(java.util.Map<java.lang.Long,org.openrdf.model.Value> alreadyStored)
          Get the org.openrdf.model.Literal of this Literal
 java.lang.Object getNativeValue()
           
 org.openrdf.model.Literal getValue()
          Get the Value representation of this term
 int hashCode()
           
 boolean hasLanguage()
           
 boolean isPlainLiteral()
           
 boolean isTypedLiteral()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Literal

public Literal(CompositeNodeLayout nodeLayout,
               long id)
Create a new Literal for value stored in database with given ID

Parameters:
nodeLayout - source of data
id - id of Literal in the database

Literal

public Literal(org.openrdf.model.Literal value)
Create a new Literal

Parameters:
value - org.openrdf.model.Literal representation of value
Method Detail

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface TriplePatternComponent
Overrides:
equals in class java.lang.Object

clear

public void clear()
Clear the cache data for this object


getId

public long getId()
Description copied from interface: IRdbTerm
Get the ID of this node in the database

Specified by:
getId in interface IRdbTerm
Returns:
the ID of this node in the database

getLiteralNode

public org.openrdf.model.Literal getLiteralNode(java.util.Map<java.lang.Long,org.openrdf.model.Value> alreadyStored)
Get the org.openrdf.model.Literal of this Literal

Parameters:
alreadyStored - map of already resolved IDs to their org.openrdf.model.Literal value
Returns:
the org.openrdf.model.Literal of this Literal

getValue

public org.openrdf.model.Literal getValue()
Description copied from interface: IRdbTerm
Get the Value representation of this term

Specified by:
getValue in interface IRdbTerm
Returns:
the Value representation of this term

getLanguage

public java.lang.String getLanguage()
Specified by:
getLanguage in interface IPlainLiteralTerm
Returns:
The language tag for this plain literal. May be null, unless IPlainLiteralTerm.hasLanguage() returns true.

hasLanguage

public boolean hasLanguage()
Specified by:
hasLanguage in interface IPlainLiteralTerm
Returns:
whether or not this literal has a language tag

getLexicalForm

public java.lang.String getLexicalForm()
Specified by:
getLexicalForm in interface ILiteralTerm
Returns:
The lexical form of the literal.

getNativeValue

public java.lang.Object getNativeValue()
Specified by:
getNativeValue in interface ITypedLiteralTerm
Returns:
A native Java object capturing the value of this typed literal.

getDatatype

public java.net.URI getDatatype()
Specified by:
getDatatype in interface ITypedLiteralTerm
Returns:
The datatype of this typed literal. Must be a valid URI

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(TriplePatternComponent o)
Description copied from interface: TriplePatternComponent
Compares to TriplePatternComponents for ordering.

Specified by:
compareTo in interface TriplePatternComponent
Returns:
-1 if this comes before other; 0 if TriplePatternComponent.equals(Object) is true, and 1 otherwise.

isPlainLiteral

public boolean isPlainLiteral()
Specified by:
isPlainLiteral in interface ILiteralTerm
Returns:
whether or not this is a plain literal.

isTypedLiteral

public boolean isTypedLiteral()
Specified by:
isTypedLiteral in interface ILiteralTerm
Returns:
whether or not this is a typed literal.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.