Package org.eclipse.rdf4j.sail.lucene
Class SearchFields
- java.lang.Object
-
- org.eclipse.rdf4j.sail.lucene.SearchFields
-
public final class SearchFields extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BNODE_ID_PREFIX
String used to prefix BNode IDs with so that we can distinguish BNode fields from URI fields in Documents.static java.lang.String
CONTEXT_FIELD_NAME
The name of the Document field holding the context identifer(s).static java.lang.String
CONTEXT_NULL
the null contextstatic java.util.regex.Pattern
HIGHLIGHTER_PATTERN
static java.lang.String
HIGHLIGHTER_POST_TAG
static java.lang.String
HIGHLIGHTER_PRE_TAG
static java.lang.String
ID_FIELD_NAME
The name of the Document field holding the document identifier.static java.lang.String
TEXT_FIELD_NAME
The name of the Document field that holds multiple text values of a Resource.static java.lang.String
URI_FIELD_NAME
The name of the Document field holding the Resource identifier.private static ValueFactory
valueFactory
-
Constructor Summary
Constructors Modifier Constructor Description private
SearchFields()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Resource
createContext(java.lang.String idString)
static Resource
createResource(java.lang.String idString)
Parses an id-string (a serialized resource) back to a resource Inverse method ofgetResourceID(Resource)
static Literal
distanceToLiteral(double d)
static java.lang.String
formIdString(java.lang.String resourceId, java.lang.String contextId)
static java.lang.String
getContextID(Resource resource)
Get the ID for a context.static java.lang.String
getLiteralPropertyValueAsString(Statement statement)
static java.lang.String
getPropertyField(IRI property)
static java.lang.String
getResourceID(Resource resource)
Returns the String ID corresponding with the specified Resource.static java.lang.String
getSnippet(java.lang.String highlightedValue)
static boolean
isPropertyField(java.lang.String fieldName)
Determines whether the specified field name is a property field name.static Literal
scoreToLiteral(float score)
Returns a score value encoded as a Literal.static Literal
wktToLiteral(java.lang.String wkt)
-
-
-
Field Detail
-
ID_FIELD_NAME
public static final java.lang.String ID_FIELD_NAME
The name of the Document field holding the document identifier. This consists of the Resource identifier (URI or BNodeID) and the Context ID (the format is "resourceId|contextId")- See Also:
- Constant Field Values
-
URI_FIELD_NAME
public static final java.lang.String URI_FIELD_NAME
The name of the Document field holding the Resource identifier. The value stored in this field is either a URI or a BNode ID.- See Also:
- Constant Field Values
-
TEXT_FIELD_NAME
public static final java.lang.String TEXT_FIELD_NAME
The name of the Document field that holds multiple text values of a Resource. The field is called "text", as it contains all text, but was called "ALL" during the discussion. For each statement-literal of the resource, the object literal is stored in a field using the predicate-literal and additionally in a TEXT_FIELD_NAME-literal field.- See Also:
- Constant Field Values
-
CONTEXT_FIELD_NAME
public static final java.lang.String CONTEXT_FIELD_NAME
The name of the Document field holding the context identifer(s).- See Also:
- Constant Field Values
-
CONTEXT_NULL
public static final java.lang.String CONTEXT_NULL
the null context- See Also:
- Constant Field Values
-
BNODE_ID_PREFIX
public static final java.lang.String BNODE_ID_PREFIX
String used to prefix BNode IDs with so that we can distinguish BNode fields from URI fields in Documents. The prefix is chosen so that it is invalid as a (part of a) URI scheme.- See Also:
- Constant Field Values
-
HIGHLIGHTER_PRE_TAG
public static final java.lang.String HIGHLIGHTER_PRE_TAG
- See Also:
- Constant Field Values
-
HIGHLIGHTER_POST_TAG
public static final java.lang.String HIGHLIGHTER_POST_TAG
- See Also:
- Constant Field Values
-
HIGHLIGHTER_PATTERN
public static final java.util.regex.Pattern HIGHLIGHTER_PATTERN
-
valueFactory
private static final ValueFactory valueFactory
-
-
Method Detail
-
getResourceID
public static java.lang.String getResourceID(Resource resource)
Returns the String ID corresponding with the specified Resource. The id string is either the URI or a bnode prefixed with a "!".
-
getContextID
public static java.lang.String getContextID(Resource resource)
Get the ID for a context. Context can be null, then the "null" string is returned- Parameters:
resource
- the context- Returns:
- a string
-
createResource
public static Resource createResource(java.lang.String idString)
Parses an id-string (a serialized resource) back to a resource Inverse method ofgetResourceID(Resource)
- Parameters:
idString
-- Returns:
- resource
-
createContext
public static Resource createContext(java.lang.String idString)
-
getLiteralPropertyValueAsString
public static java.lang.String getLiteralPropertyValueAsString(Statement statement)
-
getPropertyField
public static java.lang.String getPropertyField(IRI property)
-
isPropertyField
public static boolean isPropertyField(java.lang.String fieldName)
Determines whether the specified field name is a property field name.
-
formIdString
public static java.lang.String formIdString(java.lang.String resourceId, java.lang.String contextId)
-
scoreToLiteral
public static Literal scoreToLiteral(float score)
Returns a score value encoded as a Literal.- Parameters:
score
- the float score to convert- Returns:
- the score as a literal
-
wktToLiteral
public static Literal wktToLiteral(java.lang.String wkt)
-
distanceToLiteral
public static Literal distanceToLiteral(double d)
-
getSnippet
public static java.lang.String getSnippet(java.lang.String highlightedValue)
-
-