Package org.apache.any23.extractor.xpath
Class TemplateXPathExtractionRuleImpl
- java.lang.Object
-
- org.apache.any23.extractor.xpath.TemplateXPathExtractionRuleImpl
-
- All Implemented Interfaces:
TemplateXPathExtractionRule
,XPathExtractionRule
public class TemplateXPathExtractionRuleImpl extends Object implements TemplateXPathExtractionRule
Default implementation ofXPathExtractionRule
.- Author:
- Michele Mostarda (mostarda@fbk.eu)
-
-
Constructor Summary
Constructors Constructor Description TemplateXPathExtractionRuleImpl(String name, String uriRegex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptIRI(org.eclipse.rdf4j.model.IRI uri)
Checks if the rule can be applied on the given document IRI.void
add(QuadTemplate template)
Adds aQuadTemplate
to the rule.void
add(Variable variable)
Adds a variable to the template.String
getName()
String
getUriRegex()
void
process(Document in, ExtractionResult er)
Processes this extraction rule on the given document.boolean
remove(QuadTemplate template)
Removes a quad template from the rule.boolean
remove(Variable variable)
Removes a variable from the template.String
toString()
-
-
-
Method Detail
-
getUriRegex
public String getUriRegex()
- Returns:
- the regex pattern filtering the template pages.
-
add
public void add(Variable variable)
Description copied from interface:TemplateXPathExtractionRule
Adds a variable to the template.- Specified by:
add
in interfaceTemplateXPathExtractionRule
- Parameters:
variable
- variable to be added.
-
remove
public boolean remove(Variable variable)
Description copied from interface:TemplateXPathExtractionRule
Removes a variable from the template.- Specified by:
remove
in interfaceTemplateXPathExtractionRule
- Parameters:
variable
- variable to be removed.- Returns:
- true if the
variable
argument was found.
-
add
public void add(QuadTemplate template)
Description copied from interface:TemplateXPathExtractionRule
Adds aQuadTemplate
to the rule.- Specified by:
add
in interfaceTemplateXPathExtractionRule
- Parameters:
template
- template instance to be added.
-
remove
public boolean remove(QuadTemplate template)
Description copied from interface:TemplateXPathExtractionRule
Removes a quad template from the rule.- Specified by:
remove
in interfaceTemplateXPathExtractionRule
- Parameters:
template
- template to be removed.- Returns:
true
if thetemplate
argument was found.
-
getName
public String getName()
- Specified by:
getName
in interfaceTemplateXPathExtractionRule
- Specified by:
getName
in interfaceXPathExtractionRule
- Returns:
- human readable description for this rule.
-
acceptIRI
public boolean acceptIRI(org.eclipse.rdf4j.model.IRI uri)
Description copied from interface:XPathExtractionRule
Checks if the rule can be applied on the given document IRI.- Specified by:
acceptIRI
in interfaceXPathExtractionRule
- Parameters:
uri
- input document IRI.- Returns:
true
if applied,false
otherwise.
-
process
public void process(Document in, ExtractionResult er)
Description copied from interface:XPathExtractionRule
Processes this extraction rule on the given document.- Specified by:
process
in interfaceXPathExtractionRule
- Parameters:
in
- input document to be processed.er
- output result writer.
-
-