org.daml.validator.indications
Class Indication

java.lang.Object
  |
  +--org.daml.validator.indications.Indication
Direct Known Subclasses:
CacheIndication, IncorrectDomainIndication, IncorrectRangeIndication, LiteralExpectedIndication, LoadIndication, ResourceIndication, RestrictionIndication, StatementIndication, TypedLiteralMismatchIndication, TypedLiteralValueIndication, UndefinedPropertyIndication, UndefinedResourceIndication, URIIndication

public class Indication
extends java.lang.Object

Basic validator Indication object used to specify problems found by the validator. Specific indications are subclasses. A basic indication contains the indication type, a level, and a message string. There are three indication levels: Indication.ERROR, Indication.WARNING, and Indication.INFORMATION. Each indication is assigned a unique id number.


Field Summary
static int ERROR
          Error level type
static int INFORMATION
          Information level type
protected static int totalIndications
          The number of individual indications.
static int WARNING
          Warning level type
 
Constructor Summary
Indication()
          Generic indication constructor without message.
Indication(java.lang.String message)
          Generic indication constructor with message.
Indication(java.lang.String message, int level)
           
 
Method Summary
 java.lang.String getLocation()
          Generate a location string for the indication.
 java.lang.String getLocation(java.util.Collection statements)
          Returns a location string for a collection of statements.
 java.lang.String getLocation(com.hp.hpl.mesa.rdf.jena.model.Statement s)
          Returns a location string for a statement.
 java.lang.String getLocation(java.lang.String uri)
          Returns a location string for a URI.
 java.lang.String getLocationXML()
          Generate XML for the location of an exception without any location.
 java.lang.String getLocationXML(java.util.Collection statements)
          Generate a location XML string from a collection of statements.
 java.lang.String getLocationXML(DAMLModelImpl.Node node)
          Generate the location XML string for a node.
 java.lang.String getLocationXML(com.hp.hpl.mesa.rdf.jena.model.Statement s)
          Generate a location xml string for a statement.
 java.lang.String getLocationXML(java.lang.String uri)
          Generate a location xml string for a URI.
 java.lang.String getMessage()
          Generate a message describing the indication.
 java.lang.String getStatementXML(com.hp.hpl.mesa.rdf.jena.model.Statement s)
          Generate a statement xml string for Statement.
static int indicationCount()
          Return the number of indications created since the id counter was last reset.
static void resetIdCounter()
          Reset the counter used to assign indication ids to 0.
 void setLevel(int level)
          Set the level of the indication
 java.lang.String toComparableString()
          Generate a string that can be used to compare indications.
 java.lang.String toString()
          Generate a string representation of the indication.
 java.lang.String toXML()
          Generate the XML representation of the indication.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Error level type

See Also:
Constant Field Values

WARNING

public static final int WARNING
Warning level type

See Also:
Constant Field Values

INFORMATION

public static final int INFORMATION
Information level type

See Also:
Constant Field Values

totalIndications

protected static int totalIndications
The number of individual indications. Occurances of compound indications are counted separately.

Constructor Detail

Indication

public Indication()
Generic indication constructor without message.


Indication

public Indication(java.lang.String message)
Generic indication constructor with message.

Parameters:
message - A description string for the indication.

Indication

public Indication(java.lang.String message,
                  int level)
Method Detail

getMessage

public java.lang.String getMessage()
Generate a message describing the indication. This method should be customized by subClasses.

Returns:
A message describing the indication.

getLocation

public java.lang.String getLocation()
Generate a location string for the indication.

Returns:
Location string

toString

public java.lang.String toString()
Generate a string representation of the indication.

Overrides:
toString in class java.lang.Object
Returns:
The string representation.

toComparableString

public java.lang.String toComparableString()
Generate a string that can be used to compare indications. The ids are excluded because the may not be consistant between runs of the validator.

Returns:
The comparable string representation.

setLevel

public void setLevel(int level)
Set the level of the indication

Parameters:
level - An Indication level value.

toXML

public java.lang.String toXML()
                       throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate the XML representation of the indication.

com.hp.hpl.mesa.rdf.jena.model.RDFException

resetIdCounter

public static void resetIdCounter()
Reset the counter used to assign indication ids to 0.


indicationCount

public static int indicationCount()
Return the number of indications created since the id counter was last reset.

Returns:
The number of indications.

getLocationXML

public java.lang.String getLocationXML()
                                throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate XML for the location of an exception without any location.

Returns:
Location as XML
com.hp.hpl.mesa.rdf.jena.model.RDFException

getLocationXML

public java.lang.String getLocationXML(java.util.Collection statements)
                                throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate a location XML string from a collection of statements. Organizes the statements by URI.

Parameters:
statements - A collection of RDF statements.
Returns:
The statment locations as XML.
com.hp.hpl.mesa.rdf.jena.model.RDFException

getLocationXML

public java.lang.String getLocationXML(DAMLModelImpl.Node node)
                                throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate the location XML string for a node.

Parameters:
node - A DAML node
Returns:
The XML location for the node.
com.hp.hpl.mesa.rdf.jena.model.RDFException

getLocationXML

public java.lang.String getLocationXML(com.hp.hpl.mesa.rdf.jena.model.Statement s)
                                throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate a location xml string for a statement.

Parameters:
s - An RDF statement.
Returns:
The XML location for the statement.
com.hp.hpl.mesa.rdf.jena.model.RDFException

getLocationXML

public java.lang.String getLocationXML(java.lang.String uri)
                                throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate a location xml string for a URI.

Parameters:
uri - URI string.
Returns:
The XML location for the URI.
com.hp.hpl.mesa.rdf.jena.model.RDFException

getStatementXML

public java.lang.String getStatementXML(com.hp.hpl.mesa.rdf.jena.model.Statement s)
                                 throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate a statement xml string for Statement.

Parameters:
s - an RDF Statement
Returns:
The XML representation of the statement.
com.hp.hpl.mesa.rdf.jena.model.RDFException

getLocation

public java.lang.String getLocation(java.lang.String uri)
Returns a location string for a URI.

Parameters:
uri - A URI string.
Returns:
The location string for the URI.

getLocation

public java.lang.String getLocation(com.hp.hpl.mesa.rdf.jena.model.Statement s)
Returns a location string for a statement.

Parameters:
s - An RDF statement.
Returns:
The location strint for the statement.

getLocation

public java.lang.String getLocation(java.util.Collection statements)
Returns a location string for a collection of statements. The statements are grouped by URI and the returned list is sorted by statement and URI.

Parameters:
statements - A collection of RDF statements.
Returns:
The string representation for the location of the statements.