public class GenericFilterAssembler extends AssemblerBase
The parameters may be of the following types:
text:TypeString String
text:TypeSet org.apache.lucene.analysis.util.CharArraySet
text:TypeFile java.io.FileReader
text:TypeInt int
text:TypeBoolean boolean
text:TypeTokenStream TokenStream
text:TypeAnalyzer org.apache.lucene.analysis.Analyzer
Although the list of types is not exhaustive it is a simple matter
to create a wrapper Analyzer that reads a file with information that can
be used to initialize any sort of parameters that may be needed for
a given Analyzer. The provided types cover the vast majority of cases.
For example, org.apache.lucene.analysis.ja.JapaneseAnalyzer
has a constructor with 4 parameters: a UserDict,
a CharArraySet, a JapaneseTokenizer.Mode, and a
Set<String>. So a simple wrapper can extract the values
needed for the various parameters with types not available in this
extension, construct the required instances, and instantiate the
JapaneseAnalyzer.
Adding custom Analyzers such as the above wrapper analyzer is a simple matter of adding the Analyzer class and any associated filters and tokenizer and so on to the classpath for Jena - usually in a jar. Of course, all of the Analyzers that are included in the Lucene distribution bundled with Jena are available as generic Analyzers as well.
Each parameter object is specified with:
text:paramName that may be used to document which
parameter is representedtext:paramType which is one of: text:TypeString,
text:TypeSet, text:TypeFile, text:TypeInt,
text:TypeBoolean, text:TypeAnalyzer.
A parameter of type text:TypeSet must have a list of zero or
more Strings.
A parameter of type text:TypeString, text:TypeFile,
text:TypeBoolean, text:TypeInt or text:TypeAnalyzer
must have a single text:paramValue of the appropriate type.
Examples:
<#indexLucene> a text:TextIndexLucene ;
text:directory <file:Lucene> ;
text:entityMap <#entMap> ;
text:defineAnalyzers (
[text:addLang "sa-x-iast" ;
text:analyzer [ . . . ]]
[text:defineAnalyzer <#foo> ;
text:analyzer [ . . . ]]
[text:defineFilter <#bar> ;
text:filter [
a text:GenericFilter ;
text:class "org.apache.jena.query.text.filter.SelectiveFoldingFilter" ;
text:params (
[ text:paramName "whitelisted" ;
text:paramType text:TypeSet ;
text:paramValue ("รง") ]
)
]
]
)
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericFilterAssembler.FilterSpec |
content, defaultModel, documentManager, fileManager, general, infModel, locationMapper, memoryModel, modelSource, ontModel, ontModelSpec, prefixMapping, reasonerFactory, ruleSet, unionModel| Constructor and Description |
|---|
GenericFilterAssembler() |
| Modifier and Type | Method and Description |
|---|---|
GenericFilterAssembler.FilterSpec |
open(Assembler a,
Resource root,
Mode mode) |
getOptionalClassName, getRequiredResource, open, open, openModel, openModelpublic GenericFilterAssembler.FilterSpec open(Assembler a, Resource root, Mode mode)
open in interface Assembleropen in class AssemblerBaseLicenced under the Apache License, Version 2.0