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 of `XPathExtractionRule`.
  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 a `QuadTemplate` 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()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TemplateXPathExtractionRuleImpl

          public TemplateXPathExtractionRuleImpl​(String name,
                                                 String uriRegex)

  - ### 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 interface `TemplateXPathExtractionRule`
      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 interface `TemplateXPathExtractionRule`
      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 a `QuadTemplate` to the rule.
      Specified by:
        `add` in interface `TemplateXPathExtractionRule`
      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 interface `TemplateXPathExtractionRule`
      Parameters:
        `template` - template to be removed.
      Returns:
        `true` if the `template` argument was found.

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `TemplateXPathExtractionRule`
      Specified by:
        `getName` in interface `XPathExtractionRule`
      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 interface `XPathExtractionRule`
      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 interface `XPathExtractionRule`
      Parameters:
        `in` - input document to be processed.
        `er` - output result writer.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`