info.sswap.impl.empire.model
Class ResourceImpl

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
                      extended by info.sswap.impl.empire.model.ResourceImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPIndividual, SSWAPModel, SSWAPNode, SSWAPResource

public abstract class ResourceImpl
extends EmpireGeneratedNodeImpl
implements SSWAPResource

Implementation of SSWAPResource. This abstract class contains several abstract methods whose implementations will be provided at run-time by Empire.

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
 
Field Summary
private  ResourceImpl originalResource
          Set only for translated resources.
 
Constructor Summary
ResourceImpl()
           
 
Method Summary
 void dereference()
          Dereferences this SSWAPResource.
private  void detachExistingGraphs()
           
abstract  java.net.URI getAboutURI()
          Gets the URI pointing to a human-readable description of this resource.
 SSWAPGraph getGraph()
          Gets the SSWAP graph of the resource.
 java.util.Collection<SSWAPGraph> getGraphs()
          Gets all the SSWAP graphs of the resource.
abstract  java.net.URI getIcon()
          Gets the URI of the icon for this resource (if defined).
abstract  java.net.URI getInputURI()
          Gets the URI pointing to a human-readable user interface for this resource.
abstract  java.net.URI getMetadata()
          Gets the URI containing the machine-readable metadata for this resource.
abstract  java.lang.String getName()
          Gets the name of the resource.
abstract  java.lang.String getOneLineDescription()
          Gets one line description of the resource.
abstract  java.util.List<GraphImpl> getOperatesOnEmpireList()
          Gets a list of SSWAPGraph implementations that are all connected to this SSWAPResource by sswap:operatesOn predicate.
 java.util.List<GraphImpl> getOperatesOnList()
           
 ResourceImpl getOriginalResource()
           
abstract  java.net.URI getOutputURI()
           
abstract  ProviderImpl getProvidedBy()
           
 SSWAPProvider getProvider()
          Gets the object describing the provider of this resource.
 RDG getRDG()
          Gets the RDG where this resource is defined.
private  boolean isWithinRQG()
          Checks whether this SSWAPResource is within an RQG (this affects the validation process).
abstract  void setAboutURI(java.net.URI aboutURI)
          Sets the URI pointing to a human-readable description of this resource.
(package private)  void setDefaultParameterValues(IndividualImpl rdgIndividual)
          Sets the default parameter values for this individual based on the information from the individual in an RDG.
 void setGraph(SSWAPGraph graph)
          Sets the SSWAPGraph for this resource.
 void setGraphs(java.util.Collection<SSWAPGraph> graphs)
          Sets the SSWAPGraphs for this resource.
abstract  void setIcon(java.net.URI icon)
          Sets the URI of the icon for this resource
abstract  void setInputURI(java.net.URI inputURI)
          Sets the URI pointing to a human-readable user interface for this resource.
abstract  void setMetadata(java.net.URI metadata)
          Sets the URI pointing to the machine-readable metadata for this resource.
abstract  void setName(java.lang.String name)
          Sets the name of the resource.
abstract  void setOneLineDescription(java.lang.String oneLineDescription)
          Sets one line description of the resource.
abstract  void setOperatesOnEmpireList(java.util.List<GraphImpl> graphImpls)
          Sets a list of SSWAPGraph implementations that will all be connected to this SSWAPResource by sswap:operatesOn predicate.
(package private)  void setOriginalResource(ResourceImpl originalResource)
           
abstract  void setOutputURI(java.net.URI outputURI)
           
abstract  void setProvidedBy(ProviderImpl provider)
           
 void setProvider(SSWAPProvider provider)
          Sets the provider for this resource.
 void validate()
          Verifies whether the underlying RDF data conforms to SSWAP syntax and requirements.
 void validateProvider()
           
 
Methods inherited from class info.sswap.impl.empire.model.EmpireGeneratedNodeImpl
ensureProperView, ensureProperView, isEmpireGenerated, listFromImpl, listToImpl, persist, refresh, setSourceModel, toListImpl
 
Methods inherited from class info.sswap.impl.empire.model.NodeImpl
asSSWAPGraph, asSSWAPObject, asSSWAPProvider, asSSWAPResource, asSSWAPSubject, 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, 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.sswap.api.model.SSWAPNode
asSSWAPGraph, asSSWAPObject, asSSWAPProvider, asSSWAPResource, asSSWAPSubject, getID, isSSWAPGraph, isSSWAPObject, isSSWAPProvider, isSSWAPResource, isSSWAPSubject
 
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, isDereferenced, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix
 
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId
getRdfId, setRdfId
 

