|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.impl.empire.model.ModelImpl
info.sswap.impl.empire.model.ElementImpl
info.sswap.impl.empire.model.Literal
public class Literal
Implementation of SSWAPElement that is a literal.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.clarkparsia.empire.SupportsRdfId |
---|
com.clarkparsia.empire.SupportsRdfId.BNodeKey, com.clarkparsia.empire.SupportsRdfId.RdfKey<T>, com.clarkparsia.empire.SupportsRdfId.URIKey |
Field Summary | |
---|---|
private java.net.URI |
datatypeURI
|
private java.lang.String |
language
|
private static int |
ODD_PRIME
An arbitrary odd prime used in the hash function. |
private java.lang.String |
value
The value of the literal. |
Constructor Summary | |
---|---|
Literal(Literal other)
A copy constructor for a literal |
|
Literal(java.lang.String value)
Initializes the literal with the given value |
|
Literal(java.lang.String value,
java.net.URI datatypeURI,
java.lang.String language)
Creates a new literal with value, type information (optional) and language information (optional). |
Method Summary | |
---|---|
void |
addComment(java.lang.String comment)
Adds and rdfs:comment to this type. |
void |
addLabel(java.lang.String label)
Adds an rdfs:label statement to this type. |
java.lang.Boolean |
asBoolean()
Type-safe case of this element to a boolean. |
java.lang.Double |
asDouble()
Type-safe cast of this element to a double. |
java.lang.Integer |
asInteger()
Type-safe cast of this element to an integer. |
SSWAPLiteral |
asLiteral()
Type-safe cast of this element to SSWAPLiteral. |
private void |
assertValidValue(java.lang.String value,
java.net.URI datatypeURI)
Checks whether the value of the literal conforms to its declared XSD datatype. |
java.lang.String |
asString()
Type-safe cast of this element to a String. |
boolean |
equals(java.lang.Object o)
|
java.net.URI |
getDatatypeURI()
Gets the URI of the datatype. |
java.lang.String |
getLanguage()
Gets the language of the literal (if specified) |
com.clarkparsia.empire.SupportsRdfId.RdfKey |
getRdfId()
Gets the RDF identifier of the literal (method required by the interface). |
java.lang.String |
getValue()
|
int |
hashCode()
Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method. |
boolean |
isLiteral()
Notifies the caller that this SSWAPElement is a literal. |
void |
setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfId)
Sets the RDF identifier (method required by the interface). |
Methods inherited from class info.sswap.impl.empire.model.ElementImpl |
---|
asIndividual, asList, getComment, getJenaResource, getLabel, isAnonymous, isIndividual, isList |
Methods inherited from class info.sswap.impl.empire.model.ModelImpl |
---|
addImport, assertModel, assertSourceModel, checkProfile, dereference, dereference, doClosure, getAllDependentObjects, getDependentObject, getDocument, getExpressivity, getImports, getInputStream, getNsPrefixMap, getReasoningService, getSourceModel, getTypeSignature, getURI, hasSourceModel, hasSourceModelWithEntityManager, isDereferenced, persist, rdfIdEquals, rdfIdHashCode, refresh, refreshSiblings, removeImport, removeNsPrefix, serialize, serialize, setDereferenced, setNsPrefix, setSourceModel, setURI, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface info.sswap.api.model.SSWAPElement |
---|
asIndividual, asList, getComment, getLabel, isIndividual, isList |
Methods inherited from interface info.sswap.api.model.SSWAPModel |
---|
addImport, checkProfile, dereference, dereference, doClosure, getDocument, getImports, getInputStream, getNsPrefixMap, getReasoningService, getTypeSignature, getURI, isDereferenced, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix, validate |
Field Detail |
---|
private java.lang.String value
private java.net.URI datatypeURI
private java.lang.String language
private static final int ODD_PRIME
Constructor Detail |
---|
public Literal(java.lang.String value)
value
- the value of the literalpublic Literal(java.lang.String value, java.net.URI datatypeURI, java.lang.String language) throws java.lang.IllegalArgumentException
value
- the value of the literal (its lexical representation)datatypeURI
- the URI of the datatype (may be null)language
- the declared language of the literal (may be null)
java.lang.IllegalArgumentException
- if the lexical representation of the value is not valid given its declared XSD datatype.Literal(Literal other)
other
- the literal to be copiedMethod Detail |
---|
private void assertValidValue(java.lang.String value, java.net.URI datatypeURI) throws java.lang.IllegalArgumentException
value
- the value to be checked (the lexical representation of the value)datatypeURI
- the URI of the XSD datatype
java.lang.IllegalArgumentException
- if the value does not conform to its declared XSD datatype.public com.clarkparsia.empire.SupportsRdfId.RdfKey getRdfId()
getRdfId
in interface com.clarkparsia.empire.SupportsRdfId
public void setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfId)
setRdfId
in interface com.clarkparsia.empire.SupportsRdfId
rdfId
- the RDF identifier
java.lang.UnsupportedOperationException
- alwayspublic boolean isLiteral()
isLiteral
in interface SSWAPElement
isLiteral
in class ElementImpl
public SSWAPLiteral asLiteral()
SSWAPElement
asLiteral
in interface SSWAPElement
asLiteral
in class ElementImpl
public java.lang.Boolean asBoolean()
SSWAPElement
asBoolean
in interface SSWAPElement
asBoolean
in class ElementImpl
public java.lang.Double asDouble()
SSWAPElement
asDouble
in interface SSWAPElement
asDouble
in class ElementImpl
public java.lang.Integer asInteger()
SSWAPElement
asInteger
in interface SSWAPElement
asInteger
in class ElementImpl
public java.lang.String asString()
SSWAPElement
asString
in interface SSWAPElement
asString
in class ElementImpl
public java.lang.String getValue()
public java.net.URI getDatatypeURI()
SSWAPLiteral
getDatatypeURI
in interface SSWAPLiteral
public java.lang.String getLanguage()
SSWAPLiteral
getLanguage
in interface SSWAPLiteral
public void addLabel(java.lang.String label)
SSWAPElement
addLabel
in interface SSWAPElement
addLabel
in class ElementImpl
label
- the label to be addedpublic void addComment(java.lang.String comment)
SSWAPElement
addComment
in interface SSWAPElement
addComment
in class ElementImpl
comment
- the comment to be added to this typepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |