org.eaglei.repository.format
Class SPARQLHTMLWriter

java.lang.Object
  extended by org.eaglei.repository.format.SPARQLHTMLWriter
All Implemented Interfaces:
org.openrdf.query.resultio.TupleQueryResultWriter, org.openrdf.query.TupleQueryResultHandler

public class SPARQLHTMLWriter
extends java.lang.Object
implements org.openrdf.query.resultio.TupleQueryResultWriter

Very quick-n-dirty HTML query result output, helpful for interactive debugging XXX FIXME low priority, maybe later, add class tags, odd/even rows and columns, to facilitate better styling.

Version:
$Id: $
Author:
lcs

Field Summary
static java.lang.String Postlogue
          HTML trailer
static java.lang.String Prologue
          HTML header
static org.openrdf.query.resultio.TupleQueryResultFormat theFormat
          Constant theFormat
 
Constructor Summary
SPARQLHTMLWriter(java.io.OutputStream out)
          Constructor for SPARQLHTMLWriter.
 
Method Summary
 void endQueryResult()
          endQueryResult
 org.openrdf.query.resultio.TupleQueryResultFormat getTupleQueryResultFormat()
          getTupleQueryResultFormat
 void handleSolution(org.openrdf.query.BindingSet bs)
          
static void printValue(java.lang.Appendable out, org.openrdf.model.Value v)
          Render Value as an HTML fragment including markup for the switchable "detail" view that hides literal type URIs for less clutter.
protected static java.lang.String renderLinkedURI(org.openrdf.model.URI uri)
          Produce HTML rendering of a URI that is possibly linked data.
 void startQueryResult(java.util.List<java.lang.String> bindingNames)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theFormat

public static final org.openrdf.query.resultio.TupleQueryResultFormat theFormat
Constant theFormat


Prologue

public static final java.lang.String Prologue
HTML header

See Also:
Constant Field Values

Postlogue

public static final java.lang.String Postlogue
HTML trailer

See Also:
Constant Field Values
Constructor Detail

SPARQLHTMLWriter

public SPARQLHTMLWriter(java.io.OutputStream out)

Constructor for SPARQLHTMLWriter.

Parameters:
out - a OutputStream object.
Method Detail

getTupleQueryResultFormat

public org.openrdf.query.resultio.TupleQueryResultFormat getTupleQueryResultFormat()

getTupleQueryResultFormat

Specified by:
getTupleQueryResultFormat in interface org.openrdf.query.resultio.TupleQueryResultWriter
Returns:
a TupleQueryResultFormat object.

startQueryResult

public void startQueryResult(java.util.List<java.lang.String> bindingNames)
                      throws org.openrdf.query.TupleQueryResultHandlerException

Specified by:
startQueryResult in interface org.openrdf.query.TupleQueryResultHandler
Throws:
org.openrdf.query.TupleQueryResultHandlerException

endQueryResult

public void endQueryResult()
                    throws org.openrdf.query.TupleQueryResultHandlerException

endQueryResult

Specified by:
endQueryResult in interface org.openrdf.query.TupleQueryResultHandler
Throws:
org.openrdf.query.TupleQueryResultHandlerException - if any.

handleSolution

public void handleSolution(org.openrdf.query.BindingSet bs)
                    throws org.openrdf.query.TupleQueryResultHandlerException

Specified by:
handleSolution in interface org.openrdf.query.TupleQueryResultHandler
Throws:
org.openrdf.query.TupleQueryResultHandlerException

printValue

public static void printValue(java.lang.Appendable out,
                              org.openrdf.model.Value v)
                       throws java.io.IOException
Render Value as an HTML fragment including markup for the switchable "detail" view that hides literal type URIs for less clutter. See the Prologue for how this works. Also escape newlines to show line breaks accurately. Note that all other markup, e.g. table cell, font, must be wrapped around the call to this method.

Parameters:
out - the PrintStream or Writer (as Appendable) to which to output
v - sesame Value object to display
Throws:
java.io.IOException - if i/o fails

renderLinkedURI

protected static java.lang.String renderLinkedURI(org.openrdf.model.URI uri)
Produce HTML rendering of a URI that is possibly linked data. This initial version just makes links for resources that this repository is obviously capable of resolving (if correctly configured). Eventually it ought to be extended to include resolution URLs for other links that we expect to be resolvable, e.g. ontology URLs, internal repository objects, etc..

Parameters:
uri - a URI object.
Returns:
a String object.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.