com.mkdoc.sax
Class AbstractRdfContentHandler

java.lang.Object
  |
  +--com.mkdoc.sax.AbstractContentHandler
        |
        +--com.mkdoc.sax.AbstractRdfContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, RdfContentHandler
Direct Known Subclasses:
AbstractStoreWriter, AbstractTripleWriter

public abstract class AbstractRdfContentHandler
extends AbstractContentHandler
implements RdfContentHandler

Base class for RDF content handlers.

Version:
1.6 2005-05-31
Author:
Philip Shaw

Field Summary
static java.lang.String DC_PREFIX
          The Dublin Core metadata scheme prefix.
static java.lang.String DCTERMS_URI
          The Dublin Core terms URI type.
protected static java.lang.String NODE_PREFIX
          A blank node prefix.
protected static java.lang.String NODE_SUFFIX
          A blank node suffix.
static java.lang.String NS_XHTML1
          The XHTML 1.0 namespace URI.
protected  ApplicationProfile profile
          An application profile to resolve metadata values.
static java.lang.String RDF_TYPE
          The RDF type URI.
static java.lang.String RDF_VALUE
          The RDF value URI.
protected  java.lang.String subject
          The subject of the RDF statement.
protected static java.lang.String[] URI_SCHEMES
          A number of schemes that may be used by a URI.
 
Fields inherited from class com.mkdoc.sax.AbstractContentHandler
locator
 
Constructor Summary
AbstractRdfContentHandler()
           
 
Method Summary
static java.lang.String escape(java.lang.String component)
          Escape an N-Triple URI or literal.
 java.lang.String expandPredicate(java.lang.String predicate)
          Expand a schema encoded value to a URI.
 java.lang.String[] expandPredicates(java.lang.String list)
          Expand a space separated list of schema encoded values.
 java.lang.String expandScheme(java.lang.String scheme)
          Expand an encoding scheme to a URI.
 java.lang.String getBNode()
          Get a blank node.
 java.lang.String getBNodeId()
          Get a blank node identifier.
 java.lang.String getSubject()
          Get the current subject URI for the RDF handler.
static boolean isUri(java.lang.String component)
          Check whether a component is an absolute URI.
 void setApplicationProfile(ApplicationProfile profile)
          Set the application profile for the handler.
 void setSubject(java.lang.String uri)
          Set the subject of the RDF content handler.
 
Methods inherited from class com.mkdoc.sax.AbstractContentHandler
characters, endDocument, endElement, endPrefixMapping, getAttributeValue, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 

Field Detail

NS_XHTML1

public static final java.lang.String NS_XHTML1
The XHTML 1.0 namespace URI.

Since:
Version 0.9 2005-02-15
See Also:
Constant Field Values

RDF_TYPE

public static final java.lang.String RDF_TYPE
The RDF type URI.

Since:
Version 0.3 2005-01-06
See Also:
Constant Field Values

RDF_VALUE

public static final java.lang.String RDF_VALUE
The RDF value URI.

Since:
Version 0.3 2005-01-06
See Also:
Constant Field Values

DCTERMS_URI

public static final java.lang.String DCTERMS_URI
The Dublin Core terms URI type.

Since:
Version 0.3 2005-01-06
See Also:
Constant Field Values

DC_PREFIX

public static final java.lang.String DC_PREFIX
The Dublin Core metadata scheme prefix.

Since:
Version 0.3 2005-01-06
See Also:
Constant Field Values

URI_SCHEMES

protected static final java.lang.String[] URI_SCHEMES
A number of schemes that may be used by a URI.

Since:
Version 0.1 2004-12-22

NODE_PREFIX

protected static final java.lang.String NODE_PREFIX
A blank node prefix.

Since:
Version 0.1 2004-12-22
See Also:
Constant Field Values

NODE_SUFFIX

protected static final java.lang.String NODE_SUFFIX
A blank node suffix.

Since:
Version 0.5 2005-01-07
See Also:
Constant Field Values

subject

protected java.lang.String subject
The subject of the RDF statement.

Since:
Version 0.4 2005-01-07

profile

protected ApplicationProfile profile
An application profile to resolve metadata values.

Since:
Version 1.4 2005-05-25
Constructor Detail

AbstractRdfContentHandler

public AbstractRdfContentHandler()
Method Detail

setApplicationProfile

public final void setApplicationProfile(ApplicationProfile profile)
Set the application profile for the handler.

Specified by:
setApplicationProfile in interface RdfContentHandler
Parameters:
profile - The application profile to be used.
Since:
Version 1.5 2005-05-26

setSubject

public final void setSubject(java.lang.String uri)
Set the subject of the RDF content handler.

Specified by:
setSubject in interface RdfContentHandler
Parameters:
uri - The URI of the subject, such as the URL of an (X)HTML document.
Since:
Version 0.4 2005-01-07

getSubject

public final java.lang.String getSubject()
Get the current subject URI for the RDF handler.

Specified by:
getSubject in interface RdfContentHandler
Returns:
The URI of the RDF statement, which may be the URL of an (X)HTML document.
Since:
Version 0.4 2005-01-07

expandPredicate

public final java.lang.String expandPredicate(java.lang.String predicate)
Expand a schema encoded value to a URI.

Specified by:
expandPredicate in interface RdfContentHandler
Parameters:
predicate - The encoded triple predicate to expand in the form "DC.Title" for instance.
Returns:
The expanded URI reference for the triple predicate or the original string if it is not matched.
Since:
Version 0.1 2004-12-22

expandPredicates

public final java.lang.String[] expandPredicates(java.lang.String list)
Expand a space separated list of schema encoded values.

Intended to extract Dublin Core encoded values from HTML link elements' rel or rev attributes, which may be mixed with generic link types. Distinguishes properties that are not encoded metadata predicates and silently drops them.

Specified by:
expandPredicates in interface RdfContentHandler
Parameters:
list - The encoded, space separated link list.
Returns:
An array of expanded URI references only.
Since:
Version 0.8 2005-02-14

expandScheme

public final java.lang.String expandScheme(java.lang.String scheme)
Expand an encoding scheme to a URI.

Specified by:
expandScheme in interface RdfContentHandler
Parameters:
scheme - The encoded triple component to expand in the form "DCTERMS.W3CDTF" for instance.
Returns:
The expanded URI reference for the triple component or the original string if it is not matched.
Since:
Version 0.3 2005-01-06

escape

public static final java.lang.String escape(java.lang.String component)
Escape an N-Triple URI or literal.

Parameters:
component - An N-Triple component.
Returns:
An N-Triple escaped URI or literal.
Since:
Verison 0.1 2004-12-22

isUri

public static final boolean isUri(java.lang.String component)
Check whether a component is an absolute URI.

Only checks for a number of common URI scheme prefixes, the full URI is not validated:

Parameters:
component - The the string to check.
Returns:
true if the component appears to be a URI.
Since:
Version 0.1 2004-12-22

getBNode

public final java.lang.String getBNode()
Get a blank node.

Specified by:
getBNode in interface RdfContentHandler
Returns:
A unique blank node reference.
Since:
Version 0.3 2005-01-06

getBNodeId

public final java.lang.String getBNodeId()
Get a blank node identifier.

Specified by:
getBNodeId in interface RdfContentHandler
Returns:
A unique blank node identifier.
Since:
Version 0.6 2005-01-13