info.sswap.impl.empire.model
Class ElementImpl

java.lang.Object
  extended by info.sswap.impl.empire.model.ModelImpl
      extended by info.sswap.impl.empire.model.ElementImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPModel
Direct Known Subclasses:
DatatypeImpl, IndividualImpl, ListImpl, Literal, PredicateImpl, PropertyImpl, TypeImpl

public abstract class ElementImpl
extends ModelImpl
implements SSWAPElement

Implements a SSWAPElement (an element in SSWAP other than an RDF data source like a PDG or a canonical/protocol graph)

Author:
Blazej Bulka

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
 
Constructor Summary
ElementImpl()
           
 
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.
 SSWAPIndividual asIndividual()
          Type-safe cast of this element to a SSWAPIndividual.
 java.lang.Integer asInteger()
          Type-safe cast of this element to an integer.
 SSWAPList asList()
          Type-safe cast of this element to a list.
 SSWAPLiteral asLiteral()
          Type-safe cast of this element to SSWAPLiteral.
 java.lang.String asString()
          Type-safe cast of this element to a String.
 java.lang.String getComment()
          Returns that rdfs:comment value of this type or null if no comment exists.
protected  com.hp.hpl.jena.rdf.model.Resource getJenaResource(com.hp.hpl.jena.rdf.model.Model model)
          Retrieves a corresponding Jena resource for this element from a Jena model
 java.lang.String getLabel()
          Returns that rdfs:label value of this type or null if no label exists.
 boolean isAnonymous()
           
 boolean isIndividual()
          Checks whether this element is a SSWAPIndividual.
 boolean isList()
          Checks whether this element is a list of SSWAPElements.
 boolean isLiteral()
          Checks whether this element is a literal.
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId
getRdfId, setRdfId
 

Constructor Detail

ElementImpl

public ElementImpl()
Method Detail

asBoolean

public java.lang.Boolean asBoolean()
Description copied from interface: SSWAPElement
Type-safe case of this element to a boolean. This is only possible for elements that are literals and they represent a valid boolean value. The only valid boolean values are "true" and "false" (case insensitive).

Specified by:
asBoolean in interface SSWAPElement
Returns:
a boolean, if the element is a literal containing a valid boolean value (as defined above), or null otherwise.

asDouble

public java.lang.Double asDouble()
Description copied from interface: SSWAPElement
Type-safe cast of this element to a double. This is only possible for elements that are literals, and they contain a valid numerical data.

Specified by:
asDouble in interface SSWAPElement
Returns:
a double, if the element is a literal containing a legal double, or null otherwise.

asIndividual

public SSWAPIndividual asIndividual()
Description copied from interface: SSWAPElement
Type-safe cast of this element to a SSWAPIndividual. This is only possible for elements that are SSWAPIndividuals.

Specified by:
asIndividual in interface SSWAPElement
Returns:
a SSWAPIndividual, if the element is actually a SSWAPIndividual, or null otherwise.

asInteger

public java.lang.Integer asInteger()
Description copied from interface: SSWAPElement
Type-safe cast of this element to an integer. This is only possible for elements that are literals, and they contain a valid integer data.

Specified by:
asInteger in interface SSWAPElement
Returns:
an integer, if the element is a literal containing a legal integer, or null otherwise.

asList

public SSWAPList asList()
Description copied from interface: SSWAPElement
Type-safe cast of this element to a list. This is only possible for elements that are lists.

Specified by:
asList in interface SSWAPElement
Returns:
a SSWAPList, if the element is actually a list, or null otherwise.

asString

public java.lang.String asString()
Description copied from interface: SSWAPElement
Type-safe cast of this element to a String. This is only possible for elements that are literals.

Specified by:
asString in interface SSWAPElement
Returns:
a string, if the element is a literal, or null otherwise.

asLiteral

public SSWAPLiteral asLiteral()
Description copied from interface: SSWAPElement
Type-safe cast of this element to SSWAPLiteral. This is only possible for elements that are SSWAPLiterals.

Specified by:
asLiteral in interface SSWAPElement
Returns:
a SSWAPLiteral, if the element is actually a SSWAPLiteral, or null otherwise

isIndividual

public boolean isIndividual()
Description copied from interface: SSWAPElement
Checks whether this element is a SSWAPIndividual.

Specified by:
isIndividual in interface SSWAPElement
Returns:
true if the element is a SSWAPIndividual.

isList

public boolean isList()
Description copied from interface: SSWAPElement
Checks whether this element is a list of SSWAPElements.

Specified by:
isList in interface SSWAPElement
Returns:
true if the element is a list

isLiteral

public boolean isLiteral()
Description copied from interface: SSWAPElement
Checks whether this element is a literal.

Specified by:
isLiteral in interface SSWAPElement
Returns:
true if the element is a literal

isAnonymous

public boolean isAnonymous()

getJenaResource

protected com.hp.hpl.jena.rdf.model.Resource getJenaResource(com.hp.hpl.jena.rdf.model.Model model)
Retrieves a corresponding Jena resource for this element from a Jena model

Parameters:
model - the model that should contain information about this element
Returns:
the corresponding Jena resource or null, if there is no such a resource

addLabel

public void addLabel(java.lang.String label)
Description copied from interface: SSWAPElement
Adds an rdfs:label statement to this type.

Specified by:
addLabel in interface SSWAPElement
Parameters:
label - the label to be added

addComment

public void addComment(java.lang.String comment)
Description copied from interface: SSWAPElement
Adds and rdfs:comment to this type.

Specified by:
addComment in interface SSWAPElement
Parameters:
comment - the comment to be added to this type

getLabel

public java.lang.String getLabel()
Description copied from interface: SSWAPElement
Returns that rdfs:label value of this type or null if no label exists. If multiple labels exist for the type any one of them is returned. For literal labels, only the lexical form is returned not the type nor the language identifier.

Specified by:
getLabel in interface SSWAPElement
Returns:
label of this type or null if no label exists

getComment

public java.lang.String getComment()
Description copied from interface: SSWAPElement
Returns that rdfs:comment value of this type or null if no comment exists. If multiple comments exist for the type any one of them is returned. For literal comments, only the lexical form is returned not the type nor the language identifier.

Specified by:
getComment in interface SSWAPElement
Returns:
comment of this type or null if no comment exists


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.