|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.any23.extractor.ExtractionResultImpl
public class ExtractionResultImpl
A default implementation of
ExtractionResult; it receives
extraction output from one Extractor working on one document,
and passes the output on to a TripleHandler. It deals with
details such as creation of ExtractionContext objects
and closing any open contexts at the end of extraction.
The close() method must be invoked after the extractor has
finished processing.
There is usually no need to provide additional implementations
of the ExtractionWriter interface.
TripleHandler,
ExtractionContext| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.any23.extractor.TagSoupExtractionResult |
|---|
TagSoupExtractionResult.PropertyPath, TagSoupExtractionResult.ResourceRoot |
| Nested classes/interfaces inherited from interface org.apache.any23.extractor.ErrorReporter |
|---|
ErrorReporter.Error, ErrorReporter.ErrorLevel |
| Constructor Summary | |
|---|---|
ExtractionResultImpl(ExtractionContext context,
Extractor<?> extractor,
TripleHandler tripleHandler)
|
|
| Method Summary | |
|---|---|
void |
addPropertyPath(Class<? extends MicroformatExtractor> extractor,
org.openrdf.model.Resource propertySubject,
org.openrdf.model.Resource property,
org.openrdf.model.BNode object,
String[] path)
Adds a property path to the list of the extracted data. |
void |
addResourceRoot(String[] path,
org.openrdf.model.Resource root,
Class<? extends MicroformatExtractor> extractor)
Adds a root property to the extraction result, specifying also the path corresponding to the root of data which generated the property and the extractor responsible for such addition. |
void |
close()
Close the result. |
Collection<ErrorReporter.Error> |
getErrors()
Returns all the collected errors. |
int |
getErrorsCount()
|
ExtractionContext |
getExtractionContext()
|
List<TagSoupExtractionResult.PropertyPath> |
getPropertyPaths()
Returns all the collected property paths. |
List<TagSoupExtractionResult.ResourceRoot> |
getResourceRoots()
Returns all the collected property roots. |
boolean |
hasErrors()
|
void |
notifyError(ErrorReporter.ErrorLevel level,
String msg,
int row,
int col)
Notifies an error occurred while performing an extraction on an input stream. |
ExtractionResult |
openSubResult(ExtractionContext context)
Open a result nested in the current one. |
void |
printErrorsReport(PrintStream ps)
Prints out an errors report. |
String |
toString()
|
void |
writeNamespace(String prefix,
String uri)
Write a namespace. |
void |
writeTriple(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Write a triple. |
void |
writeTriple(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
org.openrdf.model.URI g)
Writes a triple. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ExtractionResultImpl(ExtractionContext context,
Extractor<?> extractor,
TripleHandler tripleHandler)
| Method Detail |
|---|
public boolean hasErrors()
public int getErrorsCount()
public void printErrorsReport(PrintStream ps)
ErrorReporter
printErrorsReport in interface ErrorReporterpublic Collection<ErrorReporter.Error> getErrors()
ErrorReporter
getErrors in interface ErrorReporterErrorReporter.Errors.public ExtractionResult openSubResult(ExtractionContext context)
ExtractionResult
openSubResult in interface ExtractionResultcontext - the context to be used to open the sub result.
public ExtractionContext getExtractionContext()
public void writeTriple(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o,
org.openrdf.model.URI g)
ExtractionResult
writeTriple in interface ExtractionResults - subjectp - predicateo - objectg - graph
public void writeTriple(org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
ExtractionResult
writeTriple in interface ExtractionResults - subjectp - predicateo - object
public void writeNamespace(String prefix,
String uri)
ExtractionResult
writeNamespace in interface ExtractionResultprefix - the prefix of the namespaceuri - the long URI identifying the namespace
public void notifyError(ErrorReporter.ErrorLevel level,
String msg,
int row,
int col)
ErrorReporter
notifyError in interface ErrorReporterlevel - error level.msg - error message.row - error row.col - error column.public void close()
ExtractionResult
close in interface ExtractionResult
public void addResourceRoot(String[] path,
org.openrdf.model.Resource root,
Class<? extends MicroformatExtractor> extractor)
TagSoupExtractionResult
addResourceRoot in interface TagSoupExtractionResultpath - the path from the document root to the local root of the data generating the property.root - the property root node.extractor - the extractor responsible of such extraction.public List<TagSoupExtractionResult.ResourceRoot> getResourceRoots()
TagSoupExtractionResult
getResourceRoots in interface TagSoupExtractionResultTagSoupExtractionResult.ResourceRoots.
public void addPropertyPath(Class<? extends MicroformatExtractor> extractor,
org.openrdf.model.Resource propertySubject,
org.openrdf.model.Resource property,
org.openrdf.model.BNode object,
String[] path)
TagSoupExtractionResult
addPropertyPath in interface TagSoupExtractionResultextractor - the identifier of the extractor responsible for retrieving such property.propertySubject - the subject of the property.property - the property URI.object - the property object if any, null otherwise.path - the path of the HTML node from which the property literal has been extracted.public List<TagSoupExtractionResult.PropertyPath> getPropertyPaths()
TagSoupExtractionResult
getPropertyPaths in interface TagSoupExtractionResultpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||