public class InteropFramework extends Object implements InteropMediaType
InteropFramework.ProvFormat). The class also provides helper functions to support content
negotiation.| Modifier and Type | Class and Description |
|---|---|
static class |
InteropFramework.ProvFormat
An enumerated type for all the PROV serializations supported by ProvToolbox.
|
static class |
InteropFramework.ProvFormatType |
| Modifier and Type | Field and Description |
|---|---|
Hashtable<InteropFramework.ProvFormat,String> |
extensionMap |
Hashtable<String,InteropFramework.ProvFormat> |
extensionRevMap |
Hashtable<InteropFramework.ProvFormat,String> |
mimeTypeMap |
Hashtable<String,InteropFramework.ProvFormat> |
mimeTypeRevMap |
Hashtable<InteropFramework.ProvFormat,InteropFramework.ProvFormatType> |
provTypeMap |
static String |
UNKNOWN |
ALL_PROV_INPUT_MEDIA_TYPES, ALL_PROV_OUTPUT_MEDIA_TYPES, EXTENSION_DOT, EXTENSION_JPEG, EXTENSION_JPG, EXTENSION_JSON, EXTENSION_PDF, EXTENSION_PNG, EXTENSION_PROVN, EXTENSION_PROVX, EXTENSION_RDF, EXTENSION_SVG, EXTENSION_TRIG, EXTENSION_TTL, EXTENSION_XML, MEDIA_APPLICATION_FORM_URLENCODED, MEDIA_APPLICATION_JSON, MEDIA_APPLICATION_PDF, MEDIA_APPLICATION_PROVENANCE_XML, MEDIA_APPLICATION_RDF_XML, MEDIA_APPLICATION_TRIG, MEDIA_APPLICATION_XML, MEDIA_IMAGE_JPEG, MEDIA_IMAGE_PNG, MEDIA_IMAGE_SVG_XML, MEDIA_TEXT_HTML, MEDIA_TEXT_PLAIN, MEDIA_TEXT_PROVENANCE_NOTATION, MEDIA_TEXT_TURTLE, MEDIA_TEXT_VND_GRAPHVIZ, MEDIA_TEXT_XML| Constructor and Description |
|---|
InteropFramework()
Default constructor for the ProvToolbox interoperability framework.
|
InteropFramework(org.openprovenance.prov.model.ProvFactory pFactory) |
InteropFramework(String verbose,
String debug,
String logfile,
String infile,
String outfile,
String namespaces,
String title,
String layout,
String bindings,
boolean addOrderp,
String generator,
String index,
String merge,
String flatten,
org.openprovenance.prov.model.ProvFactory pFactory)
Deprecated.
|
InteropFramework(String verbose,
String debug,
String logfile,
String infile,
String informat,
String outfile,
String outformat,
String namespaces,
String title,
String layout,
String bindings,
String bindingformat,
boolean addOrderp,
String generator,
String index,
String merge,
String flatten,
org.openprovenance.prov.model.ProvFactory pFactory) |
| Modifier and Type | Method and Description |
|---|---|
String |
buildAcceptHeader()
Create a list of mime types supported by ProvToolbox in view of constructing an Accept Header.
|
URLConnection |
connectWithRedirect(URL theURL)
A method to connect to a URL and follow redirects if any.
|
String |
convertExtensionToMediaType(String extension)
Maps an file extension to a Media type
|
String |
getExtension(InteropFramework.ProvFormat format)
Returns an extension for a given type of serialization of PROV
|
List<Map<String,String>> |
getSupportedFormats() |
InteropFramework.ProvFormat |
getTypeForFile(String filename)
Get a
InteropFramework.ProvFormat given the file's exetension |
InteropFramework.ProvFormat |
getTypeForFormat(String format)
Get a
InteropFramework.ProvFormat given a format string |
List<javax.ws.rs.core.Variant> |
getVariants()
Support for content negotiation, jax-rs style.
|
void |
initializeExtensionMap(Hashtable<InteropFramework.ProvFormat,String> extensionMap,
Hashtable<String,InteropFramework.ProvFormat> extensionRevMap)
Initialization function
|
Boolean |
isInputFormat(InteropFramework.ProvFormat format)
Determines whether this format received as argument is an input format.
|
Boolean |
isOutputFormat(InteropFramework.ProvFormat format)
Determines whether this format received as argument is an output format.
|
Object |
loadProvUnknownGraph(String filename)
Experimental code, trying to load a document without knowing its serialization format.
|
static org.openprovenance.prov.model.ProvFactory |
newXMLProvFactory()
Creates a factory for the XML Java beans.
|
void |
provn2html(String file,
String file2) |
org.openprovenance.prov.model.Document |
readDocument(InputStream is,
InteropFramework.ProvFormat format)
Reads a Document from an input stream, using the parser specified by the format argument.
|
org.openprovenance.prov.model.Document |
readDocument(InputStream is,
InteropFramework.ProvFormat format,
org.openprovenance.prov.model.ProvFactory pFactory)
Reads a Document from an input stream, using the parser specified by the format argument.
|
org.openprovenance.prov.model.Document |
readDocument(org.openprovenance.prov.interop.InteropFramework.ToRead something) |
org.openprovenance.prov.model.Document |
readDocument(String url)
Reads a document from a URL.
|
org.openprovenance.prov.model.Document |
readDocumentFromFile(String filename)
Reads a document from a file, using the file extension to decide which parser to read the file with.
|
org.openprovenance.prov.model.Document |
readDocumentFromFile(String filename,
InteropFramework.ProvFormat format)
Reads a document from a file, using the format to decide which parser to read the file with.
|
void |
run()
Top level entry point of this class, when called from the command line.
|
void |
setNamespaces(org.openprovenance.prov.model.Document doc)
Initializes a Document's namespace.
|
void |
writeDocument(OutputStream os,
InteropFramework.ProvFormat format,
org.openprovenance.prov.model.Document document)
Write a
Document to output stream, according to specified InteropFramework.ProvFormat |
void |
writeDocument(OutputStream os,
javax.ws.rs.core.MediaType mt,
org.openprovenance.prov.model.Document document)
Write a
Document to output stream, according to specified Internet Media Type |
void |
writeDocument(String filename,
org.openprovenance.prov.model.Document document)
Write a
Document to file, serialized according to the file extension |
void |
writeDocument(String filename,
InteropFramework.ProvFormat format,
org.openprovenance.prov.model.Document document)
Write a
Document to file, serialized according to the file extension |
public static final String UNKNOWN
public final Hashtable<InteropFramework.ProvFormat,String> extensionMap
public final Hashtable<String,InteropFramework.ProvFormat> extensionRevMap
public final Hashtable<InteropFramework.ProvFormat,String> mimeTypeMap
public final Hashtable<String,InteropFramework.ProvFormat> mimeTypeRevMap
public final Hashtable<InteropFramework.ProvFormat,InteropFramework.ProvFormatType> provTypeMap
public InteropFramework()
ProvFactory as its default factory.public InteropFramework(org.openprovenance.prov.model.ProvFactory pFactory)
@Deprecated public InteropFramework(String verbose, String debug, String logfile, String infile, String outfile, String namespaces, String title, String layout, String bindings, boolean addOrderp, String generator, String index, String merge, String flatten, org.openprovenance.prov.model.ProvFactory pFactory)
public InteropFramework(String verbose, String debug, String logfile, String infile, String informat, String outfile, String outformat, String namespaces, String title, String layout, String bindings, String bindingformat, boolean addOrderp, String generator, String index, String merge, String flatten, org.openprovenance.prov.model.ProvFactory pFactory)
public String buildAcceptHeader()
public URLConnection connectWithRedirect(URL theURL) throws IOException
theURL - a URL to connect toURLConnectionIOException - if connection cannot be opened and no response is received.public String convertExtensionToMediaType(String extension)
extension - the extension of a file containing a serialization of PROVpublic String getExtension(InteropFramework.ProvFormat format)
format - InteropFramework.ProvFormat for which file extension is soughtpublic InteropFramework.ProvFormat getTypeForFile(String filename)
InteropFramework.ProvFormat given the file's exetensionfilename - the file for which the InteropFramework.ProvFormat is soughtInteropFramework.ProvFormatpublic InteropFramework.ProvFormat getTypeForFormat(String format)
InteropFramework.ProvFormat given a format stringformat - the format for which the InteropFramework.ProvFormat is soughtInteropFramework.ProvFormatpublic List<javax.ws.rs.core.Variant> getVariants()
public void initializeExtensionMap(Hashtable<InteropFramework.ProvFormat,String> extensionMap, Hashtable<String,InteropFramework.ProvFormat> extensionRevMap)
extensionMap - mapping of InteropFramework.ProvFormat to extensionsextensionRevMap - reverse mapping of extensions to InteropFramework.ProvFormatpublic Boolean isInputFormat(InteropFramework.ProvFormat format)
format - a InteropFramework.ProvFormatpublic Boolean isOutputFormat(InteropFramework.ProvFormat format)
format - a InteropFramework.ProvFormatpublic Object loadProvUnknownGraph(String filename)
filename - a file to load the provenance document frompublic static org.openprovenance.prov.model.ProvFactory newXMLProvFactory()
ProvFactorypublic void provn2html(String file, String file2) throws IOException, JAXBException, org.antlr.runtime.RecognitionException
IOExceptionJAXBExceptionorg.antlr.runtime.RecognitionExceptionpublic org.openprovenance.prov.model.Document readDocument(InputStream is, InteropFramework.ProvFormat format)
is - an input streamformat - one of the input formats supported by ProvToolboxpublic org.openprovenance.prov.model.Document readDocument(InputStream is, InteropFramework.ProvFormat format, org.openprovenance.prov.model.ProvFactory pFactory)
is - an input streamformat - one of the input formats supported by ProvToolboxpFactory - a provenance factory used to construct the Documentpublic org.openprovenance.prov.model.Document readDocument(String url)
url - a URLpublic org.openprovenance.prov.model.Document readDocumentFromFile(String filename)
filename - the file to read a document frompublic org.openprovenance.prov.model.Document readDocumentFromFile(String filename, InteropFramework.ProvFormat format)
filename - the file to read a document fromformat - the format of the filepublic org.openprovenance.prov.model.Document readDocument(org.openprovenance.prov.interop.InteropFramework.ToRead something)
public void run()
See method CommandLineArguments.main(String[])
public void setNamespaces(org.openprovenance.prov.model.Document doc)
public void writeDocument(OutputStream os, javax.ws.rs.core.MediaType mt, org.openprovenance.prov.model.Document document)
Document to output stream, according to specified Internet Media Typeos - an OutputStream to write the Document tomt - a MediaTypedocument - a Document to serializepublic void writeDocument(OutputStream os, InteropFramework.ProvFormat format, org.openprovenance.prov.model.Document document)
Document to output stream, according to specified InteropFramework.ProvFormatos - an OutputStream to write the Document toformat - a InteropFramework.ProvFormatdocument - a Document to serializepublic void writeDocument(String filename, org.openprovenance.prov.model.Document document)
Document to file, serialized according to the file extensionfilename - path of the file to write the Document todocument - a Document to serializepublic void writeDocument(String filename, InteropFramework.ProvFormat format, org.openprovenance.prov.model.Document document)
Document to file, serialized according to the file extensionfilename - path of the file to write the Document todocument - a Document to serializeCopyright © 2015. All rights reserved.