Class Params
- java.lang.Object
-
- org.apache.jena.query.text.assembler.Params
-
public class Params extends java.lang.ObjectParses assembler parameter definitions forGenericAnalyzer,GenericFilter, andGenericTokenizer.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:TypeAnalyzer org.apache.lucene.analysis.Analyzer text:TypeTokenStream org.apache.lucene.analysis.TokenStreamAlthough the list of types is not exhaustive it is a simple matter to create a wrapper Analyzer, Filter, Tokenizer that reads a file with information that can be used to initialize any sort of parameters that may be needed. The provided types cover the vast majority of cases.For example,
org.apache.lucene.analysis.ja.JapaneseAnalyzerhas a constructor with 4 parameters: aUserDict, aCharArraySet, aJapaneseTokenizer.Mode, and aSet<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 theJapaneseAnalyzer.Adding custom Analyzers, etc., 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, Filters, and Tokenizers that are included in the Lucene distribution bundled with Jena are available as generics as well.
Each parameter object is specified with:
- an optional
text:paramNamethat may be used to document which parameter is represented - a
text:paramTypewhich is one of:text:TypeString,text:TypeSet,text:TypeFile,text:TypeInt,text:TypeBoolean,text:TypeAnalyzer. - a text:paramValue which is an xsd:string, xsd:boolean or xsd:int or resource.
A parameter of type
text:TypeSetmust have a list of zero or moreStrings.A parameter of type
text:TypeString,text:TypeFile,text:TypeBoolean,text:TypeIntortext:TypeAnalyzermust have a singletext:paramValueof the appropriate type.A parameter of type
text:TypeTokenStreamdoes not havetext:paramValue. It is used to mark the occurence of theTokenStreamparameter for aFilter.Examples:
text:map ( [ text:field "text" ; text:predicate rdfs:label; text:analyzer [ a text:GenericAnalyzer ; text:class "org.apache.lucene.analysis.en.EnglishAnalyzer" ; text:params ( [ text:paramName "stopwords" ; text:paramType text:TypeSet ; text:paramValue ("the" "a" "an") ] [ text:paramName "stemExclusionSet" ; text:paramType text:TypeSet ; text:paramValue ("ing" "ed") ] ) ] .[] a text:TextIndexLucene ; text:defineFilters ( text:filter [ a text:GenericFilter ; text:class "fi.finto.FoldingFilter" ; text:params ( [ text:paramName "source" ; text:paramType text:TypeTokenStream ] [ text:paramName "whitelisted" ; text:paramType text:TypeSet ; text:paramValue ("รง") ] ) ] ) - an optional
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTYPE_ANALYZERstatic java.lang.StringTYPE_BOOLstatic java.lang.StringTYPE_FILEstatic java.lang.StringTYPE_INTstatic java.lang.StringTYPE_SETstatic java.lang.StringTYPE_STRINGstatic java.lang.StringTYPE_TOKENSTREAM
-
Constructor Summary
Constructors Constructor Description Params()
-
-
-
Field Detail
-
TYPE_ANALYZER
public static final java.lang.String TYPE_ANALYZER
- See Also:
- Constant Field Values
-
TYPE_BOOL
public static final java.lang.String TYPE_BOOL
- See Also:
- Constant Field Values
-
TYPE_FILE
public static final java.lang.String TYPE_FILE
- See Also:
- Constant Field Values
-
TYPE_INT
public static final java.lang.String TYPE_INT
- See Also:
- Constant Field Values
-
TYPE_SET
public static final java.lang.String TYPE_SET
- See Also:
- Constant Field Values
-
TYPE_STRING
public static final java.lang.String TYPE_STRING
- See Also:
- Constant Field Values
-
TYPE_TOKENSTREAM
public static final java.lang.String TYPE_TOKENSTREAM
- See Also:
- Constant Field Values
-
-