info.sswap.impl.empire.model
Class SourceModelImpl

java.lang.Object
  extended by info.sswap.impl.empire.model.ModelImpl
      extended by info.sswap.impl.empire.model.SourceModelImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPDocument, SSWAPModel, SourceModel
Direct Known Subclasses:
PDGImpl, ProtocolImpl

public abstract class SourceModelImpl
extends ModelImpl
implements SourceModel

Implementation of SSWAP model that is directly backed by a Jena model.

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  java.util.Map<java.util.Set<SSWAPType>,SSWAPType> cachedIntersectionTypes
          A cache for intersection types created via this source model (to avoid recreating them) The keys are set of the types in the intersection and the value is the corresponding intersection type
private  SSWAPDocument closedWorldModel
           
private  boolean closureEnabled
          Flag whether closure computation is enabled for this source model
private  com.hp.hpl.jena.rdf.model.Model closureModel
          The Jena model containing the closure.
private  java.util.Map<java.net.URI,DatatypeImpl> datatypeImpls
           
private  java.util.List<ModelImpl> dependentModels
          All other SSWAPModels that are based on the information from the Jena model.
private  java.util.Map<java.net.URI,java.util.List<ModelImpl>> dependentModelsMap
          Mapping of URIs of dependent models to actual models.
private  javax.persistence.EntityManager entityManager
          The entity manager that creates Empire objects based on the information from the Jena model.
private  ExpressivityChecker expressivityChecker
           
private  long maxClosureBytes
          A model-specific limit on the number of bytes during closure retrieval.
private  int maxClosureThreads
          A model-specific limit on number of threads during closure retrieval.
private  long maxClosureTime
          A model-specific limit on time (in ms) during closure retrieval.
private  com.hp.hpl.jena.rdf.model.Model model
          The actual Jena model
private  ModelResolver mResolver
           
private static java.lang.String OWL_IMPORTS_URI
          The URI for "owl:imports" property
private static java.lang.String OWL_ONTOLOGY_URI
          The URI for "owl:Ontology" resource
private  boolean owlDlRequired
           
private  java.util.Map<java.net.URI,PredicateImpl> predicateImpls
           
private static java.lang.String RDF_TYPE_URI
          The URI for "rdf:type" property
private  ReasoningServiceImpl reasoningServiceImpl
          The reasoning service (wrapping a PelletReasoner) for this Jena model.
static java.lang.String SSWAP_ONTOLOGY_URI
          The URI used for ontology imports
private  java.util.Map<java.net.URI,TypeImpl> typeImpls
          A cache of all SSWAP type implementations defined in this Jena model.
private  boolean valueValidationEnabled
           
 
Constructor Summary
SourceModelImpl()
          Initializes an empty, undereferenced SourceModel
 
Method Summary
 void addDependentModel(ModelImpl dependentModel)
          Adds a dependent SSWAP Model to this source model (i.e., a SSWAP model that is created based on the information read from the Jena model)
 void addImport(java.net.URI uri)
          Adds an import to the list of OWL imports of this model.
 boolean checkProfile(Expressivity expressivity)
          Checks whether the model fits a particular expressivity profile (e.g., OWL2 DL)
 SSWAPDatatype createAnonymousDatatype()
          Creates an anonymous SSWAPDatatype
 SSWAPType createAnonymousRestrictionType()
           
 SSWAPType createAnonymousType()
          Creates anonymous type.
protected
<T extends SSWAPIndividual>
T
createCopyObject(T sourceIndividual, java.net.URI copyURI)
           
 SSWAPIndividual createIndividual()
          Creates an anonymous SSWAPIndividual (blank node).
 SSWAPIndividual createIndividual(java.net.URI uri)
          Creates a SSWAPIndividual representation of a specific resource (URI).
 SSWAPType createIntersectionOf(java.util.Collection<SSWAPType> types)
          Creates a SSWAPType in the specified model that is an intersection of the given types.
 SSWAPList createList()
          Creates an empty list.
 SSWAPLiteral createLiteral(java.lang.String value)
          Creates a literal with the specified value.
private  com.hp.hpl.jena.rdf.model.Resource createOwlOntologyResource()
          Creates a correct main owl:Ontology resource in the model (i.e., the one with URI of http://sswapmeet.sswap.info/sswap/owlImports) and typed as owl:Ontology.
 SSWAPLiteral createTypedLiteral(java.lang.String value, java.net.URI datatypeURI)
          Creates a SSWAPElement that is a typed literal with the specified value.
 SSWAPType createUnionOf(java.util.Collection<SSWAPType> types)
          Creates a SSWAPType in the specified model that is a union of the given types.
 void dereference()
          If the object is not dereferenced, it dereferences it.
 void dereference(java.io.InputStream is)
          Dereferences the object (if it is not yet dereferenced) but it reads the data from the given stream, rather than trying to to retrieve the URI of this object.
 void dereference(com.hp.hpl.jena.rdf.model.Model model)
          Attempts to populate the model with data retrieved from the given Jena model.
 int doClosure()
          Computes closure for this model.
private  void doDereference(java.lang.Object source)
          Performs actual dereferencing
 boolean equals(java.lang.Object o)
           
 com.hp.hpl.jena.rdf.model.Model getClosedWorldModel()
          Gets the model that is used to close the worlds for specific parts of this model (but the statements from the closed world model should not "pollute" the main model).
 com.hp.hpl.jena.rdf.model.Model getClosureModel()
          Gets the Jena model containing the closure.
private static int getConnectTimeout()
           
 SSWAPDatatype getDatatype(java.net.URI uri)
          Gets a named datatype object
 SSWAPModel getDependentModel(java.net.URI uri)
          Returns the dependent model, identified by its URI, for this source model
<T extends SSWAPModel>
T
getDependentModel(java.net.URI uri, java.lang.Class<T> clazz)
           
private  java.util.List<ModelImpl> getDependentModelList(java.net.URI uri)
           
 java.util.Collection<SSWAPModel> getDependentModels(java.net.URI uri)
          Returns all dependent models with the specified uri
 javax.persistence.EntityManager getEntityManager()
          Gets the Empire Entity manager that manages objects created based on the information from that Jena model
private  ExpressivityChecker getExpressivityChecker()
           
 java.util.Collection<java.lang.String> getImports()
          Gets the list of OWL imports in this model (the top-level only).
 SSWAPDocument getInferredABox()
           
 SSWAPDocument getInferredTBox()
           
 SSWAPType getIntersectionType(java.util.Set<SSWAPType> intersectionComponents)
           
 long getMaxClosureBytes()
           
 long getMaxClosureThreads()
           
 long getMaxClosureTime()
           
 com.hp.hpl.jena.rdf.model.Model getModel()
          Gets the underlying Jena model.
protected  ModelResolver getModelResolver()
           
 java.util.Map<java.lang.String,java.lang.String> getNsPrefixMap()
          Gets the map of currently defined namespace prefixes.
private  com.hp.hpl.jena.rdf.model.Resource getOwlOntologyResource()
          Gets the main owl:Ontology resource in the model, if there is one.
 SSWAPPredicate getPredicate(java.net.URI uri)
          Gets a SSWAPPredicate object for the given property URI.
private static int getReadTimeout()
           
 ReasoningService getReasoningService()
          Gets the reasoning service associated with the underlying RDF data
 SSWAPType getType(java.net.URI uri)
          Gets a SSWAPType for an URI.
 int hashCode()
          Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method.
protected  boolean hasJenaModel()
           
 boolean isClosureEnabled()
          Returns information whether this source model will perform the closure to deliver terms to its reasoning service
protected  boolean isOwlDlRequired()
           
 boolean isValueValidationEnabled()
          Returns information whether this source model performs validation of values for properties.
<T extends SSWAPIndividual>
T
newIndividual(T sourceIndividual)
          Creates a new, anonymous individual, and populates it with data from the sourceIndividual (essentially clones the source individual).
<T extends SSWAPIndividual>
T
newIndividual(T sourceIndividual, java.net.URI copyURI)
          Copies the data from the sourceIndividual into the individual whose URI is passed as targetURI.
 void persist()
          Writes back any changes to the entity manager and underlying model
 void refresh()
          Refreshes the information encoded in this SSWAP model (and all dependent models) with the information stored in the underlying Jena model.
 void removeDependentModel(ModelImpl dependentModel)
          Removes a dependent SSWAP model from this source model
 void removeImport(java.net.URI uri)
          Removes an import from the list of imports
 void removeNsPrefix(java.lang.String prefix)
          Removes a namespace prefix.
protected  void resetReasoningService()
           
 void serialize(java.io.OutputStream os)
          Serializes the contents of this object to the specified stream as RDF/XML.
 void serialize(java.io.OutputStream os, RDFRepresentation rdfRepresentation, boolean commentedOutput)
          Serializes the contents of this object to the specified stream.
 void setClosureEnabled(boolean closureEnabled)
          Sets flag whether this source model will perform the closure to deliver terms to its reasoning service, or whether the reasoning service should solely rely on terms in this source model.
protected  void setClosureModel(com.hp.hpl.jena.rdf.model.Model clModel)
           
 void setEntityManager(javax.persistence.EntityManager entityManager)
          Sets the Empire Entity manager that manages objects created based on the information from that Jena model.
 void setMaxClosureBytes(long maxClosureBytes)
          Sets a model-specific byte limit for retrieving closure for this source model, or restores the system-wide limit.
 void setMaxClosureThreads(int maxClosureThreads)
          Sets a model-specific concurrent thread limit for retrieving closure for this source model, or restores the system-wide limit.
 void setMaxClosureTime(long maxClosureTime)
          Sets a model-specific time limit for retrieving closure for this source model, or restores the system-wide limit.
 void setModel(com.hp.hpl.jena.rdf.model.Model model)
          Replaces the underlying Jena model with another one.
 void setNsPrefix(java.lang.String prefix, java.net.URI uri)
          Sets a namespace prefix that will be used in serialization of this model.
protected  void setOwlDlRequired(boolean owlDlRequired)
           
 void setValueValidationEnabled(boolean validationEnabled)
          Turns on or off validation of values for properties in this model (i.e., values set via SSWAPIndividual.addProperty() and SSWAPIndividual.setProperty() methods)
 void validate()
          Verifies whether the underlying RDF data conforms to SSWAP syntax and requirements.
 void validate(boolean strict)
           
 
Methods inherited from class info.sswap.impl.empire.model.ModelImpl
assertModel, assertSourceModel, getAllDependentObjects, getDependentObject, getDocument, getExpressivity, getInputStream, getSourceModel, getTypeSignature, getURI, hasSourceModel, hasSourceModelWithEntityManager, isDereferenced, rdfIdEquals, rdfIdHashCode, refreshSiblings, setDereferenced, setSourceModel, setURI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.sswap.impl.empire.model.SourceModel
isDereferenced
 
Methods inherited from interface info.sswap.api.model.SSWAPModel
getDocument, getInputStream, getTypeSignature, getURI
 
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId
getRdfId, setRdfId
 

Field Detail

SSWAP_ONTOLOGY_URI

public static final java.lang.String SSWAP_ONTOLOGY_URI
The URI used for ontology imports

See Also:
Constant Field Values

OWL_ONTOLOGY_URI

private static final java.lang.String OWL_ONTOLOGY_URI
The URI for "owl:Ontology" resource

See Also:
Constant Field Values

OWL_IMPORTS_URI

private static final java.lang.String OWL_IMPORTS_URI
The URI for "owl:imports" property

See Also:
Constant Field Values

RDF_TYPE_URI

private static final java.lang.String RDF_TYPE_URI
The URI for "rdf:type" property

See Also:
Constant Field Values

entityManager

private javax.persistence.EntityManager entityManager
The entity manager that creates Empire objects based on the information from the Jena model.


model

private com.hp.hpl.jena.rdf.model.Model model
The actual Jena model


closureModel

private com.hp.hpl.jena.rdf.model.Model closureModel
The Jena model containing the closure.


closedWorldModel

private SSWAPDocument closedWorldModel

maxClosureBytes

private long maxClosureBytes
A model-specific limit on the number of bytes during closure retrieval. Value of -1 means that a system-wide limit should be used for this model.


maxClosureTime

private long maxClosureTime
A model-specific limit on time (in ms) during closure retrieval. Value of -1 means that a system-wide limit should be used for this model.


maxClosureThreads

private int maxClosureThreads
A model-specific limit on number of threads during closure retrieval. Value of -1 means that a system-wide limit should be used for this model.


closureEnabled

private boolean closureEnabled
Flag whether closure computation is enabled for this source model


dependentModels

private java.util.List<ModelImpl> dependentModels
All other SSWAPModels that are based on the information from the Jena model. (They are considered dependent objects of this object). This list is mostly maintained for the purpose of refreshing the dependent models should the data in the underlying Jena model should change (e.g., during a dereference process).


dependentModelsMap

private java.util.Map<java.net.URI,java.util.List<ModelImpl>> dependentModelsMap
Mapping of URIs of dependent models to actual models.


reasoningServiceImpl

private ReasoningServiceImpl reasoningServiceImpl
The reasoning service (wrapping a PelletReasoner) for this Jena model. This field may be null -- it is lazily initialized when a ReasoningService is requested for the first time. (The initialization may take some time since Pellet is performing classification during that time.)


owlDlRequired

private boolean owlDlRequired

typeImpls

private java.util.Map<java.net.URI,TypeImpl> typeImpls
A cache of all SSWAP type implementations defined in this Jena model.


cachedIntersectionTypes

private java.util.Map<java.util.Set<SSWAPType>,SSWAPType> cachedIntersectionTypes
A cache for intersection types created via this source model (to avoid recreating them) The keys are set of the types in the intersection and the value is the corresponding intersection type


predicateImpls

private java.util.Map<java.net.URI,PredicateImpl> predicateImpls

datatypeImpls

private java.util.Map<java.net.URI,DatatypeImpl> datatypeImpls

expressivityChecker

private ExpressivityChecker expressivityChecker

mResolver

private final ModelResolver mResolver

valueValidationEnabled

private boolean valueValidationEnabled
Constructor Detail

SourceModelImpl

public SourceModelImpl()
Initializes an empty, undereferenced SourceModel

Method Detail

addDependentModel

public void addDependentModel(ModelImpl dependentModel)
Description copied from interface: SourceModel
Adds a dependent SSWAP Model to this source model (i.e., a SSWAP model that is created based on the information read from the Jena model)

Specified by:
addDependentModel in interface SourceModel
Parameters:
dependentModel - the dependent model

getDependentModelList

private java.util.List<ModelImpl> getDependentModelList(java.net.URI uri)

removeDependentModel

public void removeDependentModel(ModelImpl dependentModel)
Description copied from interface: SourceModel
Removes a dependent SSWAP model from this source model

Specified by:
removeDependentModel in interface SourceModel
Parameters:
dependentModel - the dependent model to be removed

isValueValidationEnabled

public boolean isValueValidationEnabled()
Description copied from interface: SourceModel
Returns information whether this source model performs validation of values for properties.

Specified by:
isValueValidationEnabled in interface SourceModel
Returns:
true if the validation for the values is enabled.

setValueValidationEnabled

public void setValueValidationEnabled(boolean validationEnabled)
Description copied from interface: SourceModel
Turns on or off validation of values for properties in this model (i.e., values set via SSWAPIndividual.addProperty() and SSWAPIndividual.setProperty() methods)

Specified by:
setValueValidationEnabled in interface SourceModel
Parameters:
validationEnabled - true if the values should be validated, false if the validation should be turned off

isClosureEnabled

public boolean isClosureEnabled()
Description copied from interface: SourceModel
Returns information whether this source model will perform the closure to deliver terms to its reasoning service

Specified by:
isClosureEnabled in interface SourceModel
Returns:
true, if the source model will perform closure, false otherwise

setClosureEnabled

public void setClosureEnabled(boolean closureEnabled)
Description copied from interface: SourceModel
Sets flag whether this source model will perform the closure to deliver terms to its reasoning service, or whether the reasoning service should solely rely on terms in this source model. Changing this flag has only effect if the reasoning service has not yet been initialized.

Specified by:
setClosureEnabled in interface SourceModel

getDependentModel

public SSWAPModel getDependentModel(java.net.URI uri)
Description copied from interface: SourceModel
Returns the dependent model, identified by its URI, for this source model

Specified by:
getDependentModel in interface SourceModel
Returns:
the dependent model

getDependentModels

public java.util.Collection<SSWAPModel> getDependentModels(java.net.URI uri)
Description copied from interface: SourceModel
Returns all dependent models with the specified uri

Specified by:
getDependentModels in interface SourceModel
Parameters:
uri - the uri
Returns:
collection of dependent models

getDependentModel

public <T extends SSWAPModel> T getDependentModel(java.net.URI uri,
                                                  java.lang.Class<T> clazz)

getEntityManager

public javax.persistence.EntityManager getEntityManager()
Description copied from interface: SourceModel
Gets the Empire Entity manager that manages objects created based on the information from that Jena model

Specified by:
getEntityManager in interface SourceModel
Returns:
the Empire Entity manager

getModel

public com.hp.hpl.jena.rdf.model.Model getModel()
Description copied from interface: SourceModel
Gets the underlying Jena model.

Specified by:
getModel in interface SourceModel
Returns:
the underlying Jena model.

getClosureModel

public com.hp.hpl.jena.rdf.model.Model getClosureModel()
Description copied from interface: SourceModel
Gets the Jena model containing the closure. If the closure is not available, it will be computed.

Specified by:
getClosureModel in interface SourceModel
Returns:
the closure

getClosedWorldModel

public com.hp.hpl.jena.rdf.model.Model getClosedWorldModel()
Description copied from interface: SourceModel
Gets the model that is used to close the worlds for specific parts of this model (but the statements from the closed world model should not "pollute" the main model).

Specified by:
getClosedWorldModel in interface SourceModel
Returns:
the model where statements for closing the world are stored

setEntityManager

public void setEntityManager(javax.persistence.EntityManager entityManager)
Description copied from interface: SourceModel
Sets the Empire Entity manager that manages objects created based on the information from that Jena model.

Specified by:
setEntityManager in interface SourceModel
Parameters:
entityManager - the Empire entity manager for the Jena model

setModel

public void setModel(com.hp.hpl.jena.rdf.model.Model model)
Description copied from interface: SourceModel
Replaces the underlying Jena model with another one.

Specified by:
setModel in interface SourceModel
Parameters:
model - the new model.

getConnectTimeout

private static int getConnectTimeout()

getReadTimeout

private static int getReadTimeout()

dereference

public void dereference()
                 throws DataAccessException
Description copied from interface: SSWAPModel
If the object is not dereferenced, it dereferences it. This involves retrieving the underlying RDF data, and may result in a network connection.

Specified by:
dereference in interface SSWAPModel
Specified by:
dereference in interface SourceModel
Overrides:
dereference in class ModelImpl
Throws:
DataAccessException - if an error occurred while trying to read the data (e.g., the data source is unavailable or it is impossible to parse)

dereference

public void dereference(java.io.InputStream is)
                 throws DataAccessException
Description copied from interface: SSWAPModel
Dereferences the object (if it is not yet dereferenced) but it reads the data from the given stream, rather than trying to to retrieve the URI of this object. (Avoids network connectivity.)

Specified by:
dereference in interface SSWAPModel
Specified by:
dereference in interface SourceModel
Overrides:
dereference in class ModelImpl
Parameters:
is - the input stream from which the data should be read instead of establishing a network connection
Throws:
DataAccessException - if an error occurred while trying to read the data (e.g., the data source is unavailable or it is impossible to parse)

doDereference

private void doDereference(java.lang.Object source)
                    throws DataAccessException
Performs actual dereferencing

Parameters:
source -
Throws:
DataAccessException - if a problem should occur while accessing the underlying data source

dereference

public void dereference(com.hp.hpl.jena.rdf.model.Model model)
Description copied from interface: SourceModel
Attempts to populate the model with data retrieved from the given Jena model.

Specified by:
dereference in interface SourceModel
Parameters:
model - the Jena model that contains the data

doClosure

public int doClosure()
Computes closure for this model.

Specified by:
doClosure in interface SSWAPModel
Specified by:
doClosure in interface SourceModel
Overrides:
doClosure in class ModelImpl
Returns:
the degree of the closure computed.

getExpressivityChecker

private ExpressivityChecker getExpressivityChecker()

checkProfile

public boolean checkProfile(Expressivity expressivity)
Description copied from interface: SSWAPModel
Checks whether the model fits a particular expressivity profile (e.g., OWL2 DL)

Specified by:
checkProfile in interface SSWAPModel
Specified by:
checkProfile in interface SourceModel
Overrides:
checkProfile in class ModelImpl
Parameters:
expressivity - expressivity profile
Returns:
true if the model fits the specified expressivity

refresh

public void refresh()
Refreshes the information encoded in this SSWAP model (and all dependent models) with the information stored in the underlying Jena model.

Overrides:
refresh in class ModelImpl

getReasoningService

public ReasoningService getReasoningService()
Description copied from interface: SSWAPModel
Gets the reasoning service associated with the underlying RDF data

Specified by:
getReasoningService in interface SSWAPModel
Specified by:
getReasoningService in interface SourceModel
Overrides:
getReasoningService in class ModelImpl
Returns:
the reasoning service

getType

public SSWAPType getType(java.net.URI uri)
Description copied from interface: SSWAPDocument
Gets a SSWAPType for an URI.

Specified by:
getType in interface SSWAPDocument
Parameters:
uri - the URI of the type
Returns:
a SSWAPType for the URI.

getIntersectionType

public SSWAPType getIntersectionType(java.util.Set<SSWAPType> intersectionComponents)

getPredicate

public SSWAPPredicate getPredicate(java.net.URI uri)
Description copied from interface: SSWAPDocument
Gets a SSWAPPredicate object for the given property URI. A non-dereferencable URI will "create" a predicate.

Specified by:
getPredicate in interface SSWAPDocument
Parameters:
uri - the URI of the property
Returns:
the SSWAPPredicate object

getDatatype

public SSWAPDatatype getDatatype(java.net.URI uri)
Description copied from interface: SSWAPDocument
Gets a named datatype object

Specified by:
getDatatype in interface SSWAPDocument
Parameters:
uri - the URI of the datatype
Returns:
the datatype

persist

public void persist()
Writes back any changes to the entity manager and underlying model

Overrides:
persist in class ModelImpl

serialize

public void serialize(java.io.OutputStream os)
Description copied from interface: SSWAPModel
Serializes the contents of this object to the specified stream as RDF/XML.

Specified by:
serialize in interface SSWAPModel
Specified by:
serialize in interface SourceModel
Overrides:
serialize in class ModelImpl
Parameters:
os - output stream

serialize

public void serialize(java.io.OutputStream os,
                      RDFRepresentation rdfRepresentation,
                      boolean commentedOutput)
Description copied from interface: SSWAPModel
Serializes the contents of this object to the specified stream.

Specified by:
serialize in interface SSWAPModel
Specified by:
serialize in interface SourceModel
Overrides:
serialize in class ModelImpl
Parameters:
os - output stream
rdfRepresentation - the representation, in which the contents should be written (e.g., RDF/XML).
commentedOutput - true, if the output should contain comments about various standard sections of an RDG (valid only for RDF/XML)

setNsPrefix

public void setNsPrefix(java.lang.String prefix,
                        java.net.URI uri)
Description copied from interface: SSWAPModel
Sets a namespace prefix that will be used in serialization of this model.

Specified by:
setNsPrefix in interface SSWAPModel
Specified by:
setNsPrefix in interface SourceModel
Overrides:
setNsPrefix in class ModelImpl
Parameters:
prefix - the prefix
uri - the corresponding URI

removeNsPrefix

public void removeNsPrefix(java.lang.String prefix)
Description copied from interface: SSWAPModel
Removes a namespace prefix. (The prefixes are used in serialization of this model.)

Specified by:
removeNsPrefix in interface SSWAPModel
Specified by:
removeNsPrefix in interface SourceModel
Overrides:
removeNsPrefix in class ModelImpl
Parameters:
prefix - the prefix to be removed.

getNsPrefixMap

public java.util.Map<java.lang.String,java.lang.String> getNsPrefixMap()
Description copied from interface: SSWAPModel
Gets the map of currently defined namespace prefixes. (These prefixes are used in serialization of this model.)

Specified by:
getNsPrefixMap in interface SSWAPModel
Specified by:
getNsPrefixMap in interface SourceModel
Overrides:
getNsPrefixMap in class ModelImpl
Returns:
the map mapping prefixes to corresponding URIs

getOwlOntologyResource

private com.hp.hpl.jena.rdf.model.Resource getOwlOntologyResource()
Gets the main owl:Ontology resource in the model, if there is one. The main owl:Ontology needs to have a specific URI (http://sswapmeet.sswap.info/sswap/owlImports) and be typed as owl:Ontology.

Returns:
the resource for the main ontology or null, if there is no resource matching the criteria

createOwlOntologyResource

private com.hp.hpl.jena.rdf.model.Resource createOwlOntologyResource()
Creates a correct main owl:Ontology resource in the model (i.e., the one with URI of http://sswapmeet.sswap.info/sswap/owlImports) and typed as owl:Ontology.

Returns:
the created main owl:Ontology resource

getImports

public java.util.Collection<java.lang.String> getImports()
Description copied from class: ModelImpl
Gets the list of OWL imports in this model (the top-level only).

Specified by:
getImports in interface SSWAPModel
Specified by:
getImports in interface SourceModel
Overrides:
getImports in class ModelImpl
Returns:
a collection of uris of the imports

addImport

public void addImport(java.net.URI uri)
Description copied from class: ModelImpl
Adds an import to the list of OWL imports of this model. Adding a URI to the list of imports does not trigger the import itself (use doClosure()) for that purpose.

Specified by:
addImport in interface SSWAPModel
Specified by:
addImport in interface SourceModel
Overrides:
addImport in class ModelImpl
Parameters:
uri - the URI of the import to be added

removeImport

public void removeImport(java.net.URI uri)
Description copied from class: ModelImpl
Removes an import from the list of imports

Specified by:
removeImport in interface SSWAPModel
Specified by:
removeImport in interface SourceModel
Overrides:
removeImport in class ModelImpl
Parameters:
uri - the import to be removed

hasJenaModel

protected boolean hasJenaModel()

isOwlDlRequired

protected boolean isOwlDlRequired()

setOwlDlRequired

protected void setOwlDlRequired(boolean owlDlRequired)

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

validate

public void validate(boolean strict)
              throws ValidationException
Throws:
ValidationException

createAnonymousType

public SSWAPType createAnonymousType()
Description copied from interface: SSWAPDocument
Creates anonymous type.

Specified by:
createAnonymousType in interface SSWAPDocument
Returns:
an anonymous type

createAnonymousRestrictionType

public SSWAPType createAnonymousRestrictionType()

createIndividual

public SSWAPIndividual createIndividual()
Description copied from interface: SSWAPDocument
Creates an anonymous SSWAPIndividual (blank node). This method can be used to create a custom individual (i.e., other than the SSWAPNodes like Subject, Object, Resource etc.)

Specified by:
createIndividual in interface SSWAPDocument
Returns:
the created individual

createIndividual

public SSWAPIndividual createIndividual(java.net.URI uri)
Description copied from interface: SSWAPDocument
Creates a SSWAPIndividual representation of a specific resource (URI). This method can be used to create a custom individual (i.e., other than the SSWAPNodes like Subject, Object, Resource etc.)

Specified by:
createIndividual in interface SSWAPDocument
Parameters:
uri - the URI of the individual to be created; may be null, in which case an anonymous individual is created
Returns:
the created individual

createList

public SSWAPList createList()
Description copied from interface: SSWAPDocument
Creates an empty list.

Specified by:
createList in interface SSWAPDocument
Returns:
a list.

createLiteral

public SSWAPLiteral createLiteral(java.lang.String value)
Description copied from interface: SSWAPDocument
Creates a literal with the specified value.

Specified by:
createLiteral in interface SSWAPDocument
Parameters:
value - the value of the literal
Returns:
the created literal

createTypedLiteral

public SSWAPLiteral createTypedLiteral(java.lang.String value,
                                       java.net.URI datatypeURI)
                                throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPDocument
Creates a SSWAPElement that is a typed literal with the specified value.

Specified by:
createTypedLiteral in interface SSWAPDocument
Parameters:
value - the value of the literal
datatypeURI - the URI of the datatype
Returns:
the created typed literal
Throws:
java.lang.IllegalArgumentException - if the value is not valid according to the declared datatype URI

createIntersectionOf

public SSWAPType createIntersectionOf(java.util.Collection<SSWAPType> types)
Description copied from interface: SSWAPDocument
Creates a SSWAPType in the specified model that is an intersection of the given types.

Specified by:
createIntersectionOf in interface SSWAPDocument
Parameters:
types - the types
Returns:
an anonymous type that is an intersection of the the passed types

createUnionOf

public SSWAPType createUnionOf(java.util.Collection<SSWAPType> types)
Description copied from interface: SSWAPDocument
Creates a SSWAPType in the specified model that is a union of the given types.

Specified by:
createUnionOf in interface SSWAPDocument
Parameters:
types - the types
Returns:
an anonymous type that is a union of the given types.

createAnonymousDatatype

public SSWAPDatatype createAnonymousDatatype()
Description copied from interface: SSWAPDocument
Creates an anonymous SSWAPDatatype

Specified by:
createAnonymousDatatype in interface SSWAPDocument
Returns:
the datatype

getInferredTBox

public SSWAPDocument getInferredTBox()

getInferredABox

public SSWAPDocument getInferredABox()

setMaxClosureBytes

public void setMaxClosureBytes(long maxClosureBytes)
Description copied from interface: SourceModel
Sets a model-specific byte limit for retrieving closure for this source model, or restores the system-wide limit. Note: if closure has been computed for this model, calling this method has no effect

Specified by:
setMaxClosureBytes in interface SourceModel
Parameters:
maxClosureBytes - the new model-specific byte limit for closure for this model, or -1 to restore the system-wide limit

getMaxClosureBytes

public long getMaxClosureBytes()

setMaxClosureTime

public void setMaxClosureTime(long maxClosureTime)
Description copied from interface: SourceModel
Sets a model-specific time limit for retrieving closure for this source model, or restores the system-wide limit. Note: if closure has been computed for this model, calling this method has no effect

Specified by:
setMaxClosureTime in interface SourceModel
Parameters:
maxClosureTime - the new model-specific time limit (in ms) for closure for this model, or -1 to restore the system-wide limit

getMaxClosureTime

public long getMaxClosureTime()

setMaxClosureThreads

public void setMaxClosureThreads(int maxClosureThreads)
Description copied from interface: SourceModel
Sets a model-specific concurrent thread limit for retrieving closure for this source model, or restores the system-wide limit. Note: if closure has been computed for this model, calling this method has no effect

Specified by:
setMaxClosureThreads in interface SourceModel
Parameters:
maxClosureThreads - the new model-specific concurrent thread limit for closure for this model, or -1 to restore the system-wide limit

getMaxClosureThreads

public long getMaxClosureThreads()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode.

setClosureModel

protected void setClosureModel(com.hp.hpl.jena.rdf.model.Model clModel)

getModelResolver

protected ModelResolver getModelResolver()

resetReasoningService

protected void resetReasoningService()

newIndividual

public <T extends SSWAPIndividual> T newIndividual(T sourceIndividual)
Description copied from interface: SSWAPDocument
Creates a new, anonymous individual, and populates it with data from the sourceIndividual (essentially clones the source individual). This method is equivalent to newIndividual(sourceIndividual,null);

Specified by:
newIndividual in interface SSWAPDocument
Type Parameters:
T - the type of the individual
Parameters:
sourceIndividual - the individual to be used as a source of data for populating the new individual
Returns:
a clone of the individual (an anonymous individual)
See Also:
SSWAPDocument.newIndividual(SSWAPIndividual, URI)

newIndividual

public <T extends SSWAPIndividual> T newIndividual(T sourceIndividual,
                                                   java.net.URI copyURI)
Description copied from interface: SSWAPDocument
Copies the data from the sourceIndividual into the individual whose URI is passed as targetURI. If there is not yet an individual with such a URI, it is created. If targetURI is null, an anonymous individual is created.

Notes:

  1. The copy of the sourceIndividual is a deep copy; i.e., if there are any object properties with anonymous individuals as values, a deep copy is performed on those individuals recursively. If there are any object properties with named individuals as values, those named individual are not copied.
  2. The data being copied includes only types of the individual ( SSWAPType) and its properties (SSWAPProperty). In particular, associations with SSWAPNodes are not copied (e.g., if a SSWAPSubject is being copied, the copy will not contain references to SSWAPObjects or SSWAPGraphs; if desired, these must be made explicitly).
  3. Copying across documents is supported (i.e., passing an individual from a different SSWAPDocument to this method) -- a deep copy will be made across the documents, including named individuals. The restriction specified in (2) still holds (i.e., references to SSWAPNodes are not copied across documents).
  4. SSWAPNodes (e.g., SSWAPResource, SSWAPSubject, SSWAPObject) are supported only in SSWAPProtocol documents (e.g., RDG, RIG, RRG, RQG). An attempt to copy them into a generic SSWAPDocument (e.g., a document containing a definition of SSWAPType or owl:Class) throws an IllegalArgumentException.
  5. Copying types and properties from one individual to another can create logical inconsistencies. The usual precautions when adding types and properties should be observed.

Specified by:
newIndividual in interface SSWAPDocument
Type Parameters:
T - the type of the individual
Parameters:
sourceIndividual - the individual with the data to be copied
copyURI - the URI of the new individual; may be null for an anonymous individual
Returns:
new individual (with the specified uri)

createCopyObject

protected <T extends SSWAPIndividual> T createCopyObject(T sourceIndividual,
                                                         java.net.URI copyURI)


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