info.sswap.impl.empire.model
Class NodeImpl

java.lang.Object
  extended by info.sswap.impl.empire.model.ModelImpl
      extended by info.sswap.impl.empire.model.ElementImpl
          extended by info.sswap.impl.empire.model.IndividualImpl
              extended by info.sswap.impl.empire.model.NodeImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPIndividual, SSWAPModel, SSWAPNode
Direct Known Subclasses:
EmpireGeneratedNodeImpl

public abstract class NodeImpl
extends IndividualImpl
implements SSWAPNode

Implementation of SSWAPNode (a SSWAP entity that requires special handling in SSWAP protocol)

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
NodeImpl()
           
 
Method Summary
private
<T extends SSWAPModel>
T
as(java.lang.Class<T> clazz)
           
 SSWAPGraph asSSWAPGraph()
          Type-safe cast to SSWAPGraph.
 SSWAPObject asSSWAPObject()
          Type-safe cast to SSWAPObject.
 SSWAPProvider asSSWAPProvider()
          Type-safe cast to SSWAPProvider.
 SSWAPResource asSSWAPResource()
          Type-safe cast to SSWAPResource.
 SSWAPSubject asSSWAPSubject()
          Type-safe cast to SSWAPSubject.
 void dereference()
          Dereferences this node, by first calling dereference() on the source model (if there is one; in case there is no source model, this method immediately returns).
 java.net.URI getID()
          Gets a unique identifier of this node.
private static java.lang.Class<? extends ModelImpl> getImplClass(java.lang.Class<? extends SSWAPModel> apiClass)
           
 boolean isDereferenced()
          Returns whether this object represents a dereferenced content stored under the URI, or is it just the URI.
 boolean isEmpireGenerated()
          Checks whether the final implementation of this object is provided by Empire.
private
<T extends SSWAPModel>
boolean
isOfType(java.lang.Class<T> clazz)
           
 boolean isSSWAPGraph()
          Checks whether this node is a SSWAPGraph
 boolean isSSWAPObject()
          Checks whether this node is a SSWAPObject
 boolean isSSWAPProvider()
          Checks whether this node is a SSWAPProvider.
 boolean isSSWAPResource()
          Checks whether this node is a SSWAPResource.
 boolean isSSWAPSubject()
          Checks whether this node is a SSWAPSubject
 
Methods inherited from class info.sswap.impl.empire.model.IndividualImpl
addComment, addIgnoredProperty, addIgnoredType, addLabel, addProperty, addProperty, addProperty, addProperty, addProperty, addType, asIndividual, assertType, clearProperty, clearProperty, closeWorld, equals, getDeclaredType, getDeclaredTypes, getIgnoredProperties, getIgnoredTypes, getInferredIndividual, getProperties, getProperties, getProperty, getType, getTypes, hashCode, hasValue, hasValue, isCompatibleWith, isIndividual, isOfType, persist, refresh, removeProperty, removeProperty, removeType, setDefaultParameterValues, setProperty, setProperty, setProperty, setProperty, setProperty, setSourceModel
 
Methods inherited from class info.sswap.impl.empire.model.ElementImpl
asBoolean, asDouble, asInteger, asList, asLiteral, asString, getComment, getJenaResource, getLabel, isAnonymous, isList, isLiteral
 
Methods inherited from class info.sswap.impl.empire.model.ModelImpl
addImport, assertModel, assertSourceModel, checkProfile, dereference, doClosure, getAllDependentObjects, getDependentObject, getDocument, getExpressivity, getImports, getInputStream, getNsPrefixMap, getReasoningService, getSourceModel, getTypeSignature, getURI, hasSourceModel, hasSourceModelWithEntityManager, rdfIdEquals, rdfIdHashCode, refreshSiblings, removeImport, removeNsPrefix, serialize, serialize, setDereferenced, setNsPrefix, 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.SSWAPIndividual
addProperty, addProperty, addProperty, addProperty, addType, clearProperty, getDeclaredType, getDeclaredTypes, getInferredIndividual, getProperties, getProperties, getProperty, getType, getTypes, hasValue, hasValue, isAnonymous, isCompatibleWith, isOfType, removeProperty, removeProperty, removeType, setProperty, setProperty, setProperty, setProperty
 
Methods inherited from interface info.sswap.api.model.SSWAPElement
addComment, addLabel, asBoolean, asDouble, asIndividual, asInteger, asList, asLiteral, asString, getComment, getLabel, isIndividual, isList, isLiteral
 
Methods inherited from interface info.sswap.api.model.SSWAPModel
addImport, checkProfile, dereference, doClosure, getDocument, getImports, getInputStream, getNsPrefixMap, getReasoningService, getTypeSignature, getURI, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix, validate
 
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId
getRdfId, setRdfId
 

Constructor Detail

NodeImpl

public NodeImpl()
Method Detail

dereference

