info.sswap.api.spi
Class ExtensionAPI

java.lang.Object
  extended by info.sswap.api.spi.ExtensionAPI

public class ExtensionAPI
extends java.lang.Object

An API for extensions of the basic SSWAP API. These are methods primarily for advanced users to aid in debugging. The methods in this API may not be be implemented by all API providers.

Author:
Blazej Bulka

Field Summary
private static APIProvider apiProvider
          The current provider of the API.
 
Constructor Summary
ExtensionAPI()
           
 
Method Summary
static com.hp.hpl.jena.rdf.model.Model asJenaModel(SSWAPModel model)
          Returns the representation of the given SSWAPModel using Jena interface
static SSWAPElement copyElement(SSWAPDocument dstDocument, SSWAPElement element)
          Performs a deep copy of an element, possibly to another document.
static RDG createCompositeService(java.net.URI serviceURI, java.lang.String name, java.lang.String description, java.net.URI providerURI, RDG firstService, RDG lastService)
           
static
<T extends SSWAPDocument>
T
createDocument(com.hp.hpl.jena.rdf.model.Model model, java.lang.Class<T> clazz)
          Creates a SSWAP document from the specified Jena model.
static
<T extends SSWAPDocument>
T
createDocument(com.hp.hpl.jena.rdf.model.Model model, java.lang.Class<T> clazz, java.net.URI uri)
          Creates a SSWAP document from the specified Jena model with the specified URI
static RQG generateRQG(RDG upstreamService, RDG downstreamService)
           
static RQG generateRQG(RDG upstreamService, RDG downstreamService, java.net.URI resultURI)
           
static RIG getAsyncRIG(java.net.URI serviceURI, java.net.URI upstreamRRG)
           
static SSWAPDocument getClosureDocument(SSWAPDocument document)
          Gets the SSWAPDocument that contains the closure of the specified document.
static SSWAPDocument getInferredABox(SSWAPDocument document)
          Gets the document that contains the ABox of this document (including both inferred and asserted statements).
static SSWAPDocument getInferredDocument(SSWAPDocument document)
          Gets the SSWAPDocument that contains all the inferred facts for the specified document (and subsequently it also contains its closure, which is required to compute the inferred facts).
static SSWAPDocument getInferredTBox(SSWAPDocument document)
          Gets the document that contains the TBox of this document (including both inferred and asserted statements).
static java.util.Collection<java.lang.String> getInferredTypeURIs(SSWAPIndividual individual)
           
static
<T extends SSWAPNode>
T
getUntranslatedNode(T translatedNode)
          Return the source node (SSWAPResource or SSWAPSubject) from which the translatedNode was derived.
static RQG inputOnlyRQG(RQG rqg)
           
static boolean isUnrestricted(RQG rqg)
           
static RQG outputOnlyRQG(RQG rqg)
           
static void setClosureEnabled(SSWAPDocument document, boolean enabled)
          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.
static void setExplanationSyntax(java.lang.String explanationSyntax)
          Sets the syntax in which explanations will be provided, if reasoning service finds an inconsistent ontology.
static void setMaxClosureBytes(SSWAPModel model, long byteLimit)
          Sets a model-specific byte limit to retrieve the closure
static void setMaxClosureThreads(SSWAPModel model, int threads)
          Sets a model-specific limit on the number of threads used to retrieve the closure
static void setMaxClosureTime(SSWAPModel model, long timeLimit)
          Sets a model-specific time limit to retrieve the closure
static void setValueValidation(SSWAPDocument document, boolean enabled)
          Turns on/off value validation performed when setting values of properties for SSWAPIndividual.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

apiProvider

private static APIProvider apiProvider
The current provider of the API. The actual creation of the objects is delegated to that provider. (This allows the API to be pluggable; that is, to easily switch the implementations.) As a general rule, the objects created by two different providers should not be mixed together (e.g., a SSWAPProvider created by one provider should not be added to a PDG created by another provider).

Constructor Detail

ExtensionAPI

public ExtensionAPI()
Method Detail

getInferredTBox

public static SSWAPDocument getInferredTBox(SSWAPDocument document)
Gets the document that contains the TBox of this document (including both inferred and asserted statements).

Parameters:
document - The source document from which to get the inferred TBox
Returns:
the document with the TBox

getInferredABox

public static SSWAPDocument getInferredABox(SSWAPDocument document)
Gets the document that contains the ABox of this document (including both inferred and asserted statements).

Parameters:
document - The source document from which to get the inferred ABox
Returns:
the document with the ABox

getClosureDocument

public static SSWAPDocument getClosureDocument(SSWAPDocument document)
Gets the SSWAPDocument that contains the closure of the specified document.

Parameters:
document - the closure document
Returns:
the closure document

getInferredDocument

public static SSWAPDocument getInferredDocument(SSWAPDocument document)
Gets the SSWAPDocument that contains all the inferred facts for the specified document (and subsequently it also contains its closure, which is required to compute the inferred facts). NOTE: In certain situations the number of inferred facts may be very large. Use this method with caution.

Parameters:
document - the documents for which all the inferred facts should be retrieved
Returns:
the document with all inferred facts

asJenaModel

public static com.hp.hpl.jena.rdf.model.Model asJenaModel(SSWAPModel model)
Returns the representation of the given SSWAPModel using Jena interface

Parameters:
model - the SSWAPModel
Returns:
Jena model that contains the representation of this document

createDocument

public static <T extends SSWAPDocument> T createDocument(com.hp.hpl.jena.rdf.model.Model model,
                                                         java.lang.Class<T> clazz)