Field Detail

originalResource

private ResourceImpl originalResource
Set only for translated resources. Contains reference to the untranslated original

Constructor Detail

ResourceImpl

public ResourceImpl()
Method Detail

getOriginalResource

public ResourceImpl getOriginalResource()

setOriginalResource

void setOriginalResource(ResourceImpl originalResource)

dereference

public void dereference()
                 throws DataAccessException
Dereferences this SSWAPResource. In case, this resource was created by itself (e.g., by SSWAP.getResource(), and not by first retrieving a SSWAPProtocol and then the resource), dereferencing will create an RDG behind the scenes. That RDG will have the Jena model containing the actual RDF data.

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

getName

public abstract java.lang.String getName()
Description copied from interface: SSWAPResource
Gets the name of the resource. A valid description of the resource must include the information about the name. (The invalid graphs that do not provide this information about the resource, will cause this method to return null.)

Specified by:
getName in interface SSWAPResource
Returns:
name of the resource (or null for invalid graphs)

setName

public abstract void setName(java.lang.String name)
Description copied from interface: SSWAPResource
Sets the name of the resource. A valid name of the resource must not be null.

Specified by:
setName in interface SSWAPResource
Parameters:
name - the name of the resource (must not be null).

getOneLineDescription

public abstract java.lang.String getOneLineDescription()
Description copied from interface: SSWAPResource
Gets one line description of the resource.

Specified by:
getOneLineDescription in interface SSWAPResource
Returns:
one line description of the resource (or null if not available).

setOneLineDescription

public abstract void setOneLineDescription(java.lang.String oneLineDescription)
Description copied from interface: SSWAPResource
Sets one line description of the resource.

Specified by:
setOneLineDescription in interface SSWAPResource
Parameters:
oneLineDescription - the new one line description of the resource, or null if the current description is to be removed.

getAboutURI

public abstract java.net.URI getAboutURI()
Description copied from interface: SSWAPResource
Gets the URI pointing to a human-readable description of this resource. This URI should be dereferenceable if not null.

Specified by:
getAboutURI in interface SSWAPResource
Returns:
URI pointing to a human-readable description, or null if there is no such description for the resource.

setAboutURI

public abstract void setAboutURI(java.net.URI aboutURI)
Description copied from interface: SSWAPResource
Sets the URI pointing to a human-readable description of this resource. This URI should be dereferenceable or null.

Specified by:
setAboutURI in interface SSWAPResource
Parameters:
aboutURI - URI pointing to a human-readable description of this resource, or null if there is no such description for the resource.

getMetadata

public abstract java.net.URI getMetadata()
Description copied from interface: SSWAPResource
Gets the URI containing the machine-readable metadata for this resource. This URI should be dereferenceable or null.

Specified by:
getMetadata in interface SSWAPResource
Returns:
URI pointing to a machine-readable metadata for this resource, or null if there is no metadata for this resource.

setMetadata

public abstract void setMetadata(java.net.URI metadata)
Description copied from interface: SSWAPResource
Sets the URI pointing to the machine-readable metadata for this resource. This URI should be dereferenceable or null.

Specified by:
setMetadata in interface SSWAPResource
Parameters:
metadata - URI pointing to a machine-readable metadata for this resource, or null if there is no metadata for this resource.

getInputURI

public abstract java.net.URI getInputURI()
Description copied from interface: SSWAPResource
Gets the URI pointing to a human-readable user interface for this resource. This URI should be dereferenceable or null.

Specified by:
getInputURI in interface SSWAPResource
Returns:
URI pointing to a human-readable user interface for this resource, or null if there is no such interface for this resource.

setInputURI

public abstract void setInputURI(java.net.URI inputURI)
Description copied from interface: SSWAPResource
Sets the URI pointing to a human-readable user interface for this resource. This URI should be dereferencable or null.

Specified by:
setInputURI in interface SSWAPResource
Parameters:
inputURI - URI pointing to a human-readable interface for this resource, or null if there is no such interface for this resource.

getOutputURI

public abstract java.net.URI getOutputURI()
Specified by:
getOutputURI in interface SSWAPResource

setOutputURI

public abstract void setOutputURI(java.net.URI outputURI)
Specified by:
setOutputURI in interface SSWAPResource

getIcon

public abstract java.net.URI getIcon()
Description copied from interface: SSWAPResource
Gets the URI of the icon for this resource (if defined).

Specified by:
getIcon in interface SSWAPResource
Returns:
the URI of the icon or null

setIcon

public abstract void setIcon(java.net.URI icon)
Description copied from interface: SSWAPResource
Sets the URI of the icon for this resource

Specified by:
setIcon in interface SSWAPResource
Parameters:
icon - the URI of the icon or null

getProvidedBy

public abstract ProviderImpl getProvidedBy()

setProvidedBy

public abstract void setProvidedBy(ProviderImpl provider)

getProvider

public SSWAPProvider getProvider()
Description copied from interface: SSWAPResource
Gets the object describing the provider of this resource. Since the information about the provider is typically stored in another graph (PDG), this object is not dereferenced.

Specified by:
getProvider in interface SSWAPResource
Returns:
a non-dereferenced SSWAPProvider for this resource.

setProvider

public void setProvider(SSWAPProvider provider)
Description copied from interface: SSWAPResource
Sets the provider for this resource. Since the resource descriptions usually do not contain more information than the URI of the provider, this method can accept either dereferenced or non-dereferenced SSWAPProvider object.

Specified by:
setProvider in interface SSWAPResource
Parameters:
provider - a SSWAPProvider object.

getGraph

public SSWAPGraph getGraph()
Description copied from interface: SSWAPResource
Gets the SSWAP graph of the resource. If the resource has more than one graph, the first graph is returned.

Specified by:
getGraph in interface SSWAPResource
Returns:
the SSWAPGraph object (a dereferenced one, since this information is typically within the same document as the resource description).

setGraph

public void setGraph(SSWAPGraph graph)
Description copied from interface: SSWAPResource
Sets the SSWAPGraph for this resource. If the resource has more than one graph at the moment, they will be removed, and only the one set here will remain.

Specified by:
setGraph in interface SSWAPResource
Parameters:
graph - the graph to be set for this resource

getOperatesOnEmpireList

public abstract java.util.List<GraphImpl> getOperatesOnEmpireList()
Gets a list of SSWAPGraph implementations that are all connected to this SSWAPResource by sswap:operatesOn predicate.

Returns:
a list of SSWAPGraph implementations. The list may be either empty or null, if there are no such graphs.

getOperatesOnList

public java.util.List<GraphImpl> getOperatesOnList()

setOperatesOnEmpireList

public abstract void setOperatesOnEmpireList(java.util.List<GraphImpl> graphImpls)
Sets a list of SSWAPGraph implementations that will all be connected to this SSWAPResource by sswap:operatesOn predicate.

Parameters:
graphImpls - a list of SSWAPGraph implementations.

getGraphs

public java.util.Collection<SSWAPGraph> getGraphs()
Description copied from interface: SSWAPResource
Gets all the SSWAP graphs of the resource.

Specified by:
getGraphs in interface SSWAPResource
Returns:
a collection of the SSWAPGraph objects. All objects are dereferenced one, since this information is typically within the same document as the resource description.

setGraphs

public void setGraphs(java.util.Collection<SSWAPGraph> graphs)
Description copied from interface: SSWAPResource
Sets the SSWAPGraphs for this resource. If the resource has any other graphs, they will be replaced with the ones provided here.

Specified by:
setGraphs in interface SSWAPResource
Parameters:
graphs - a collection of SSWAPGraphs

detachExistingGraphs

private void detachExistingGraphs()

isWithinRQG

private boolean isWithinRQG()
Checks whether this SSWAPResource is within an RQG (this affects the validation process).

Returns:
true if this resource is within an RQG, false otherwise

validate

public void validate()
              throws ValidationException
Description copied from interface: SSWAPModel
Verifies whether the underlying RDF data conforms to SSWAP syntax and requirements.

Specified by:
validate in interface SSWAPModel
Overrides:
validate in class ModelImpl
Throws:
ValidationException - if the data violates SSWAP syntax or requirements

validateProvider

public void validateProvider()
                      throws ValidationException
Specified by:
validateProvider in interface SSWAPResource
Throws:
ValidationException

getRDG

public RDG getRDG()
           throws DataAccessException
Description copied from interface: SSWAPResource
Gets the RDG where this resource is defined.

Specified by:
getRDG in interface SSWAPResource
Returns:
the RDG
Throws:
DataAccessException - if it is necessary to retrieve the whole RDG and an error should occur while accessing it

setDefaultParameterValues

void setDefaultParameterValues(IndividualImpl rdgIndividual)
Description copied from class: IndividualImpl
Sets the default parameter values for this individual based on the information from the individual in an RDG.

Overrides:
setDefaultParameterValues in class IndividualImpl


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