info.sswap.impl.empire.model
Class EmpireGeneratedNodeImpl

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
                  extended by info.sswap.impl.empire.model.EmpireGeneratedNodeImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPIndividual, SSWAPModel, SSWAPNode
Direct Known Subclasses:
GraphImpl, ObjectImpl, ProviderImpl, ResourceImpl, SubjectImpl

public abstract class EmpireGeneratedNodeImpl
extends NodeImpl

An abstract class containing methods common to all Empire-generated SSWAPIndividuals.

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
EmpireGeneratedNodeImpl()
           
 
Method Summary
protected
<T extends ModelImpl>
java.util.List<T>
ensureProperView(java.util.List<? extends ModelImpl> models, java.lang.Class<T> clazz)
           
protected
<T extends ModelImpl>
T
ensureProperView(ModelImpl model, java.lang.Class<T> clazz)
           
 boolean isEmpireGenerated()
          Informs the caller that this node is empire-generated.
protected static
<T extends SSWAPModel,S extends ModelImpl>
java.util.Set<T>
listFromImpl(java.util.List<S> implList, java.lang.Class<T> modelClass, java.lang.Class<S> implClass)
          Convenience method for Empire-generated objects.
protected static
<T extends SSWAPModel,S extends ModelImpl>
java.util.Set<S>
listToImpl(java.util.List<T> modelList, java.lang.Class<T> modelClass, java.lang.Class<S> implClass)
          Convenience method for Empire-generated objects.
 void persist()
          Synchronizes the information stored in this individual to the underlying data source.
 void refresh()
          Refreshes the information stored in this individual by rescanning the underlying data source.
protected static
<T extends ModelImpl>
java.util.List<T>
setSourceModel(java.util.List<T> models, SourceModel sourceModel)
          Convenience method for setting the same source model to all elements in a list
protected static
<T extends SSWAPModel,S extends ModelImpl>
java.util.List<S>
toListImpl(java.util.Collection<T> modelList, java.lang.Class<T> modelClass, java.lang.Class<S> implClass)
          Convenience method for Empire-generated objects.
 
Methods inherited from class info.sswap.impl.empire.model.NodeImpl
asSSWAPGraph, asSSWAPObject, asSSWAPProvider, asSSWAPResource, asSSWAPSubject, dereference, getID, isDereferenced, isSSWAPGraph, isSSWAPObject, isSSWAPProvider, isSSWAPResource, isSSWAPSubject
 
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, 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

EmpireGeneratedNodeImpl

public EmpireGeneratedNodeImpl()
Method Detail

isEmpireGenerated

public boolean isEmpireGenerated()
Informs the caller that this node is empire-generated.

Overrides:
isEmpireGenerated in class NodeImpl
Returns:
always true

listFromImpl

protected static <T extends SSWAPModel,S extends ModelImpl> java.util.Set<T> listFromImpl(java.util.List<S> implList,
                                                                                          java.lang.Class<T> modelClass,
                                                                                          java.lang.Class<S> implClass)
Convenience method for Empire-generated objects. It casts a list containing Empire-generated objects (e.g., SubjectImpl) to a set typed with their API interfaces (e.g., SSWAPSubject). For example, if one has a list declared as: List implTypedList it can be cast to List by the following call: List apiTypedList = listFromImpl(implTypedList, sourceModel, SSWAPSubject.class, SubjectImpl.class) This method handles properly the situation when the list is null (Empire may return either an empty list or a null list, while SSWAP API always returns an empty list).

Type Parameters:
T - generic parameter for the API interface
S - generic parameter for the Empire-generated class of the interface T
Parameters:
implList - the list of Empire-generated objects (may be null)
modelClass - the class for the interface in the SSWAP API
implClass - the class for the Empire-based implementation
Returns:
a set typed with API interface (never null)

listToImpl

protected static <T extends SSWAPModel,S extends ModelImpl> java.util.Set<S> listToImpl(java.util.List<T> modelList,
                                                                                        java.lang.Class<T> modelClass,
                                                                                        java.lang.Class<S> implClass)
                                                        throws java.lang.IllegalArgumentException
Convenience method for Empire-generated objects. It casts a list containing Empire-generated objects typed with API interfaces (e.g., SSWAPSubjects) to a set typed with their Empire-based implementations (e.g., SubjectImpl). For example, if one has a list declared as: List apiTypedList it can be cast to Set by the following call: Set implTypedSet = listToImpl(apiTypedList, SSWAPSubject.class, SubjectImpl.class)

Type Parameters:
T - generic parameter for the API interface
S - generic parameter for the Empire-generated class of the interface T
Parameters:
modelList - the list of Empire-generated objects typed using the API interfaces
modelClass - the class for the interface in the SSWAP API
implClass - the class for the Empire-based implementation
Returns:
a set typed with API interface
Throws:
java.lang.IllegalArgumentException - if some (or all) of the objects in the list were not created by this API implementation

toListImpl

protected static <T extends SSWAPModel,S extends ModelImpl> java.util.List<S> toListImpl(java.util.Collection<T> modelList,
                                                                                         java.lang.Class<T> modelClass,
                                                                                         java.lang.Class<S> implClass)
                                                         throws java.lang.IllegalArgumentException
Convenience method for Empire-generated objects. It casts a collection containing objects typed as API interfaces (e.g., SSWAPSubjects) to a List of of objects typed with their Empire-generated implementations (e.g., SubjectImpl). For example, if one has a list declared as: List apiTypedList it can be cast to List by the following call: List implTypedList = listToImpl(apiTypedList, SSWAPSubject.class, SubjectImpl.class)

Type Parameters:
T - generic parameter for the API interface
S - generic parameter for the Empire-generated class of the interface T
Parameters:
modelList - the list of Empire-generated objects typed using the API interfaces
modelClass - the class for the interface in the SSWAP API
implClass - the class for the Empire-based implementation
Returns:
a set typed with API interface
Throws:
java.lang.IllegalArgumentException - if some (or all) of the objects in the list were not created by this API implementation

setSourceModel

protected static <T extends ModelImpl> java.util.List<T> setSourceModel(java.util.List<T> models,
                                                                        SourceModel sourceModel)
Convenience method for setting the same source model to all elements in a list

Parameters:
models - a list of ModelImpls
sourceModel - a model to be set.
Returns:
the same collection with the source model set for all elements

ensureProperView

protected <T extends ModelImpl> java.util.List<T> ensureProperView(java.util.List<? extends ModelImpl> models,
                                                                   java.lang.Class<T> clazz)

ensureProperView

protected <T extends ModelImpl> T ensureProperView(ModelImpl model,
                                                   java.lang.Class<T> clazz)

refresh

public void refresh()
Description copied from class: IndividualImpl
Refreshes the information stored in this individual by rescanning the underlying data source.

Overrides:
refresh in class IndividualImpl

persist

public void persist()
Description copied from class: IndividualImpl
Synchronizes the information stored in this individual to the underlying data source.

Overrides:
persist in class IndividualImpl


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