Package org.apache.any23.extractor
Class ExtractionResultImpl
- java.lang.Object
-
- org.apache.any23.extractor.ExtractionResultImpl
-
- All Implemented Interfaces:
org.apache.any23.extractor.ExtractionResult,org.apache.any23.extractor.IssueReport,TagSoupExtractionResult
public class ExtractionResultImpl extends Object implements TagSoupExtractionResult
A default implementation of
ExtractionResult; it receives extraction output from oneExtractorworking on one document, and passes the output on to aTripleHandler. It deals with details such as creation ofExtractionContextobjects 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.
- Author:
- Richard Cyganiak (richard@cyganiak.de), Michele Mostarda (michele.mostarda@gmail.com)
- See Also:
TripleHandler,ExtractionContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.any23.extractor.IssueReport
org.apache.any23.extractor.IssueReport.Issue, org.apache.any23.extractor.IssueReport.IssueLevel
-
Nested classes/interfaces inherited from interface org.apache.any23.extractor.TagSoupExtractionResult
TagSoupExtractionResult.PropertyPath, TagSoupExtractionResult.ResourceRoot
-
-
Constructor Summary
Constructors Constructor Description ExtractionResultImpl(org.apache.any23.extractor.ExtractionContext context, org.apache.any23.extractor.Extractor<?> extractor, org.apache.any23.writer.TripleHandler tripleHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyPath(Class<? extends MicroformatExtractor> extractor, org.eclipse.rdf4j.model.Resource propertySubject, org.eclipse.rdf4j.model.Resource property, org.eclipse.rdf4j.model.BNode object, String[] path)Adds a property path to the list of the extracted data.voidaddResourceRoot(String[] path, org.eclipse.rdf4j.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.voidclose()org.apache.any23.extractor.ExtractionContextgetExtractionContext()Collection<org.apache.any23.extractor.IssueReport.Issue>getIssues()intgetIssuesCount()List<TagSoupExtractionResult.PropertyPath>getPropertyPaths()Returns all the collected property paths.List<TagSoupExtractionResult.ResourceRoot>getResourceRoots()Returns all the collected property roots.booleanhasIssues()voidnotifyIssue(org.apache.any23.extractor.IssueReport.IssueLevel level, String msg, long row, long col)org.apache.any23.extractor.ExtractionResultopenSubResult(org.apache.any23.extractor.ExtractionContext context)voidprintReport(PrintStream ps)StringtoString()voidwriteNamespace(String prefix, String uri)voidwriteTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o)voidwriteTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.IRI g)
-
-
-
Method Detail
-
hasIssues
public boolean hasIssues()
-
getIssuesCount
public int getIssuesCount()
-
printReport
public void printReport(PrintStream ps)
- Specified by:
printReportin interfaceorg.apache.any23.extractor.IssueReport
-
getIssues
public Collection<org.apache.any23.extractor.IssueReport.Issue> getIssues()
- Specified by:
getIssuesin interfaceorg.apache.any23.extractor.IssueReport
-
openSubResult
public org.apache.any23.extractor.ExtractionResult openSubResult(org.apache.any23.extractor.ExtractionContext context)
- Specified by:
openSubResultin interfaceorg.apache.any23.extractor.ExtractionResult
-
getExtractionContext
public org.apache.any23.extractor.ExtractionContext getExtractionContext()
-
writeTriple
public void writeTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.IRI g)- Specified by:
writeTriplein interfaceorg.apache.any23.extractor.ExtractionResult
-
writeTriple
public void writeTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o)- Specified by:
writeTriplein interfaceorg.apache.any23.extractor.ExtractionResult
-
writeNamespace
public void writeNamespace(String prefix, String uri)
- Specified by:
writeNamespacein interfaceorg.apache.any23.extractor.ExtractionResult
-
notifyIssue
public void notifyIssue(org.apache.any23.extractor.IssueReport.IssueLevel level, String msg, long row, long col)- Specified by:
notifyIssuein interfaceorg.apache.any23.extractor.IssueReport
-
close
public void close()
- Specified by:
closein interfaceorg.apache.any23.extractor.ExtractionResult
-
addResourceRoot
public void addResourceRoot(String[] path, org.eclipse.rdf4j.model.Resource root, Class<? extends MicroformatExtractor> extractor)
Description copied from interface:TagSoupExtractionResultAdds 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.- Specified by:
addResourceRootin interfaceTagSoupExtractionResult- Parameters:
path- 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.
-
getResourceRoots
public List<TagSoupExtractionResult.ResourceRoot> getResourceRoots()
Description copied from interface:TagSoupExtractionResultReturns all the collected property roots.- Specified by:
getResourceRootsin interfaceTagSoupExtractionResult- Returns:
- an unmodifiable list of
TagSoupExtractionResult.ResourceRoots.
-
addPropertyPath
public void addPropertyPath(Class<? extends MicroformatExtractor> extractor, org.eclipse.rdf4j.model.Resource propertySubject, org.eclipse.rdf4j.model.Resource property, org.eclipse.rdf4j.model.BNode object, String[] path)
Description copied from interface:TagSoupExtractionResultAdds a property path to the list of the extracted data.- Specified by:
addPropertyPathin interfaceTagSoupExtractionResult- Parameters:
extractor- the identifier of the extractor responsible for retrieving such property.propertySubject- the subject of the property.property- the property IRI.object- the property object if any,nullotherwise.path- the path of the HTML node from which the property literal has been extracted.
-
getPropertyPaths
public List<TagSoupExtractionResult.PropertyPath> getPropertyPaths()
Description copied from interface:TagSoupExtractionResultReturns all the collected property paths.- Specified by:
getPropertyPathsin interfaceTagSoupExtractionResult- Returns:
- a valid list of property paths.
-
-