public void dereference()
                 throws DataAccessException
Dereferences this node, by first calling dereference() on the source model (if there is one; in case there is no source model, this method immediately returns). In case, this node is empire-generated, it also forces Empire to refresh/populate the object with the data read from the source model.

Specified by:
dereference in interface SSWAPModel
Overrides:
dereference in class ModelImpl
Throws:
DataAccessException - when trying to access the underlying data source while dereferencing

isDereferenced

public boolean isDereferenced()
Description copied from interface: SSWAPModel
Returns whether this object represents a dereferenced content stored under the URI, or is it just the URI. For objects that have not been dereferenced, the only valid methods are getURI(), isDereferenced(), and dereference().

Specified by:
isDereferenced in interface SSWAPModel
Overrides:
isDereferenced in class ModelImpl
Returns:
true if the object has already been dereferenced

asSSWAPGraph

public SSWAPGraph asSSWAPGraph()
Description copied from interface: SSWAPNode
Type-safe cast to SSWAPGraph. This is only possible for nodes that are actually SSWAPGraphs.

Specified by:
asSSWAPGraph in interface SSWAPNode
Returns:
a SSWAPGraph, if this node is a SSWAPGraph, null otherwise.

asSSWAPObject

public SSWAPObject asSSWAPObject()
Description copied from interface: SSWAPNode
Type-safe cast to SSWAPObject. This is only possible for nodes that are actually SSWAPObjects.

Specified by:
asSSWAPObject in interface SSWAPNode
Returns:
a SSWAPObject, if this node is a SSWAPObject, null otherwise.

asSSWAPProvider

public SSWAPProvider asSSWAPProvider()
Description copied from interface: SSWAPNode
Type-safe cast to SSWAPProvider. This is only possible for nodes that are actually SSWAPProviders.

Specified by:
asSSWAPProvider in interface SSWAPNode
Returns:
a SSWAPProvider, if this node is a SSWAPProvider, null otherwise.

asSSWAPResource

public SSWAPResource asSSWAPResource()
Description copied from interface: SSWAPNode
Type-safe cast to SSWAPResource. This is only possible for nodes that are actually SSWAPResources.

Specified by:
asSSWAPResource in interface SSWAPNode
Returns:
a SSWAPResource, if this node is a SSWAPResource, null otherwise.

asSSWAPSubject

public SSWAPSubject asSSWAPSubject()
Description copied from interface: SSWAPNode
Type-safe cast to SSWAPSubject. This is only possible for nodes that are actually SSWAPSubjects.

Specified by:
asSSWAPSubject in interface SSWAPNode
Returns:
a SSWAPSubject, if this node is a SSWAPSubject, null otherwise.

getID

public java.net.URI getID()
Description copied from interface: SSWAPNode
Gets a unique identifier of this node. For nodes that are not blank nodes, this method returns a regular URI of this node (as returned by getURI() method). For blank nodes, this method returns a document-wide unique identifier of this blank node.

Specified by:
getID in interface SSWAPNode
Returns:
a document-wide unique identifier of this node.

isEmpireGenerated

public boolean isEmpireGenerated()
Checks whether the final implementation of this object is provided by Empire. The current implementation returns always false, and this method should always be overridden by Empire-backed classes.

Returns:
always false.

isSSWAPGraph

public boolean isSSWAPGraph()
Description copied from interface: SSWAPNode
Checks whether this node is a SSWAPGraph

Specified by:
isSSWAPGraph in interface SSWAPNode
Returns:
true if this node is a SSWAPGraph

isSSWAPObject

public boolean isSSWAPObject()
Description copied from interface: SSWAPNode
Checks whether this node is a SSWAPObject

Specified by:
isSSWAPObject in interface SSWAPNode
Returns:
true if this node is a SSWAPObject

isSSWAPProvider

public boolean isSSWAPProvider()
Description copied from interface: SSWAPNode
Checks whether this node is a SSWAPProvider.

Specified by:
isSSWAPProvider in interface SSWAPNode
Returns:
true if this node is a SSWAPProvider

isSSWAPResource

public boolean isSSWAPResource()
Description copied from interface: SSWAPNode
Checks whether this node is a SSWAPResource.

Specified by:
isSSWAPResource in interface SSWAPNode
Returns:
true if this node is a SSWAPResource

isSSWAPSubject

public boolean isSSWAPSubject()
Description copied from interface: SSWAPNode
Checks whether this node is a SSWAPSubject

Specified by:
isSSWAPSubject in interface SSWAPNode
Returns:
true if this node is a SSWAPSubject

isOfType

private <T extends SSWAPModel> boolean isOfType(java.lang.Class<T> clazz)

as

private <T extends SSWAPModel> T as(java.lang.Class<T> clazz)

getImplClass

private static java.lang.Class<? extends ModelImpl> getImplClass(java.lang.Class<? extends SSWAPModel> apiClass)


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