Creates a SSWAP document from the specified Jena model.

Type Parameters:
T - template parameter to specify the desired document type
Parameters:
model - Jena model that will be the source of triples for the document
clazz - the name of the interface (e.g., SSWAPDocument.class or RDG.class) for the requested document
Returns:
the created document

createDocument

public static <T extends SSWAPDocument> T createDocument(com.hp.hpl.jena.rdf.model.Model model,
                                                         java.lang.Class<T> clazz,
                                                         java.net.URI uri)
Creates a SSWAP document from the specified Jena model with the specified URI

Type Parameters:
T - template parameter to specify the desired document type
Parameters:
model - Jena model that will be the source of triples for the document
clazz - the name of the interface (e.g., SSWAPDocument.class or RDG.class) for the requested document
uri - the URI of the generated document (matters only for SSWAPProtocol documents)
Returns:
the created document

setMaxClosureBytes

public static void setMaxClosureBytes(SSWAPModel model,
                                      long byteLimit)
                               throws java.lang.UnsupportedOperationException
Sets a model-specific byte limit to retrieve the closure

Parameters:
model - the model for which the limit should be set
byteLimit - the maximum number of bytes to retrieve the closure, or -1 to remove any previous model-specific limit (a system-wide limit will be used for this model)
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this API Implementation

setMaxClosureThreads

public static void setMaxClosureThreads(SSWAPModel model,
                                        int threads)
                                 throws java.lang.UnsupportedOperationException
Sets a model-specific limit on the number of threads used to retrieve the closure

Parameters:
model - the model for which the limit should be set
threads - the number of threads, or -1 to remove any previous model-specific limit (a system-wide limit will be used for this model)
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this API Implementation

setMaxClosureTime

public static void setMaxClosureTime(SSWAPModel model,
                                     long timeLimit)
                              throws java.lang.UnsupportedOperationException
Sets a model-specific time limit to retrieve the closure

Parameters:
model - the model for which the limit should be set
timeLimit - the maximum number of milliseconds to retrieve the closure, or -1 to remove any previous model-specific limit (a system-wide limit will be used for this model)
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this API Implementation

setExplanationSyntax

public static void setExplanationSyntax(java.lang.String explanationSyntax)
                                 throws java.lang.UnsupportedOperationException
Sets the syntax in which explanations will be provided, if reasoning service finds an inconsistent ontology. The legal values for the syntax are RDF/XML, RDF/XML-ABBREV, TURTLE, and PELLET (for standard Pellet explanations).

Parameters:
explanationSyntax - the desired syntax
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this API implementation

generateRQG

public static RQG generateRQG(RDG upstreamService,
                              RDG downstreamService)
                       throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

generateRQG

public static RQG generateRQG(RDG upstreamService,
                              RDG downstreamService,
                              java.net.URI resultURI)
                       throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

getAsyncRIG

public static RIG getAsyncRIG(java.net.URI serviceURI,
                              java.net.URI upstreamRRG)
                       throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

copyElement

public static SSWAPElement copyElement(SSWAPDocument dstDocument,
                                       SSWAPElement element)
                                throws java.lang.UnsupportedOperationException
Performs a deep copy of an element, possibly to another document.

Parameters:
dstDocument - the document where the copy should be placed.
element - the element to be copied.
Returns:
the copy
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this API implementation

setValueValidation

public static void setValueValidation(SSWAPDocument document,
                                      boolean enabled)
                               throws java.lang.UnsupportedOperationException
Turns on/off value validation performed when setting values of properties for SSWAPIndividual.

Parameters:
document - the document in which the validation should be turned on/off
enabled - true if the validation should be turned on, false, if the validation should be turned off
Throws:
java.lang.UnsupportedOperationException

setClosureEnabled

public static void setClosureEnabled(SSWAPDocument document,
                                     boolean enabled)
                              throws java.lang.UnsupportedOperationException
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.

Parameters:
document - the document in which the closure would be turned on or off
enabled - true if the closure computation should be turned on, false, if the closure computation should be turned off
Throws:
java.lang.UnsupportedOperationException

getInferredTypeURIs

public static java.util.Collection<java.lang.String> getInferredTypeURIs(SSWAPIndividual individual)
                                                                  throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

createCompositeService

public static RDG createCompositeService(java.net.URI serviceURI,
                                         java.lang.String name,
                                         java.lang.String description,
                                         java.net.URI providerURI,
                                         RDG firstService,
                                         RDG lastService)
                                  throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

inputOnlyRQG

public static RQG inputOnlyRQG(RQG rqg)
                        throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

outputOnlyRQG

public static RQG outputOnlyRQG(RQG rqg)
                         throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

isUnrestricted

public static boolean isUnrestricted(RQG rqg)
                              throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException

getUntranslatedNode

public static <T extends SSWAPNode> T getUntranslatedNode(T translatedNode)
                                               throws java.lang.UnsupportedOperationException
Return the source node (SSWAPResource or SSWAPSubject) from which the translatedNode was derived. If the translatedNode was not actually translated (i.e. is an untranslated SSWAPNode), then it itself is returned.

Type Parameters:
T - SSWAPResource or SSWAPSubject
Parameters:
translatedNode - translated individual for which its source is sought
Returns:
individual that was the source of the translation (e.g., RIG SSWAPResource or SSWAPSubject)
Throws:
java.lang.UnsupportedOperationException - upon an error retrieving the translation from the API provider
See Also:
RIG#translate(SSWAPNode)}


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