|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.impl.empire.model.ModelImpl
public abstract class ModelImpl
Implements SSWAPModel. The base class of all implementations of objects in SSWAP API. This class also implements SupportsRdfId, which is required for all Empire-managed classes. While actual Empire-managed classes are only few, and low in the hierarchy (e.g., PDG, Protocol Graphs, and Individuals), this interface provides an ability to relate this object with its definition in the RDF document (either via its URI or BNode Id). In general, the instances of this class will be a part of a SourceModel (aggregation). Since this object is (potentially) populated by data coming from an RDF graph, it has to be somehow related to that graph. SourceModel object is responsible for holding such a graph. Therefore, any dereferenced ModelImpl needs to have a reference to its SourceModel (and since the link between ModelImpl and SourceModel is bi-directional, the SourceModel also has a reference to the ModelImpl, as one of its dependent models). Note: the only current implementation of SourceModel interface is SourceModelImpl, and it inherits from ModelImpl. (For SourceModelImpl, the source model is the same as the object itself!)
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 boolean |
dereferenced
Flag indicating whether the object has been dereferenced (true). |
private SourceModel |
sourceModel
The reference to the source model; that is, the object that manages the Jena model containing the RDF data for this object. |
Constructor Summary | |
---|---|
protected |
ModelImpl()
Initializes this object. |
Method Summary | ||
---|---|---|
void |
addImport(java.net.URI uri)
Adds an import to the list of OWL imports of this model. |
|
private void |
addTermToSignature(java.util.Collection<java.net.URI> terms,
java.lang.String uri)
|
|
protected com.hp.hpl.jena.rdf.model.Model |
assertModel()
|
|
protected SourceModel |
assertSourceModel()
Gets the source model of a dereferenced ModelImpl |
|
private boolean |
belongs2RDForOWLVocabulary(java.lang.String term)
|
|
boolean |
checkProfile(Expressivity expressivity)
Checks whether the model fits a particular expressivity profile (e.g., OWL2 DL) |
|
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. |
|
int |
doClosure()
For every URI in the model, do successive HTTP GETs and read in the model. |
|
protected
|
getAllDependentObjects(java.lang.Class<T> clazz)
|
|
protected
|
getDependentObject(java.lang.Class<T> clazz)
Creates an object based on the data from the same data source as this one (e.g., if this object represents a PDG, it allows to get a SSWAPProvider from this data source; or a SSWAPResource from RDG). |
|
SSWAPDocument |
getDocument()
Retrieves the document that contains this SSWAPModel |
|
Expressivity |
getExpressivity()
|
|
java.util.Collection<java.lang.String> |
getImports()
Gets the list of OWL imports in this model (the top-level only). |
|
java.io.InputStream |
getInputStream()
Get input stream suitable for reading the serialized model. |
|
java.util.Map<java.lang.String,java.lang.String> |
getNsPrefixMap()
Gets the map of currently defined namespace prefixes. |
|
ReasoningService |
getReasoningService()
Gets the reasoning service associated with the underlying RDF data |
|
SourceModel |
getSourceModel()
Gets a reference to the current source model of this object (i.e., the object that holds the RDF graph that is the source of data for this object). |
|
java.util.Collection<java.net.URI> |
getTypeSignature(java.net.URI type)
Get the terms that comprise the definition of a URI term. |
|
java.net.URI |
getURI()
Get the URI. |
|
protected boolean |
hasSourceModel()
Checks whether this model has a source model associated with it |
|
protected boolean |
hasSourceModelWithEntityManager()
Checks whether this model has a source model associated with it that has an entity manager. |
|
boolean |
isDereferenced()
Returns whether this object represents a dereferenced content stored under the URI, or is it just the URI. |
|
void |
persist()
Writes back the changes to the underlying RDF graph. |
|
protected boolean |
rdfIdEquals(ModelImpl other)
|
|
protected int |
rdfIdHashCode()
|
|
void |
refresh()
Refreshes the data of this object (should be called, if the underlying RDF graph changed). |
|
protected void |
refreshSiblings()
Refreshes SSWAPModels that are considered siblings of this one (i.e., models that have the same URI). |
|
void |
removeImport(java.net.URI uri)
Removes an import from the list of imports |
|
void |
removeNsPrefix(java.lang.String prefix)
Removes a namespace prefix. |
|
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 representation,
boolean commentedOutput)
Serializes the contents of this object to the specified stream. |
|
protected void |
setDereferenced(boolean dereferenced)
Sets the dereference flag. |
|
void |
setNsPrefix(java.lang.String prefix,
java.net.URI uri)
Sets a namespace prefix that will be used in serialization of this model. |
|
void |
setSourceModel(SourceModel sourceModel)
Sets the source model for this object (i.e., the object that actually holds the Jena model with RDF data). |
|
void |
setURI(java.net.URI uri)
Sets the URI of this object. |
|
void |
validate()
Verifies whether the underlying RDF data conforms to SSWAP syntax and requirements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId |
---|
getRdfId, setRdfId |
Field Detail |
---|
private boolean dereferenced
private SourceModel sourceModel
Constructor Detail |
---|
protected ModelImpl()
Method Detail |
---|
public void dereference()
SSWAPModel
dereference
in interface SSWAPModel
public void dereference(java.io.InputStream is)
SSWAPModel
dereference
in interface SSWAPModel
is
- the input stream from which the data should be read instead of establishing a network connectionpublic int doClosure()
SSWAPModel
doClosure
in interface SSWAPModel
public Expressivity getExpressivity()
public boolean checkProfile(Expressivity expressivity)
SSWAPModel
checkProfile
in interface SSWAPModel
expressivity
- expressivity profile
public java.io.InputStream getInputStream()
SSWAPModel
getInputStream
in interface SSWAPModel
public java.net.URI getURI()
SSWAPModel
getURI
in interface SSWAPModel
public void setURI(java.net.URI uri)
uri
- the new uri of the objectpublic boolean isDereferenced()
SSWAPModel
isDereferenced
in interface SSWAPModel
protected void setDereferenced(boolean dereferenced)
dereferenced
- true if the object has been dereference, false otherwisepublic void serialize(java.io.OutputStream os)
SSWAPModel
serialize
in interface SSWAPModel
os
- output streampublic void serialize(java.io.OutputStream os, RDFRepresentation representation, boolean commentedOutput)
SSWAPModel
serialize
in interface SSWAPModel
os
- output streamrepresentation
- 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)public void validate() throws ValidationException
SSWAPModel
validate
in interface SSWAPModel
ValidationException
- if the data violates SSWAP syntax or requirementspublic void setSourceModel(SourceModel sourceModel)
sourceModel
- the new source modelpublic SourceModel getSourceModel()
protected <T extends ModelImpl> T getDependentObject(java.lang.Class<T> clazz)
T
- parameterized type of an Empire-annotated class to define what kind of data has to be retrievedclazz
- the Empire-annotated class
protected <T extends ModelImpl> java.util.Collection<T> getAllDependentObjects(java.lang.Class<T> clazz)
public void refresh()
public void persist()
protected void refreshSiblings()
public ReasoningService getReasoningService()
SSWAPModel
getReasoningService
in interface SSWAPModel
protected boolean rdfIdEquals(ModelImpl other)
protected int rdfIdHashCode()
public void setNsPrefix(java.lang.String prefix, java.net.URI uri)
SSWAPModel
setNsPrefix
in interface SSWAPModel
prefix
- the prefixuri
- the corresponding URIpublic void removeNsPrefix(java.lang.String prefix)
SSWAPModel
removeNsPrefix
in interface SSWAPModel
prefix
- the prefix to be removed.public java.util.Map<java.lang.String,java.lang.String> getNsPrefixMap()
SSWAPModel
getNsPrefixMap
in interface SSWAPModel
public java.util.Collection<java.lang.String> getImports()
getImports
in interface SSWAPModel
public void addImport(java.net.URI uri)
addImport
in interface SSWAPModel
uri
- the URI of the import to be addedpublic void removeImport(java.net.URI uri)
removeImport
in interface SSWAPModel
uri
- the import to be removedprotected boolean hasSourceModel()
protected boolean hasSourceModelWithEntityManager()
protected SourceModel assertSourceModel() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the model has not been dereferenced, and therefore does not have a source modelprotected com.hp.hpl.jena.rdf.model.Model assertModel() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public SSWAPDocument getDocument()
SSWAPModel
getDocument
in interface SSWAPModel
public java.util.Collection<java.net.URI> getTypeSignature(java.net.URI type)
SSWAPModel
getTypeSignature
in interface SSWAPModel
type
- URI to a resource or subject of RDF statements
private void addTermToSignature(java.util.Collection<java.net.URI> terms, java.lang.String uri)
private boolean belongs2RDForOWLVocabulary(java.lang.String term)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |